contextos-agents 2.2.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/.agents/AGENTS.md +53 -396
  2. package/.agents/adapters/aider/export.js +11 -16
  3. package/.agents/adapters/claude/export.js +13 -13
  4. package/.agents/adapters/copilot/export.js +29 -8
  5. package/.agents/adapters/cursor/export.js +9 -18
  6. package/.agents/adapters/gemini/export.js +11 -46
  7. package/.agents/adapters/pure-compiler.js +65 -42
  8. package/.agents/adapters/shared.js +35 -1
  9. package/.agents/adapters/zed/export.js +2 -2
  10. package/.agents/compiled/registry.v2.json +30 -18
  11. package/.agents/compiled/registry.v2.sha256 +1 -1
  12. package/.agents/compiler/manifest-compiler.js +5 -29
  13. package/.agents/core/skills/context-os/references/project-graph.md +3 -3
  14. package/.agents/core/skills/engineering-workflow/SKILL.md +11 -316
  15. package/.agents/core/skills/engineering-workflow/references/workflow.md +336 -0
  16. package/.agents/core/skills/engineering-workflow/skill.yaml +2 -4
  17. package/.agents/core/skills/gstack-roles/SKILL.md +11 -128
  18. package/.agents/core/skills/gstack-roles/references/roles.md +149 -0
  19. package/.agents/core/skills/gstack-roles/skill.yaml +2 -4
  20. package/.agents/core/skills/ponytail-mindset/SKILL.md +13 -165
  21. package/.agents/core/skills/ponytail-mindset/references/minimalism.md +186 -0
  22. package/.agents/core/skills/ponytail-mindset/skill.yaml +2 -5
  23. package/.agents/core/skills/security/skill.yaml +1 -0
  24. package/.agents/ctx.js +13 -13
  25. package/.agents/customization-dx.js +13 -9
  26. package/.agents/doctor.js +2 -2
  27. package/.agents/generated/claude/skills/context-manager/EXAMPLES.md +19 -0
  28. package/.agents/generated/claude/skills/context-manager/SKILL.md +0 -29
  29. package/.agents/generated/claude/skills/context-manager/TROUBLESHOOTING.md +7 -0
  30. package/.agents/generated/claude/skills/context-manager/VALIDATION.json +12 -0
  31. package/.agents/generated/claude/skills/context-manager/references/context-rules.md +59 -0
  32. package/.agents/generated/claude/skills/context-os/EXAMPLES.md +21 -0
  33. package/.agents/generated/claude/skills/context-os/SKILL.md +0 -31
  34. package/.agents/generated/claude/skills/context-os/TROUBLESHOOTING.md +7 -0
  35. package/.agents/generated/claude/skills/context-os/VALIDATION.json +12 -0
  36. package/.agents/generated/claude/skills/context-os/packs.yaml +59 -0
  37. package/.agents/generated/claude/skills/context-os/references/context-rules.md +68 -0
  38. package/.agents/generated/claude/skills/context-os/references/pipeline.md +119 -0
  39. package/.agents/generated/claude/skills/context-os/references/project-graph.md +103 -0
  40. package/.agents/generated/claude/skills/context-os/rules.yaml +135 -0
  41. package/.agents/generated/claude/skills/engineering-workflow/EXAMPLES.md +57 -0
  42. package/.agents/generated/claude/skills/engineering-workflow/SKILL.md +10 -391
  43. package/.agents/generated/claude/skills/engineering-workflow/TROUBLESHOOTING.md +19 -0
  44. package/.agents/generated/claude/skills/engineering-workflow/VALIDATION.json +12 -0
  45. package/.agents/generated/claude/skills/engineering-workflow/references/workflow.md +336 -0
  46. package/.agents/generated/claude/skills/gemini-precision/EXAMPLES.md +72 -0
  47. package/.agents/generated/claude/skills/gemini-precision/SKILL.md +0 -100
  48. package/.agents/generated/claude/skills/gemini-precision/TROUBLESHOOTING.md +25 -0
  49. package/.agents/generated/claude/skills/gemini-precision/VALIDATION.json +12 -0
  50. package/.agents/generated/claude/skills/gstack-roles/EXAMPLES.md +23 -0
  51. package/.agents/generated/claude/skills/gstack-roles/SKILL.md +10 -164
  52. package/.agents/generated/claude/skills/gstack-roles/TROUBLESHOOTING.md +13 -0
  53. package/.agents/generated/claude/skills/gstack-roles/VALIDATION.json +12 -0
  54. package/.agents/generated/claude/skills/gstack-roles/references/roles.md +149 -0
  55. package/.agents/generated/claude/skills/ponytail-mindset/EXAMPLES.md +45 -0
  56. package/.agents/generated/claude/skills/ponytail-mindset/SKILL.md +12 -228
  57. package/.agents/generated/claude/skills/ponytail-mindset/TROUBLESHOOTING.md +19 -0
  58. package/.agents/generated/claude/skills/ponytail-mindset/VALIDATION.json +12 -0
  59. package/.agents/generated/claude/skills/ponytail-mindset/references/minimalism.md +186 -0
  60. package/.agents/generated/claude/skills/security/EXAMPLES.md +64 -0
  61. package/.agents/generated/claude/skills/security/SKILL.md +0 -86
  62. package/.agents/generated/claude/skills/security/TROUBLESHOOTING.md +19 -0
  63. package/.agents/generated/claude/skills/security/VALIDATION.json +12 -0
  64. package/.agents/generated/gemini/skills/context-manager/EXAMPLES.md +19 -0
  65. package/.agents/generated/gemini/skills/context-manager/SKILL.md +1 -33
  66. package/.agents/generated/gemini/skills/context-manager/TROUBLESHOOTING.md +7 -0
  67. package/.agents/generated/gemini/skills/context-manager/VALIDATION.json +12 -0
  68. package/.agents/generated/gemini/skills/context-manager/references/context-rules.md +59 -0
  69. package/.agents/generated/gemini/skills/context-os/EXAMPLES.md +21 -0
  70. package/.agents/generated/gemini/skills/context-os/SKILL.md +0 -35
  71. package/.agents/generated/gemini/skills/context-os/TROUBLESHOOTING.md +7 -0
  72. package/.agents/generated/gemini/skills/context-os/VALIDATION.json +12 -0
  73. package/.agents/generated/gemini/skills/context-os/packs.yaml +59 -0
  74. package/.agents/generated/gemini/skills/context-os/references/context-rules.md +68 -0
  75. package/.agents/generated/gemini/skills/context-os/references/pipeline.md +119 -0
  76. package/.agents/generated/gemini/skills/context-os/references/project-graph.md +103 -0
  77. package/.agents/generated/gemini/skills/context-os/rules.yaml +135 -0
  78. package/.agents/generated/gemini/skills/engineering-workflow/EXAMPLES.md +57 -0
  79. package/.agents/generated/gemini/skills/engineering-workflow/SKILL.md +11 -396
  80. package/.agents/generated/gemini/skills/engineering-workflow/TROUBLESHOOTING.md +19 -0
  81. package/.agents/generated/gemini/skills/engineering-workflow/VALIDATION.json +12 -0
  82. package/.agents/generated/gemini/skills/engineering-workflow/references/workflow.md +336 -0
  83. package/.agents/generated/gemini/skills/gemini-precision/EXAMPLES.md +72 -0
  84. package/.agents/generated/gemini/skills/gemini-precision/SKILL.md +0 -104
  85. package/.agents/generated/gemini/skills/gemini-precision/TROUBLESHOOTING.md +25 -0
  86. package/.agents/generated/gemini/skills/gemini-precision/VALIDATION.json +12 -0
  87. package/.agents/generated/gemini/skills/gstack-roles/EXAMPLES.md +23 -0
  88. package/.agents/generated/gemini/skills/gstack-roles/SKILL.md +11 -169
  89. package/.agents/generated/gemini/skills/gstack-roles/TROUBLESHOOTING.md +13 -0
  90. package/.agents/generated/gemini/skills/gstack-roles/VALIDATION.json +12 -0
  91. package/.agents/generated/gemini/skills/gstack-roles/references/roles.md +149 -0
  92. package/.agents/generated/gemini/skills/ponytail-mindset/EXAMPLES.md +45 -0
  93. package/.agents/generated/gemini/skills/ponytail-mindset/SKILL.md +13 -233
  94. package/.agents/generated/gemini/skills/ponytail-mindset/TROUBLESHOOTING.md +19 -0
  95. package/.agents/generated/gemini/skills/ponytail-mindset/VALIDATION.json +12 -0
  96. package/.agents/generated/gemini/skills/ponytail-mindset/references/minimalism.md +186 -0
  97. package/.agents/generated/gemini/skills/security/EXAMPLES.md +64 -0
  98. package/.agents/generated/gemini/skills/security/SKILL.md +2 -92
  99. package/.agents/generated/gemini/skills/security/TROUBLESHOOTING.md +19 -0
  100. package/.agents/generated/gemini/skills/security/VALIDATION.json +12 -0
  101. package/.agents/plugins.js +24 -5
  102. package/.agents/resolver/canonical-resolver.js +43 -7
  103. package/.agents/resolver/resolve-args.js +31 -0
  104. package/.agents/stats.js +8 -11
  105. package/.agents/workspace/workspace-graph.js +16 -6
  106. package/README.md +48 -18
  107. package/bin/index.js +1 -1
  108. package/bin/lib/ui.js +2 -2
  109. package/package.json +89 -86
@@ -0,0 +1,135 @@
1
+ # Rule Engine
2
+ # Conditional logic for context compilation based on project profile and task type
3
+
4
+ rules:
5
+ # ═══════════════════════════════════════
6
+ # Profile-based rules
7
+ # ═══════════════════════════════════════
8
+
9
+ - name: mvp-minimal
10
+ description: MVP projects skip heavy infrastructure
11
+ if:
12
+ profile: mvp
13
+ then:
14
+ exclude_skills: [microservices, ddd, kubernetes, monitoring, cicd]
15
+ exclude_docs: [DEPLOYMENT.md]
16
+ prefer_skills: [sqlite, simple-auth, minimal-architecture]
17
+ max_doc_depth: 2 # Only Level 1 + Level 2
18
+
19
+ - name: enterprise-strict
20
+ description: Enterprise projects require full documentation and rigor
21
+ if:
22
+ profile: enterprise
23
+ then:
24
+ require_skills: [ddd, security, testing, cicd]
25
+ require_docs: [ARCHITECTURE.md, DATABASE.md, API.md, DECISIONS]
26
+ enforce_adr: true # Every architectural decision must be recorded
27
+ enforce_testing: true
28
+ min_doc_depth: 3 # All levels required
29
+
30
+ - name: hackathon-speed
31
+ description: Hackathon mode — maximum speed, minimum ceremony
32
+ if:
33
+ profile: hackathon
34
+ then:
35
+ exclude_skills: [kubernetes, monitoring, cicd, ddd, microservices]
36
+ exclude_docs: [DEPLOYMENT.md, ROADMAP.md]
37
+ prefer_skills: [sqlite, simple-auth]
38
+ skip_review: true
39
+ max_doc_depth: 1 # Vision only
40
+
41
+ - name: startup-balanced
42
+ description: Startup balance between speed and quality
43
+ if:
44
+ profile: startup
45
+ then:
46
+ exclude_skills: [kubernetes, ddd]
47
+ prefer_skills: [postgres, jwt-auth, docker]
48
+ enforce_adr: false
49
+ max_doc_depth: 2
50
+
51
+ # ═══════════════════════════════════════
52
+ # Task-based rules
53
+ # ═══════════════════════════════════════
54
+
55
+ - name: frontend-task
56
+ description: Frontend tasks don't need database or deployment docs
57
+ if:
58
+ task_type: frontend
59
+ then:
60
+ load_docs: [UI.md, ARCHITECTURE.md, API.md]
61
+ skip_docs: [DATABASE.md, DEPLOYMENT.md]
62
+ load_skill_categories: [frontend, design]
63
+ skip_skill_categories: [backend, infrastructure]
64
+
65
+ - name: backend-task
66
+ description: Backend tasks don't need UI docs
67
+ if:
68
+ task_type: backend
69
+ then:
70
+ load_docs: [ARCHITECTURE.md, DATABASE.md, API.md]
71
+ skip_docs: [UI.md]
72
+ load_skill_categories: [backend, architecture]
73
+ skip_skill_categories: [design]
74
+
75
+ - name: architecture-task
76
+ description: Architecture tasks load everything at high level
77
+ if:
78
+ task_type: architecture
79
+ then:
80
+ load_docs: [PRD.md, ARCHITECTURE.md, DATABASE.md, API.md, PROJECT_GRAPH.md]
81
+ load_skill_categories: [architecture]
82
+ skip_skill_categories: [design]
83
+
84
+ - name: bugfix-task
85
+ description: Bugfixes need minimal context — focus on affected module
86
+ if:
87
+ task_type: bugfix
88
+ then:
89
+ load_docs: [PROJECT_GRAPH.md] # Find affected module
90
+ max_doc_depth: 1
91
+ skip_docs: [PRD.md, ROADMAP.md]
92
+
93
+ - name: refactor-task
94
+ description: Refactoring needs architecture context
95
+ if:
96
+ task_type: refactor
97
+ then:
98
+ load_docs: [ARCHITECTURE.md, PROJECT_GRAPH.md]
99
+ load_skill_categories: [architecture]
100
+
101
+ # ═══════════════════════════════════════
102
+ # Stack-based rules
103
+ # ═══════════════════════════════════════
104
+
105
+ - name: react-ecosystem
106
+ description: React projects auto-load TypeScript
107
+ if:
108
+ skill_loaded: react
109
+ then:
110
+ auto_load: [typescript]
111
+ suggest: [tailwind, react-query]
112
+
113
+ - name: nextjs-ecosystem
114
+ description: Next.js implies React + TypeScript + SSR patterns
115
+ if:
116
+ skill_loaded: nextjs
117
+ then:
118
+ auto_load: [react, typescript]
119
+ suggest: [prisma, next-auth, tailwind]
120
+
121
+ - name: fastapi-ecosystem
122
+ description: FastAPI implies Python + Pydantic
123
+ if:
124
+ skill_loaded: fastapi
125
+ then:
126
+ auto_load: [python, pydantic]
127
+ suggest: [postgres, docker, testing]
128
+
129
+ - name: no-conflicts
130
+ description: Prevent incompatible frameworks
131
+ if:
132
+ any_loaded: [react, vue, angular, svelte]
133
+ then:
134
+ conflict_check: true
135
+ max_frontend_frameworks: 1
@@ -0,0 +1,57 @@
1
+ # engineering-workflow Examples — Anti-patterns vs ContextOS Standard
2
+
3
+ ## Example 1: Handling a New Feature Request
4
+
5
+ ### Anti-pattern: Jumping Straight to Code
6
+
7
+ ```text
8
+ User: "Add a user referral system."
9
+ Agent: Immediately creates src/referral.js, starts writing database queries, guesses schema,
10
+ and misses requirements like rate limiting, expiry dates, and fraud prevention.
11
+ ```
12
+
13
+ ### Best practice: ContextOS Standard (DEFINE -> PLAN -> BUILD)
14
+
15
+ ```markdown
16
+ [DOMAIN: Full-Stack] [PHASE: Define] [ROLE: Product Manager]
17
+ Skills loaded: engineering-workflow, interview-me
18
+
19
+ ## Feature Spec: User Referral System
20
+ ### Why (Problem)
21
+ Increase user acquisition through organic word-of-mouth incentives.
22
+
23
+ ### Scope
24
+ In-Scope:
25
+ - Unique referral code generation per registered user
26
+ - Referral code attribution on signup
27
+ - Credit reward trigger after first completed purchase
28
+ Out-of-Scope:
29
+ - Multi-tier MLM rewards
30
+ - Cash payout integrations
31
+
32
+ ### Acceptance Criteria
33
+ - [ ] Given a registered user, when visiting /referrals, then unique code is displayed.
34
+ - [ ] Given a new user with code, when signing up, then referrer_id is stored with status 'pending'.
35
+ ```
36
+
37
+ ---
38
+
39
+ ## Example 2: Atomic Task Execution in PLAN Phase
40
+
41
+ ### Anti-pattern: Monolithic Mega-Task
42
+
43
+ ```text
44
+ Task: "Implement entire referral system end-to-end in one shot."
45
+ Result: 15 files modified simultaneously, uncompilable intermediate state, untestable diff.
46
+ ```
47
+
48
+ ### Best practice: ContextOS Standard (Atomic Tasks with Test Gate)
49
+
50
+ ```markdown
51
+ [DOMAIN: Full-Stack] [PHASE: Plan] [ROLE: Architect]
52
+ Atomic Tasks:
53
+ 1. Database migration: referrals and referral_rewards tables + indexes. (Test: Migration rollback & apply)
54
+ 2. Domain service: ReferralService.createCode() and ReferralService.claimCode(). (Test: Unit tests)
55
+ 3. API route: POST /api/referrals/claim with Zod validation. (Test: Supertest integration)
56
+ 4. UI component: <ReferralCard /> with copy button. (Test: RTL component test)
57
+ ```
@@ -1,423 +1,38 @@
1
1
  ---
2
2
  name: engineering-workflow
3
3
  description: >
4
- Senior engineering workflow skill inspired by Addy Osmani's agent-skills. Enforces the full development lifecycle: spec → plan → build → test → review → ship. AI must never write code before a spec and plan are approved.
4
+ Scope implementation work, verify behavior, and report evidence using a proportional lifecycle.
5
5
  ---
6
6
  # engineering-workflow
7
7
 
8
8
  ## Overview
9
9
 
10
- Systematic 6-phase engineering pipeline (DEFINE → PLAN → BUILD → VERIFY → REVIEW → SHIP) enforcing role declarations, atomic task execution, quality gates, regression prevention, and structured requirements elicitation.
10
+ Define the outcome, plan substantial changes, implement, verify, review, and report. Existing user authorization carries forward.
11
11
 
12
12
  ## When to Use
13
13
 
14
- Activate on all project tasks to orchestrate structured development, spec definition, architectural planning, and verification gates.
14
+ Implementation, debugging, reviews, and release preparation. Routine maintenance and diagnostics can proceed directly with relevant checks.
15
15
 
16
16
  ## Rules & Patterns
17
17
 
18
- Inspired by [addyosmani/agent-skills](https://github.com/addyosmani/agent-skills) by Addy Osmani (Google Chrome) and [obra/superpowers](https://github.com/obra/superpowers).
18
+ Establish acceptance criteria for substantial or ambiguous features. Ask only for missing decisions that affect scope or safety. An explicit implementation request authorizes ordinary reversible work. Preserve unrelated changes. Verify behavior before reporting completion. Publishing and external messages need authorization for that action.
19
19
 
20
- ### Core Principle
21
-
22
- > **A junior writes code immediately. A senior writes a spec first.**
23
- > You are a senior. You never write code until the spec and plan are approved.
24
-
25
- ---
26
-
27
- ### The 6-Phase Development Pipeline
28
-
29
- ```
30
- DEFINE PLAN BUILD VERIFY REVIEW SHIP
31
- ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐
32
- │ Idea │ ───▶ │ Spec │ ───▶ │ Code │ ───▶ │ Test │ ───▶ │ QA │ ───▶ │ Go │
33
- │Refine│ │ PRD │ │ Impl │ │Debug │ │ Gate │ │ Live │
34
- └──────┘ └──────┘ └──────┘ └──────┘ └──────┘ └──────┘
35
- /spec /plan /build /test /review /ship
36
-
37
- [ROLE: Product Manager] [ROLE: Architect] [ROLE: Senior Dev] [ROLE: QA Lead] [ROLE: Staff Eng] [ROLE: Release Eng]
38
- ```
39
-
40
- **IRON RULE**: In interactive development, no phase can be skipped and no code is written before `/plan` is approved.
41
- **Direct Build & Fast-Track Exception**: When the prompt/caller explicitly requests a standalone implementation, declares `[PHASE: Build]`, or requests routine operational/maintenance tasks (git operations, version bumps, typo fixes, small config tweaks, diagnostic checks), proceed directly to execution without conversational approval pauses.
42
-
43
- ---
44
-
45
- ### Phase 1: DEFINE - /spec
46
-
47
- **Auto-activates → `[ROLE: Product Manager]`**
48
-
49
- Turn vague intent into a precise, executable specification.
50
-
51
- #### Step 1.1: The Interview Protocol (`interview-me`)
52
-
53
- Before writing the spec, if there is ambiguity, high blast radius, or multiple architectural paths, stop and ask the user **one question at a time** (or up to 2 tightly coupled questions):
54
-
55
- 1. **Clarify Business Intent**: What user problem are we solving? What is explicitly out of scope?
56
- 2. **Clarify Constraints**: Runtime versions, database engines, performance bounds.
57
- 3. **Clarify Edge Cases**: What happens on offline state, empty lists, unauthorized requests?
58
-
59
- #### Step 1.2: Spec Template
60
-
61
- ```markdown
62
- ## Feature Spec: [Feature Name]
63
-
64
- ### Why (Problem)
65
- [What pain does this solve? Who has it? How often?]
66
-
67
- ### Scope (What's In / Out)
68
-
69
- **In-Scope**:
70
- - [Specific item 1]
71
- - [Specific item 2]
72
-
73
- **Out-of-Scope**:
74
- - [Thing we're NOT doing and why]
75
-
76
- ### Technical Approach
77
- [Read the relevant code. Understand what changes where.]
78
- Files affected:
79
- - `src/X.js` - [what changes]
80
- - `src/Y.js` - [what changes]
81
-
82
- ### Acceptance Criteria
83
- - [ ] Given [context], when [action], then [result]
84
- - [ ] Given [context], when [action], then [result]
85
-
86
- ### Open Questions
87
- - [Unresolved decision 1]
88
- - [Unresolved decision 2]
89
- ```
90
-
91
- ---
92
-
93
- ### Phase 2: PLAN - /plan
94
-
95
- **Auto-activates → `[ROLE: Architect]`**
96
-
97
- Break the spec into atomic, independently testable tasks.
98
-
99
- #### Thin Vertical Slices (`incremental-implementation`)
100
-
101
- Organize tasks as **Thin Vertical Slices** rather than horizontal layers:
102
-
103
- - **Bad (Horizontal)**: Task 1: All DB migrations. Task 2: All API routes. Task 3: All UI components. (Nothing works until step 3).
104
- - **Good (Vertical Slices)**: Slice 1: Minimal DB table + minimal API + minimal UI button end-to-end. Verify and commit. Slice 2: Add validation + edge cases. Slice 3: Polish UI & telemetry.
105
-
106
- #### Plan Rules
107
-
108
- - Each task must be **completable in < 2 hours** of focused work.
109
- - Each task must be **independently testable**.
110
- - Tasks must be **ordered by dependency** (blocking tasks first).
111
- - Each task gets a **test requirement** - no task without a test.
112
-
113
- #### Plan Template
114
-
115
- ```markdown
116
- ## Implementation Plan: [Feature Name]
117
-
118
- ### Tasks
119
-
120
- **Task 1: [Slice 1 Name]** (est. 30min)
121
- - What: [Specific implementation detail]
122
- - Files: [file1.js, file2.js]
123
- - Test: [How will you verify this works?]
124
- - Blocked by: [nothing / Task N]
125
-
126
- **Task 2: [Slice 2 Name]** (est. 45min)
127
- - What: [Specific implementation detail]
128
- - Files: [file3.js]
129
- - Test: [Test description]
130
- - Blocked by: Task 1
131
-
132
- ### Risk Assessment
133
- - [Risk 1]: [Mitigation]
134
- - [Risk 2]: [Mitigation]
135
-
136
- ### STOP - Awaiting Approval
137
- Do not proceed to BUILD until this plan is approved.
138
- ```
139
-
140
- ---
141
-
142
- ### Phase 3: BUILD - /build
143
-
144
- **Auto-activates → `[ROLE: Senior Developer]`**
145
-
146
- Implement one task at a time. Commit after each task.
147
-
148
- #### Build Rules
149
-
150
- 1. **One task per commit** - atomic, descriptive commit messages.
151
- 2. **Write the test FIRST** (TDD - red-green-refactor).
152
- 3. **No dead code** - if it's not tested, it's not shipped.
153
- 4. **No TODOs in committed code** - resolve or create a tracked issue.
154
- 5. **Read before writing** - understand the surrounding code before changing it.
155
- 6. **Limit the blast radius** - modify ONLY the files explicitly listed in the current task's plan. Do NOT rewrite adjacent components, hooks, or utilities unless strictly required AND approved.
156
-
157
- #### Commit Message Format
158
-
159
- ```text
160
- type(scope): short description (max 72 chars)
161
-
162
- - Detail 1
163
- - Detail 2
164
-
165
- Refs: #issue-number
166
- ```
167
-
168
- Types: `feat`, `fix`, `refactor`, `test`, `docs`, `chore`
169
-
170
- ---
171
-
172
- ### Phase 4: VERIFY - /test
173
-
174
- **Auto-activates → `[ROLE: QA Lead]`**
175
-
176
- Tests are proof, not an afterthought.
177
-
178
- #### Test Strategy by Code Type
179
-
180
- **Logic & Services (TDD)**:
181
-
182
- ```text
183
- 1. RED: Write a failing test for the next small behavior
184
- 2. GREEN: Write the minimum code to make it pass
185
- 3. REFACTOR: Clean up without breaking tests
186
- 4. REPEAT
187
- ```
188
-
189
- **UI Components & User Flows (BDD)**:
190
-
191
- For complex React components, prioritize testing _user behavior_ over internal state:
192
-
193
- - Use **React Testing Library** (`userEvent`, `screen.getByRole`) - test what the user sees.
194
- - Use **Playwright** for critical user flows (login, checkout, form submit).
195
- - Do NOT test implementation details (internal state, private methods, component structure).
196
- - Focus on: "When user clicks X, does Y appear?" not "Does `useState` hold the right value?"
197
-
198
- ```tsx
199
- // [GOOD] BDD: Test behavior
200
- test("shows error when email is invalid", async () => {
201
- render(<LoginForm />);
202
- await userEvent.type(screen.getByLabelText("Email"), "not-an-email");
203
- await userEvent.click(screen.getByRole("button", { name: /sign in/i }));
204
- expect(screen.getByText(/invalid email/i)).toBeInTheDocument();
205
- });
206
- ```
207
-
208
- #### Test Quality Gates
209
-
210
- Before moving to Review, verify:
211
-
212
- - [ ] All new code has tests
213
- - [ ] Tests are meaningful (not just coverage theater)
214
- - [ ] Edge cases are covered (null, empty, overflow, unauthorized)
215
- - [ ] Tests fail when the implementation is broken (anti-regression)
216
- - [ ] Test names are readable: `it("returns 404 when user not found")`
217
-
218
- ---
219
-
220
- ### Phase 5: REVIEW - /review
221
-
222
- **Auto-activates → `[ROLE: Staff Engineer]` + `[ROLE: Senior Designer]` for UI tasks**
223
-
224
- Review before merging. Always.
225
-
226
- #### Subagent / Peer Code Review Protocol
227
-
228
- Inspired by [obra/superpowers](https://github.com/obra/superpowers):
229
-
230
- 1. **Self-Review First**: The implementer runs git diff and verifies against the original acceptance criteria.
231
- 2. **Review Checklist**:
232
- - **Correctness**: Does it do what the spec says? Are all criteria met?
233
- - **Architecture**: Single Responsibility, DRY without premature abstraction, no business logic in API routes.
234
- - **Security**: No secrets hardcoded, inputs validated via Zod/schemas, auth checked before data access.
235
- - **Performance**: No N+1 queries, expensive operations cached, sets paginated.
236
- - **Design**: If UI, passes `impeccable-design` quick audit (typography, colors, spacing, animations).
237
-
238
- ---
239
-
240
- ### Phase 5.5: SIMPLIFY - /simplify
241
-
242
- **Auto-activates → `[ROLE: Staff Engineer]` (Ponytail Mindset)**
243
-
244
- Before merging, ruthlessly simplify:
245
-
246
- 1. Did we introduce abstractions that are only used once? (Inline them).
247
- 2. Can 3 lines of standard JavaScript replace a 50-line custom utility?
248
- 3. Is any configuration or generic handler premature? (YAGNI).
249
- 4. Is the code obvious to a mid-level engineer without reading a documentation manual?
250
-
251
- ---
252
-
253
- ### Phase 6: SHIP - /ship
254
-
255
- **Auto-activates → `[ROLE: Release Engineer]`**
256
-
257
- Only ship when all gates are green.
258
-
259
- #### Pre-Ship Checklist
260
-
261
- - [ ] All tests pass in CI
262
- - [ ] No lint errors
263
- - [ ] Feature works in staging environment
264
- - [ ] Docs updated (README, API docs, changelogs)
265
- - [ ] Breaking changes documented
266
- - [ ] Rollback plan exists
267
- - [ ] Preview / staging deployment verified (if applicable, e.g. Vercel Preview and Core Web Vitals for frontend deployments)
268
-
269
- #### Operational Self-Improvement
270
-
271
- Before completing a workflow, review the session for durable learnings. Write them to `.agents/learnings.md`. If no durable learning occurred, state "No durable learnings this session" in your final output.
272
-
273
- ---
20
+ Read [references/workflow.md](references/workflow.md) for detailed procedures and examples only when needed.
274
21
 
275
22
  ## Code Examples
276
23
 
277
- ### Vertical Slice Example
278
-
279
- ```javascript
280
- // Slice 1: Minimal functional endpoint
281
- // POST /api/v1/projects -> creates project with basic validation
282
- import { z } from 'zod';
283
- import { projectService } from '@/services/project';
284
-
285
- const CreateProjectSchema = z.object({
286
- name: z.string().min(1).max(100),
287
- description: z.string().optional()
288
- });
289
-
290
- export async function POST(req) {
291
- const session = await auth();
292
- if (!session?.userId) return Response.json({ error: 'Unauthorized' }, { status: 401 });
293
-
294
- const body = await req.json();
295
- const parsed = CreateProjectSchema.parse(body);
296
- const project = await projectService.create({ ...parsed, userId: session.userId });
297
-
298
- return Response.json(project, { status: 201 });
299
- }
300
- ```
301
-
302
- ---
24
+ A README typo needs an edit and relevant formatting check. An authentication feature needs access boundaries, failure cases, implementation, and behavioral verification.
303
25
 
304
26
  ## Validation Checklist
305
27
 
306
- - [ ] Specification exists with clear In-Scope and Out-of-Scope boundaries.
307
- - [ ] Implementation plan broken down into vertical tasks < 2 hours each.
308
- - [ ] Tests written before implementation (TDD/BDD).
309
- - [ ] Code reviewed against correctness, security, performance, and design gates.
310
- - [ ] Staged security and quality check passes (`contextos scan --staged --enforce`).
311
- - [ ] Simplification ladder executed before shipping.
312
-
313
- ---
28
+ - [ ] The requested outcome is handled.
29
+ - [ ] Relevant verification and safety boundaries are preserved.
30
+ - [ ] Limitations are stated.
314
31
 
315
32
  ## Common Mistakes
316
33
 
317
- - **Writing code before approval**: Skipping `/spec` or `/plan` in interactive sessions.
318
- - **Horizontal task splitting**: Building all DB models first without verifying end-to-end integration.
319
- - **Premature refactoring**: Changing unrelated adjacent code during a feature task.
320
- - **Ignoring non-happy paths**: Testing only 200 OK responses while ignoring 400, 401, 404, 500 scenarios.
321
-
322
- ---
34
+ Repeated approval after authorization; unnecessary ceremonies for routine edits; treating role labels or string checks as behavioral proof.
323
35
 
324
36
  ## Integration Notes
325
37
 
326
- - Integrates with `gstack-roles` for automated role switching across all 6 phases.
327
- - Triggers `ponytail-mindset` during the BUILD and SIMPLIFY phases.
328
- - Hands off to `impeccable-design` for UI quality review.
329
- - Coordinates with `security` during Phase 5 for pre-merge compliance.
330
-
331
- ---
332
-
333
- ## Completion Status Protocol
334
-
335
- When completing a task or workflow, you must explicitly report your final status as the last part of your output:
336
-
337
- - **DONE** - completed with evidence.
338
- - **DONE_WITH_CONCERNS** - completed, but list concerns.
339
- - **BLOCKED** - cannot proceed; state blocker and what was tried.
340
- - **NEEDS_CONTEXT** - missing info; state exactly what is needed.
341
-
342
-
343
- <!-- Source: EXAMPLES.md -->
344
-
345
- # engineering-workflow Examples — Anti-patterns vs ContextOS Standard
346
-
347
- ## Example 1: Handling a New Feature Request
348
-
349
- ### Anti-pattern: Jumping Straight to Code
350
-
351
- ```text
352
- User: "Add a user referral system."
353
- Agent: Immediately creates src/referral.js, starts writing database queries, guesses schema,
354
- and misses requirements like rate limiting, expiry dates, and fraud prevention.
355
- ```
356
-
357
- ### Best practice: ContextOS Standard (DEFINE -> PLAN -> BUILD)
358
-
359
- ```markdown
360
- [DOMAIN: Full-Stack] [PHASE: Define] [ROLE: Product Manager]
361
- Skills loaded: engineering-workflow, interview-me
362
-
363
- ## Feature Spec: User Referral System
364
- ### Why (Problem)
365
- Increase user acquisition through organic word-of-mouth incentives.
366
-
367
- ### Scope
368
- In-Scope:
369
- - Unique referral code generation per registered user
370
- - Referral code attribution on signup
371
- - Credit reward trigger after first completed purchase
372
- Out-of-Scope:
373
- - Multi-tier MLM rewards
374
- - Cash payout integrations
375
-
376
- ### Acceptance Criteria
377
- - [ ] Given a registered user, when visiting /referrals, then unique code is displayed.
378
- - [ ] Given a new user with code, when signing up, then referrer_id is stored with status 'pending'.
379
- ```
380
-
381
- ---
382
-
383
- ## Example 2: Atomic Task Execution in PLAN Phase
384
-
385
- ### Anti-pattern: Monolithic Mega-Task
386
-
387
- ```text
388
- Task: "Implement entire referral system end-to-end in one shot."
389
- Result: 15 files modified simultaneously, uncompilable intermediate state, untestable diff.
390
- ```
391
-
392
- ### Best practice: ContextOS Standard (Atomic Tasks with Test Gate)
393
-
394
- ```markdown
395
- [DOMAIN: Full-Stack] [PHASE: Plan] [ROLE: Architect]
396
- Atomic Tasks:
397
- 1. Database migration: referrals and referral_rewards tables + indexes. (Test: Migration rollback & apply)
398
- 2. Domain service: ReferralService.createCode() and ReferralService.claimCode(). (Test: Unit tests)
399
- 3. API route: POST /api/referrals/claim with Zod validation. (Test: Supertest integration)
400
- 4. UI component: <ReferralCard /> with copy button. (Test: RTL component test)
401
- ```
402
-
403
- <!-- Source: TROUBLESHOOTING.md -->
404
-
405
- # engineering-workflow Troubleshooting & Common Mistakes
406
-
407
- ## 1. Premature Code Generation
408
-
409
- - **Symptom**: Agent starts spitting out code blocks while the user is still clarifying requirements.
410
- - **Root Cause**: Failure to enforce the IRON RULE of Phase 1 (DEFINE) and Phase 2 (PLAN).
411
- - **Fix**: Halt code output immediately. Announce `[PHASE: Define]` or `[PHASE: Plan]` and provide the structured spec or task breakdown for user sign-off.
412
-
413
- ## 2. Blast Radius Creep
414
-
415
- - **Symptom**: A simple bugfix in one module modifies 8 unrelated configuration and styling files.
416
- - **Root Cause**: Missing isolation boundaries and speculative cleanup.
417
- - **Fix**: Restrict edits strictly to files explicitly declared in the current atomic task's plan.
418
-
419
- ## 3. Unverified Claims of Completion
420
-
421
- - **Symptom**: Agent reports "Task complete! Everything is working" without running tests or builds.
422
- - **Root Cause**: Skipping Phase 4 (VERIFY).
423
- - **Fix**: Always execute tests (`npm test`, validator, compiler) and quote actual terminal exit codes and outputs before declaring completion.
38
+ Load relevant domain skills and supporting resources on demand. Compatibility identifiers remain available.
@@ -0,0 +1,19 @@
1
+ # engineering-workflow Troubleshooting & Common Mistakes
2
+
3
+ ## 1. Premature Code Generation
4
+
5
+ - **Symptom**: Agent starts spitting out code blocks while the user is still clarifying requirements.
6
+ - **Root Cause**: Failure to enforce the IRON RULE of Phase 1 (DEFINE) and Phase 2 (PLAN).
7
+ - **Fix**: Halt code output immediately. Announce `[PHASE: Define]` or `[PHASE: Plan]` and provide the structured spec or task breakdown for user sign-off.
8
+
9
+ ## 2. Blast Radius Creep
10
+
11
+ - **Symptom**: A simple bugfix in one module modifies 8 unrelated configuration and styling files.
12
+ - **Root Cause**: Missing isolation boundaries and speculative cleanup.
13
+ - **Fix**: Restrict edits strictly to files explicitly declared in the current atomic task's plan.
14
+
15
+ ## 3. Unverified Claims of Completion
16
+
17
+ - **Symptom**: Agent reports "Task complete! Everything is working" without running tests or builds.
18
+ - **Root Cause**: Skipping Phase 4 (VERIFY).
19
+ - **Fix**: Always execute tests (`npm test`, validator, compiler) and quote actual terminal exit codes and outputs before declaring completion.
@@ -0,0 +1,12 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "rules_followed": {
6
+ "type": "boolean"
7
+ }
8
+ },
9
+ "required": [
10
+ "rules_followed"
11
+ ]
12
+ }