codex-workflows 0.3.1 → 0.4.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 (28) hide show
  1. package/.agents/skills/documentation-criteria/SKILL.md +25 -2
  2. package/.agents/skills/documentation-criteria/references/design-template.md +38 -0
  3. package/.agents/skills/documentation-criteria/references/plan-template.md +67 -10
  4. package/.agents/skills/documentation-criteria/references/task-template.md +8 -1
  5. package/.agents/skills/integration-e2e-testing/SKILL.md +4 -1
  6. package/.agents/skills/recipe-build/SKILL.md +1 -1
  7. package/.agents/skills/recipe-design/SKILL.md +22 -14
  8. package/.agents/skills/recipe-front-build/SKILL.md +1 -1
  9. package/.agents/skills/recipe-front-design/SKILL.md +7 -2
  10. package/.agents/skills/recipe-fullstack-build/SKILL.md +1 -1
  11. package/.agents/skills/recipe-fullstack-implement/SKILL.md +2 -0
  12. package/.agents/skills/recipe-implement/SKILL.md +2 -0
  13. package/.agents/skills/recipe-reverse-engineer/SKILL.md +2 -2
  14. package/.agents/skills/recipe-update-doc/SKILL.md +16 -5
  15. package/.agents/skills/subagents-orchestration-guide/SKILL.md +64 -41
  16. package/.agents/skills/subagents-orchestration-guide/references/monorepo-flow.md +45 -21
  17. package/.agents/skills/testing/SKILL.md +31 -0
  18. package/.codex/agents/acceptance-test-generator.toml +9 -2
  19. package/.codex/agents/code-verifier.toml +11 -4
  20. package/.codex/agents/codebase-analyzer.toml +193 -0
  21. package/.codex/agents/document-reviewer.toml +9 -0
  22. package/.codex/agents/integration-test-reviewer.toml +8 -7
  23. package/.codex/agents/task-decomposer.toml +16 -0
  24. package/.codex/agents/technical-designer-frontend.toml +28 -0
  25. package/.codex/agents/technical-designer.toml +21 -0
  26. package/.codex/agents/work-planner.toml +18 -4
  27. package/README.md +11 -5
  28. package/package.json +1 -1
@@ -7,9 +7,7 @@ description: "Guides subagent coordination through implementation workflows. Use
7
7
 
8
8
  ## Role: The Orchestrator
9
9
 
10
- **The orchestrator coordinates subagents like a conductor -- directing the musicians without playing the instruments.**
11
-
12
- All investigation, analysis, and implementation work flows through specialized subagents.
10
+ The orchestrator coordinates subagents. All investigation, analysis, and implementation work flows through specialized subagents.
13
11
 
14
12
  ### Prompt Construction Rule
15
13
  Every subagent prompt must include:
@@ -65,13 +63,15 @@ The following subagents are available:
65
63
 
66
64
  ### Document Creation Agents
67
65
  6. **requirement-analyzer**: Requirement analysis and work scale determination
68
- 7. **prd-creator**: Product Requirements Document creation
69
- 8. **ui-spec-designer**: UI Specification creation from PRD and optional prototype code (frontend/fullstack features)
70
- 9. **technical-designer**: ADR/Design Doc creation
71
- 10. **work-planner**: Work plan creation from Design Doc and test skeletons
72
- 11. **document-reviewer**: Single document quality and rule compliance check
73
- 12. **design-sync**: Design Doc consistency verification across multiple documents
74
- 13. **acceptance-test-generator**: Generate integration and E2E test skeletons from Design Doc ACs
66
+ 7. **codebase-analyzer**: Existing codebase analysis before Design Doc creation
67
+ 8. **prd-creator**: Product Requirements Document creation
68
+ 9. **ui-spec-designer**: UI Specification creation from PRD and optional prototype code (frontend/fullstack features)
69
+ 10. **technical-designer**: ADR/Design Doc creation
70
+ 11. **work-planner**: Work plan creation from Design Doc and test skeletons
71
+ 12. **document-reviewer**: Single document quality and rule compliance check
72
+ 13. **code-verifier**: Document-code consistency verification for review inputs
73
+ 14. **design-sync**: Design Doc consistency verification across multiple documents
74
+ 15. **acceptance-test-generator**: Generate integration and E2E test skeletons from Design Doc ACs
75
75
 
76
76
  ## Orchestration Principles
77
77
 
@@ -105,6 +105,9 @@ Spawn agents using natural language prompts. Provide clear context about what th
105
105
  **requirement-analyzer**:
106
106
  > "Analyze the following requirements and determine the work scale: [user requirements]. Perform requirement analysis and scale determination."
107
107
 
108
+ **codebase-analyzer**:
109
+ > "Analyze the existing codebase to provide evidence for Design Doc creation. Focus on existing implementations, data model elements, and constraints the design should respect. requirement_analysis: [JSON]. prd_path: [path if available]. requirements: [original user requirements]. layer: [target layer if applicable]. target_paths: [paths if narrowed]. Return codebase facts and focus areas."
110
+
108
111
  **task-executor**:
109
112
  > "Execute the implementation task defined in docs/plans/tasks/[filename].md. Complete the implementation following TDD Red-Green-Refactor."
110
113
 
@@ -175,9 +178,11 @@ All agents MUST use this vocabulary consistently:
175
178
 
176
179
  Subagents respond in JSON format. The final response from each JSON-returning subagent must be the JSON payload itself, with no trailing prose. Key fields for orchestrator decisions:
177
180
  - **requirement-analyzer**: scale, confidence, affectedLayers, adrRequired, scopeDependencies, questions
181
+ - **codebase-analyzer**: analysisScope, existingElements, dataModel, focusAreas, limitations
178
182
  - **task-executor**: status (escalation_needed/completed), escalation_type (design_compliance_violation/similar_function_found/similar_component_found/investigation_target_not_found/out_of_scope_file/test_environment_not_ready), testsAdded, requiresTestReview
179
183
  - **quality-fixer**: status (approved/blocked). For blocked responses, discriminate by `reason`: specification conflicts use `blockingIssues[]`; execution prerequisites use `missingPrerequisites[]`, and each item provides its own `resolutionSteps`
180
184
  - **document-reviewer**: verdict.decision (approved/approved_with_conditions/needs_revision/rejected)
185
+ - **code-verifier**: summary, discrepancies, reverseCoverage
181
186
  - **design-sync**: sync_status (CONFLICTS_FOUND/NO_CONFLICTS) — text format with [SUMMARY] block
182
187
  - **integration-test-reviewer**: status (approved/needs_revision/blocked), requiredFixes
183
188
  - **security-reviewer**: status (approved/approved_with_notes/needs_revision/blocked), findings, notes, requiredFixes
@@ -212,7 +217,7 @@ Document generation agents (work-planner, technical-designer, prd-creator) can u
212
217
 
213
218
  When receiving new features or change requests, start with requirement-analyzer.
214
219
 
215
- ### Large Scale (6+ Files) - 11 Steps (backend) / 13 Steps (frontend/fullstack)
220
+ ### Large Scale (6+ Files) - 13 Steps (backend) / 15 Steps (frontend/fullstack)
216
221
 
217
222
  1. requirement-analyzer: Requirement analysis + Check existing PRD **[Stop]**
218
223
  2. prd-creator: PRD creation
@@ -221,24 +226,35 @@ When receiving new features or change requests, start with requirement-analyzer.
221
226
  5. **(frontend/fullstack only)** document-reviewer: UI Spec review **[Stop: UI Spec Approval]**
222
227
  6. technical-designer: ADR creation (if architecture/technology/data flow changes)
223
228
  7. document-reviewer: ADR review (if ADR created) **[Stop: ADR Approval]**
224
- 8. technical-designer: Design Doc creation
225
- 9. document-reviewer: Design Doc review
226
- 10. design-sync: Consistency verification **[Stop: Design Doc Approval]**
227
- 11. acceptance-test-generator: Test skeleton generation, pass to work-planner
228
- 12. work-planner: Work plan creation **[Stop: Batch approval]**
229
- 13. task-decomposer: Autonomous execution to Completion report
229
+ 8. codebase-analyzer: Codebase analysis (pass requirement-analyzer output and PRD path when available)
230
+ 9. technical-designer: Design Doc creation
231
+ 10. code-verifier: Design Doc verification against code
232
+ 11. document-reviewer: Design Doc review with code verification evidence
233
+ 12. design-sync: Consistency verification **[Stop: Design Doc Approval]**
234
+ 13. acceptance-test-generator: Test skeleton generation, pass to work-planner
235
+ 14. work-planner: Work plan creation **[Stop: Batch approval]**
236
+ 15. task-decomposer: Autonomous execution to Completion report
230
237
 
231
- ### Medium Scale (3-5 Files) - 7 Steps (backend) / 9 Steps (frontend/fullstack)
238
+ ### Medium Scale (3-5 Files) - 9 Steps (backend) / 11 Steps (frontend/fullstack)
232
239
 
233
240
  1. requirement-analyzer: Requirement analysis **[Stop]**
234
- 2. **(frontend/fullstack only)** Ask user for prototype code; ui-spec-designer: UI Spec creation
235
- 3. **(frontend/fullstack only)** document-reviewer: UI Spec review **[Stop: UI Spec Approval]**
236
- 4. technical-designer: Design Doc creation
237
- 5. document-reviewer: Design Doc review
238
- 6. design-sync: Consistency verification **[Stop: Design Doc Approval]**
239
- 7. acceptance-test-generator: Test skeleton generation, pass to work-planner
240
- 8. work-planner: Work plan creation **[Stop: Batch approval]**
241
- 9. task-decomposer: Autonomous execution to Completion report
241
+ 2. codebase-analyzer: Codebase analysis
242
+ 3. **(frontend/fullstack only)** Ask user for prototype code; ui-spec-designer: UI Spec creation
243
+ 4. **(frontend/fullstack only)** document-reviewer: UI Spec review **[Stop: UI Spec Approval]**
244
+ 5. technical-designer: Design Doc creation
245
+ 6. code-verifier: Design Doc verification against code
246
+ 7. document-reviewer: Design Doc review with code verification evidence
247
+ 8. design-sync: Consistency verification **[Stop: Design Doc Approval]**
248
+ 9. acceptance-test-generator: Test skeleton generation, pass to work-planner
249
+ 10. work-planner: Work plan creation **[Stop: Batch approval]**
250
+ 11. task-decomposer: Autonomous execution to Completion report
251
+
252
+ ### Design Flow Data Passing
253
+
254
+ - Pass requirement-analyzer output and original requirements to codebase-analyzer
255
+ - Pass codebase-analyzer JSON to technical-designer or technical-designer-frontend as `Codebase Analysis`
256
+ - Pass Design Doc path to code-verifier
257
+ - Pass code-verifier JSON to document-reviewer as `code_verification`
242
258
 
243
259
  ### Small Scale (1-2 Files) - 2 Steps
244
260
 
@@ -299,18 +315,11 @@ Stop autonomous execution and escalate to user in the following cases:
299
315
  3. **Work-planner update restriction violated**: Requirement changes after task-decomposer starts require overall redesign
300
316
  4. **User explicitly stops**: Direct stop instruction or interruption
301
317
 
302
- ### Task Management: 4-Step Cycle
303
-
304
- **Per-task cycle**:
305
- 1. task-executor: Implementation
306
- 2. Check task-executor response:
307
- - `escalation_needed` or `blocked`: Escalate to user
308
- - `requiresTestReview` is `true`: Execute integration-test-reviewer
309
- - `needs_revision`: Return to step 1 with requiredFixes
310
- - `approved`: Proceed to step 3
311
- - Otherwise: Proceed to step 3
312
- 3. quality-fixer: Quality check and fixes
313
- 4. git commit (on `status: "approved"`)
318
+ Use the task loop defined in the autonomous execution diagram above. The canonical per-task cycle is:
319
+ 1. task-executor implementation
320
+ 2. escalation or integration-test-reviewer decision
321
+ 3. quality-fixer quality gate
322
+ 4. git commit on approval
314
323
 
315
324
  ## Main Orchestrator Roles
316
325
 
@@ -341,13 +350,27 @@ Stop autonomous execution and escalate to user in the following cases:
341
350
 
342
351
  **On error**: Escalate to user if files are not generated
343
352
 
353
+ ### Design Doc to Work Plan Verification Handoff
354
+
355
+ When a Design Doc contains a Verification Strategy section, the orchestrator must carry forward:
356
+ - Design Doc path
357
+ - Verification Strategy details:
358
+ - Correctness definition
359
+ - Target comparison
360
+ - Verification method
361
+ - Observable success indicator
362
+ - Verification timing
363
+ - Early verification point (first target, success criteria, failure response)
364
+
365
+ The resulting work plan must include this summary in its header so the plan remains self-sufficient for downstream task generation and execution planning.
366
+
344
367
  ## Important Constraints [MANDATORY]
345
368
 
346
369
  - **Quality check is REQUIRED**: quality-fixer approval MUST be obtained before commit
347
370
  - **Structured response REQUIRED**: Information transmission between subagents MUST use JSON format
348
371
  - **Approval management**: Document creation -> Execute document-reviewer -> Get user approval before proceeding
349
372
  - **Flow confirmation**: After getting approval, MUST check next step with work planning flow (large/medium/small scale)
350
- - **Consistency verification**: If subagent determinations contradict, MUST prioritize guidelines
373
+ - **Consistency verification**: If subagent determinations contradict, MUST prioritize the constraints and decision rules defined in this orchestration guide
351
374
 
352
375
  **ENFORCEMENT**: Violating ANY constraint requires immediate correction
353
376
 
@@ -362,9 +385,9 @@ Stop autonomous execution and escalate to user in the following cases:
362
385
 
363
386
  When receiving a task, check the following:
364
387
 
365
- - [ ] Confirmed if there is an orchestrator instruction
388
+ - [ ] Confirmed whether the user provided a specific workflow recipe or explicit execution constraint
366
389
  - [ ] Determined task type (new feature/fix/research, etc.)
367
- - [ ] Considered appropriate subagent utilization
390
+ - [ ] Selected the next subagent according to the decision flow and current phase
368
391
  - [ ] Decided next action according to decision flow
369
392
  - [ ] Monitored requirement changes and errors during autonomous execution mode
370
393
 
@@ -10,7 +10,7 @@ This reference defines the orchestration flow for projects spanning multiple lay
10
10
 
11
11
  ## Design Phase
12
12
 
13
- ### Large Scale Fullstack (6+ Files) - 12 Steps
13
+ ### Large Scale Fullstack (6+ Files) - 14 Steps
14
14
 
15
15
  | Step | Agent | Purpose | Output |
16
16
  |------|-------|---------|--------|
@@ -20,27 +20,35 @@ This reference defines the orchestration flow for projects spanning multiple lay
20
20
  | 4 | (orchestrator) | Ask user for prototype code **[Stop]** | Prototype path or none |
21
21
  | 5 | ui-spec-designer | UI Spec from PRD + optional prototype | UI Spec |
22
22
  | 6 | document-reviewer | UI Spec review **[Stop]** | Approval |
23
- | 7 | technical-designer | **Backend** Design Doc | Backend Design Doc |
24
- | 8 | technical-designer-frontend | **Frontend** Design Doc (references backend Integration Points + UI Spec) | Frontend Design Doc |
25
- | 9 | document-reviewer x2 | Review each Design Doc (one invocation per doc) | Reviews |
26
- | 10 | design-sync | Cross-layer consistency verification (source: frontend Design Doc) **[Stop]** | Sync status |
27
- | 11 | acceptance-test-generator | Integration/E2E test skeleton from cross-layer contracts | Test skeletons |
28
- | 12 | work-planner | Work plan from all Design Docs **[Stop: Batch approval]** | Work plan |
23
+ | 7 | codebase-analyzer x2 | Per-layer codebase analysis before Design Doc creation | Analysis JSON |
24
+ | 8 | technical-designer | **Backend** Design Doc | Backend Design Doc |
25
+ | 9 | technical-designer-frontend | **Frontend** Design Doc (references backend Integration Points + UI Spec) | Frontend Design Doc |
26
+ | 10 | code-verifier x2 | Verify each Design Doc against code | Verification JSON |
27
+ | 11 | document-reviewer x2 | Review each Design Doc with verification evidence | Reviews |
28
+ | 12 | design-sync | Cross-layer consistency verification (source: frontend Design Doc) **[Stop]** | Sync status |
29
+ | 13 | acceptance-test-generator | Integration/E2E test skeleton from cross-layer contracts | Test skeletons |
30
+ | 14 | work-planner | Work plan from all Design Docs **[Stop: Batch approval]** | Work plan |
29
31
 
30
- ### Medium Scale Fullstack (3-5 Files) - 10 Steps
32
+ ### Medium Scale Fullstack (3-5 Files) - 12 Steps
31
33
 
32
34
  | Step | Agent | Purpose | Output |
33
35
  |------|-------|---------|--------|
34
36
  | 1 | requirement-analyzer | Requirement analysis + scale determination **[Stop]** | Requirements + scale |
35
- | 2 | (orchestrator) | Ask user for prototype code **[Stop]** | Prototype path or none |
36
- | 3 | ui-spec-designer | UI Spec from requirements + optional prototype | UI Spec |
37
- | 4 | document-reviewer | UI Spec review **[Stop]** | Approval |
38
- | 5 | technical-designer | **Backend** Design Doc | Backend Design Doc |
39
- | 6 | technical-designer-frontend | **Frontend** Design Doc (references backend Integration Points + UI Spec) | Frontend Design Doc |
40
- | 7 | document-reviewer x2 | Review each Design Doc (one invocation per doc) | Reviews |
41
- | 8 | design-sync | Cross-layer consistency verification (source: frontend Design Doc) **[Stop]** | Sync status |
42
- | 9 | acceptance-test-generator | Integration/E2E test skeleton from cross-layer contracts | Test skeletons |
43
- | 10 | work-planner | Work plan from all Design Docs **[Stop: Batch approval]** | Work plan |
37
+ | 2 | codebase-analyzer x2 | Per-layer codebase analysis before Design Doc creation | Analysis JSON |
38
+ | 3 | (orchestrator) | Ask user for prototype code **[Stop]** | Prototype path or none |
39
+ | 4 | ui-spec-designer | UI Spec from requirements + optional prototype | UI Spec |
40
+ | 5 | document-reviewer | UI Spec review **[Stop]** | Approval |
41
+ | 6 | technical-designer | **Backend** Design Doc | Backend Design Doc |
42
+ | 7 | technical-designer-frontend | **Frontend** Design Doc (references backend Integration Points + UI Spec) | Frontend Design Doc |
43
+ | 8 | code-verifier x2 | Verify each Design Doc against code | Verification JSON |
44
+ | 9 | document-reviewer x2 | Review each Design Doc with verification evidence | Reviews |
45
+ | 10 | design-sync | Cross-layer consistency verification (source: frontend Design Doc) **[Stop]** | Sync status |
46
+ | 11 | acceptance-test-generator | Integration/E2E test skeleton from cross-layer contracts | Test skeletons |
47
+ | 12 | work-planner | Work plan from all Design Docs **[Stop: Batch approval]** | Work plan |
48
+
49
+ ### Parallelization in Multi-Agent Steps
50
+
51
+ Steps marked `x2` run independently per layer and can execute in parallel when supported.
44
52
 
45
53
  ### Layer Context in Design Doc Creation
46
54
 
@@ -48,19 +56,35 @@ When spawning Design Doc creation for each layer, pass explicit context:
48
56
 
49
57
  **Large Scale (PRD available) -- Backend Design Doc**:
50
58
  **Agent**: Spawn technical-designer
51
- > "Create a backend Design Doc from PRD at [path]. Focus on: API contracts, data layer, business logic, service architecture."
59
+ > "Create a backend Design Doc from PRD at [path]. Codebase analysis: [backend analysis JSON]. Focus on: API contracts, data layer, business logic, service architecture."
60
+
61
+ **Large Scale (PRD available) -- Backend Codebase Analysis**:
62
+ **Agent**: Spawn codebase-analyzer
63
+ > "Analyze the existing codebase to provide evidence for backend Design Doc creation. requirement_analysis: [requirement-analyzer output filtered to backend files]. prd_path: [path]. requirements: [original user requirements]. layer: backend. target_paths: [backend file and directory scope]. focus_areas: API contracts, data layer, business logic, service architecture."
52
64
 
53
65
  **Large Scale (PRD available) -- Frontend Design Doc**:
54
66
  **Agent**: Spawn technical-designer-frontend
55
- > "Create a frontend Design Doc from PRD at [path]. Reference backend Design Doc at [path] for API contracts and Integration Points. Reference UI Spec at [path] for component structure and state design. Focus on: component hierarchy, state management, UI interactions, data fetching."
67
+ > "Create a frontend Design Doc from PRD at [path]. Codebase analysis: [frontend analysis JSON]. Reference backend Design Doc at [path] for API contracts and Integration Points. Reference UI Spec at [path] for component structure and state design. Focus on: component hierarchy, state management, UI interactions, data fetching."
68
+
69
+ **Large Scale (PRD available) -- Frontend Codebase Analysis**:
70
+ **Agent**: Spawn codebase-analyzer
71
+ > "Analyze the existing codebase to provide evidence for frontend Design Doc creation. requirement_analysis: [requirement-analyzer output filtered to frontend files]. prd_path: [path]. requirements: [original user requirements]. layer: frontend. target_paths: [frontend file and directory scope]. focus_areas: component hierarchy, state management, UI interactions, data fetching."
56
72
 
57
73
  **Medium Scale (no PRD) -- Backend Design Doc**:
58
74
  **Agent**: Spawn technical-designer
59
- > "Create a backend Design Doc based on the following requirements: [requirement-analyzer output]. Focus on: API contracts, data layer, business logic, service architecture."
75
+ > "Create a backend Design Doc based on the following requirements: [requirement-analyzer output]. Codebase analysis: [backend analysis JSON]. Focus on: API contracts, data layer, business logic, service architecture."
76
+
77
+ **Medium Scale (no PRD) -- Backend Codebase Analysis**:
78
+ **Agent**: Spawn codebase-analyzer
79
+ > "Analyze the existing codebase to provide evidence for backend Design Doc creation. requirement_analysis: [requirement-analyzer output filtered to backend files]. requirements: [original user requirements]. layer: backend. target_paths: [backend file and directory scope]. focus_areas: API contracts, data layer, business logic, service architecture."
60
80
 
61
81
  **Medium Scale (no PRD) -- Frontend Design Doc**:
62
82
  **Agent**: Spawn technical-designer-frontend
63
- > "Create a frontend Design Doc based on the following requirements: [requirement-analyzer output]. Reference backend Design Doc at [path] for API contracts and Integration Points. Reference UI Spec at [path] for component structure and state design. Focus on: component hierarchy, state management, UI interactions, data fetching."
83
+ > "Create a frontend Design Doc based on the following requirements: [requirement-analyzer output]. Codebase analysis: [frontend analysis JSON]. Reference backend Design Doc at [path] for API contracts and Integration Points. Reference UI Spec at [path] for component structure and state design. Focus on: component hierarchy, state management, UI interactions, data fetching."
84
+
85
+ **Medium Scale (no PRD) -- Frontend Codebase Analysis**:
86
+ **Agent**: Spawn codebase-analyzer
87
+ > "Analyze the existing codebase to provide evidence for frontend Design Doc creation. requirement_analysis: [requirement-analyzer output filtered to frontend files]. requirements: [original user requirements]. layer: frontend. target_paths: [frontend file and directory scope]. focus_areas: component hierarchy, state management, UI interactions, data fetching."
64
88
 
65
89
  ### design-sync for Cross-Layer Verification
66
90
 
@@ -189,6 +189,37 @@ Test names should clearly describe:
189
189
  - **Fake**: Simplified working implementation
190
190
  - **Dummy**: Passed but never used
191
191
 
192
+ ## Data Layer Testing
193
+
194
+ ### Mock Limitations for Data Access
195
+
196
+ Mocks validate call patterns but do not validate schema correctness, query correctness, or storage constraints.
197
+ Examples of issues that mocks can miss:
198
+ - schema drift
199
+ - column or field mismatches
200
+ - incorrect joins, filters, or aggregations
201
+ - migration incompatibility
202
+
203
+ ### When Real Data Layer Verification Adds Value
204
+
205
+ Use real or production-like data access verification when testing:
206
+ - repository or DAO implementations
207
+ - ORM mappings
208
+ - query builders or raw SQL
209
+ - persistence behavior that depends on constraints or schema shape
210
+
211
+ ### Environment Options
212
+
213
+ Choose the most practical option for the project environment:
214
+ - containerized database
215
+ - dedicated test database
216
+ - in-memory database with documented limitations
217
+ - adapter-backed local test harness
218
+
219
+ ### Design Alignment
220
+
221
+ When a Design Doc includes `Test Boundaries`, follow it as the baseline for deciding which dependencies stay real and which boundaries are isolated.
222
+
192
223
  ## Test Quality Practices [MANDATORY]
193
224
 
194
225
  ### Keep Tests Active
@@ -40,7 +40,7 @@ Skill Status:
40
40
 
41
41
  ## Required Information
42
42
 
43
- - **Design Doc**: Required. Source of acceptance criteria for test skeleton generation.
43
+ - **Design Doc**: Required. Source of acceptance criteria for test skeleton generation. When the Design Doc includes a `Test Boundaries` section, use it to decide which dependencies should stay real in integration coverage and which can be isolated.
44
44
  - **UI Spec**: Optional. When provided, use screen transitions, state x display matrix, and interaction definitions as additional E2E test candidate sources. See `references/e2e-design.md` in integration-e2e-testing skill for mapping methodology.
45
45
 
46
46
  ## Core Principle: Maximum Coverage, Minimum Tests
@@ -96,7 +96,11 @@ Key points:
96
96
 
97
97
  **Principle**: AC = User-observable behavior verifiable in isolated CI environment
98
98
 
99
- **Output**: Filtered AC list
99
+ When `Test Boundaries` exists:
100
+ - Read mock boundary decisions and reflect them in generated skeleton metadata
101
+ - Mark dependencies that should stay real in integration coverage with a project-appropriate annotation such as `@real-dependency: [component]`
102
+
103
+ **Output**: Filtered AC list with boundary annotations when available
100
104
 
101
105
  ### Phase 2: Candidate Enumeration (Two-Pass #1)
102
106
 
@@ -161,6 +165,8 @@ ROI calculation formula and cost table are defined in **integration-e2e-testing
161
165
 
162
166
  ### Integration Test File
163
167
 
168
+ Adapt comment syntax to the project's language when generating annotations.
169
+
164
170
  ```
165
171
  // [Feature Name] Integration Test - Design Doc: [filename]
166
172
  // Generated: [date] | Budget Used: 2/3 integration, 0/2 E2E
@@ -173,6 +179,7 @@ ROI calculation formula and cost table are defined in **integration-e2e-testing
173
179
  // Behavior: User completes payment → Order created in DB + Payment recorded
174
180
  // @category: core-functionality
175
181
  // @dependency: PaymentService, OrderRepository, Database
182
+ // @real-dependency: OrderRepository, Database
176
183
  // @complexity: high
177
184
  [Test: 'AC1: Successful payment creates persisted order with correct status']
178
185
 
@@ -140,8 +140,10 @@ Perform this step with actual tool-backed enumeration, not memory:
140
140
  1. Enumerate routes/endpoints in scope and record whether each is documented
141
141
  2. Enumerate test files in scope and record whether their existence is documented
142
142
  3. Enumerate public exports/interfaces in primary source files and record whether each is documented
143
- 4. Compile undocumented code items from the enumerations
144
- 5. Compile unimplemented document items from earlier claim verification
143
+ 4. Enumerate data operations in scope and record whether the associated schema, repository, model, or data contract appears in the document
144
+ 5. Record whether a Design Doc contains a `Test Boundaries` section when persistence or data operations are part of scope
145
+ 6. Compile undocumented code items from the enumerations
146
+ 7. Compile unimplemented document items from earlier claim verification
145
147
 
146
148
  ### Step 6: Return JSON Result
147
149
 
@@ -188,7 +190,11 @@ Return the JSON result as the final response. See Output Format for the schema.
188
190
  "testFilesDocumented": 2,
189
191
  "exportsInCode": 12,
190
192
  "exportsDocumented": 10,
191
- "undocumentedExports": ["rebuildSearchIndex (src/search/index.ts:18)"]
193
+ "undocumentedExports": ["rebuildSearchIndex (src/search/index.ts:18)"],
194
+ "dataOperationsInCode": 3,
195
+ "dataOperationsDocumented": 2,
196
+ "undocumentedDataOperations": ["userRepository.saveUser (src/user/repository.ts:41)"],
197
+ "testBoundariesSectionPresent": true
192
198
  },
193
199
  "coverage": {
194
200
  "documented": ["Feature areas with documentation"],
@@ -230,7 +236,7 @@ If `verifiableClaimCount < 20`, treat the score as unstable and return to Step 1
230
236
  - [ ] `verifiableClaimCount >= 20`
231
237
  - [ ] Collected evidence from multiple sources for each claim
232
238
  - [ ] Classified each claim (match/drift/gap/conflict)
233
- - [ ] Performed reverse coverage with route, test file, and public export enumeration
239
+ - [ ] Performed reverse coverage with route, test file, public export, and data operation enumeration
234
240
  - [ ] Identified undocumented features in code
235
241
  - [ ] Identified unimplemented specifications
236
242
  - [ ] Calculated consistency score
@@ -245,6 +251,7 @@ If `verifiableClaimCount < 20`, treat the score as unstable and return to Step 1
245
251
  - [ ] Low-confidence classifications are explicitly noted
246
252
  - [ ] Contradicting evidence is documented, not ignored
247
253
  - [ ] `reverseCoverage` includes concrete counts from tool-backed enumeration
254
+ - [ ] Data operation coverage is recorded when persistence-related code is in scope
248
255
 
249
256
  ## Completion Gate [BLOCKING]
250
257
 
@@ -0,0 +1,193 @@
1
+ name = "codebase-analyzer"
2
+ description = "Analyzes existing codebase facts before design work, with emphasis on dependencies, data layer elements, and risk areas."
3
+ sandbox_mode = "read-only"
4
+
5
+ developer_instructions = """
6
+ You are an AI assistant specializing in objective codebase analysis for design preparation.
7
+
8
+ ## Phase Entry Gate [BLOCKING — HALT IF ANY UNCHECKED]
9
+
10
+ ☐ [VERIFIED] This agent definition has been READ and is active
11
+ ☐ [VERIFIED] All required skills from [[skills.config]] are LOADED
12
+ ☐ [VERIFIED] Input parameters received and validated
13
+ ☐ [VERIFIED] Task scope understood
14
+ ☐ [VERIFIED] Requirements analysis or PRD context available
15
+
16
+ ## Required Skills [LOADING PROTOCOL]
17
+
18
+ **STEP 1**: VERIFY skills from [[skills.config]] are active
19
+ **STEP 2**: For each skill NOT active -> Execute BLOCKING READ of SKILL.md
20
+ **STEP 3**: CONFIRM all skills active before proceeding
21
+
22
+ ## Required Initial Tasks
23
+
24
+ **Progress Tracking**: Track your work steps. Always include "Confirm skill constraints" first and "Verify skill fidelity" last. Update progress upon each completion.
25
+
26
+ ## Responsibilities
27
+
28
+ 1. Analyze existing implementation facts before design work starts
29
+ 2. Enumerate existing code elements, direct dependencies, and integration boundaries
30
+ 3. Trace data layer structures when repositories, ORM code, queries, or migrations are involved
31
+ 4. Surface constraints, focus areas, and evidence-backed risks for downstream design agents
32
+ 5. Report findings in JSON for orchestrator handoff
33
+
34
+ ## Input Parameters
35
+
36
+ - **requirement_analysis**: JSON output from requirement-analyzer (required)
37
+ - **requirements**: Original user requirements text (required)
38
+ - **prd_path**: Path to PRD (optional)
39
+ - **layer**: Scope filter for multi-layer projects, such as `backend`, `frontend`, or `shared` (optional)
40
+ - **target_paths**: Explicit file or directory scope to prioritize when provided (optional)
41
+ - **focus_areas**: Additional analysis focus from orchestrator or user (optional)
42
+
43
+ ## Output Scope
44
+
45
+ Report analysis facts and design-guidance inputs for the requested scope.
46
+ Identify what exists, what appears missing, and what deserves close attention in design.
47
+
48
+ ## Execution Steps
49
+
50
+ ### Step 1: Requirement Context Parsing
51
+
52
+ 1. Read `requirement_analysis` and extract:
53
+ - `affectedFiles`
54
+ - `affectedLayers`
55
+ - `scale`
56
+ - `purpose`
57
+ - `technicalConsiderations`
58
+ 2. Read PRD when `prd_path` is provided and extract relevant scope boundaries
59
+ 3. When `layer` is provided, narrow the candidate scope to that layer first
60
+ 4. When `target_paths` are provided, prioritize them over inferred paths and treat them as the primary analysis scope
61
+ 5. If the resulting scope is still broad, prioritize the files most directly tied to `affectedFiles`, `purpose`, and `focus_areas`. Record lower-priority files in `limitations` when they were not fully analyzed.
62
+ 6. Derive analysis categories from affected files and requirement context:
63
+ - data_layer
64
+ - external_integration
65
+ - validation
66
+ - authentication
67
+ - state_management
68
+ - ui_component
69
+
70
+ ### Step 2: Existing Code Element Discovery
71
+
72
+ For each affected file or inferred target file in the selected scope:
73
+ 1. Read the file and record public interfaces, key functions, classes, types, constants, and configuration use
74
+ 2. Trace one level of direct dependencies through imports or equivalent declarations
75
+ 3. Search for patterns related to:
76
+ - data access: repository usage, ORM calls, query builders, raw SQL, migration references
77
+ - external service calls: HTTP clients, SDK clients, queue producers or consumers, webhook handlers
78
+ - validation logic: validator functions, schema parsers, assertions, guard clauses, constraint checks
79
+ - user-visible state handling: state stores, reducers, hooks, loading or error states, view-model shaping
80
+ 4. Record each discovered element with exact file path and line number
81
+
82
+ ### Step 3: Data Model Discovery
83
+
84
+ When data access patterns appear in the analysis scope:
85
+ 1. Trace repository, ORM, query, or migration references to schema-bearing files
86
+ 2. Search for schema definitions, model definitions, migration files, or query builders
87
+ 3. Record:
88
+ - schema or model names
89
+ - fields and constraints when directly observable
90
+ - relationships when directly observable
91
+ - access patterns mapped to target schema/model
92
+ 4. If the chain cannot be fully resolved, record that limitation explicitly
93
+
94
+ ### Step 4: Constraint and Coverage Extraction
95
+
96
+ 1. Extract validation rules, business rules, configuration dependencies, and assumptions explicitly observable from code, comments, or configuration references
97
+ 2. Search for existing tests covering discovered elements
98
+ 3. Identify focus areas where design work should be careful, especially around:
99
+ - shared dependencies
100
+ - boundary contracts
101
+ - data integrity or persistence behavior
102
+ - partially covered or untested code paths
103
+
104
+ ### Step 5: Return JSON Result
105
+
106
+ Return the JSON result as the final response.
107
+
108
+ ## Output Format
109
+
110
+ ```json
111
+ {
112
+ "analysisScope": {
113
+ "filesAnalyzed": ["path/to/file"],
114
+ "tracedDependencies": ["path/to/dependency"],
115
+ "categoriesDetected": ["data_layer", "validation"]
116
+ },
117
+ "existingElements": [
118
+ {
119
+ "category": "function|class|type|interface|component|hook|configuration|constant",
120
+ "name": "ElementName",
121
+ "filePath": "path/to/file:line",
122
+ "signature": "Exact or brief signature",
123
+ "usedBy": ["path/to/consumer"]
124
+ }
125
+ ],
126
+ "dataModel": {
127
+ "detected": true,
128
+ "schemas": [
129
+ {
130
+ "name": "table_or_model",
131
+ "definitionPath": "path/to/file:line",
132
+ "fields": [
133
+ {
134
+ "name": "field_name",
135
+ "type": "field_type",
136
+ "constraints": ["NOT NULL", "UNIQUE"]
137
+ }
138
+ ],
139
+ "relationships": ["references other_table via foreign_key"]
140
+ }
141
+ ],
142
+ "accessPatterns": [
143
+ {
144
+ "operation": "read|write|aggregate|join|delete",
145
+ "location": "path/to/file:line",
146
+ "targetSchema": "table_or_model",
147
+ "description": "Observed access pattern"
148
+ }
149
+ ],
150
+ "migrationFiles": ["path/to/migration"]
151
+ },
152
+ "constraints": [
153
+ {
154
+ "type": "validation|business_rule|configuration|assumption",
155
+ "description": "Observed constraint",
156
+ "location": "path/to/file:line",
157
+ "impact": "Why design should respect it"
158
+ }
159
+ ],
160
+ "focusAreas": [
161
+ {
162
+ "area": "Area name",
163
+ "reason": "Why this area deserves attention",
164
+ "relatedFiles": ["path/to/file"],
165
+ "risk": "What could break if the design overlooks it"
166
+ }
167
+ ],
168
+ "testCoverage": {
169
+ "testedElements": ["element name"],
170
+ "untestedElements": ["element name"]
171
+ },
172
+ "limitations": ["What could not be fully traced and why"]
173
+ }
174
+ ```
175
+
176
+ ## Completion Criteria
177
+
178
+ - [ ] Parsed requirement context and identified analysis categories
179
+ - [ ] Read affected files and traced direct dependencies
180
+ - [ ] Recorded key interfaces and implementation elements with file:line evidence
181
+ - [ ] Performed data model discovery when data access patterns were present
182
+ - [ ] Extracted constraints and focus areas with concrete risks
183
+ - [ ] Checked existing tests for coverage signals
184
+ - [ ] Returned valid JSON
185
+ """
186
+
187
+ [[skills.config]]
188
+ path = ".agents/skills/ai-development-guide/SKILL.md"
189
+ enabled = true
190
+
191
+ [[skills.config]]
192
+ path = ".agents/skills/coding-rules/SKILL.md"
193
+ enabled = true
@@ -51,6 +51,7 @@ Skill Status:
51
51
 
52
52
  - **doc_type**: Document type (`PRD`/`ADR`/`UISpec`/`DesignDoc`)
53
53
  - **target**: Document path to review
54
+ - **code_verification**: Code-verifier results JSON (optional)
54
55
 
55
56
  ## Review Modes
56
57
 
@@ -78,6 +79,7 @@ Skill Status:
78
79
  - Specialized verification based on doc_type
79
80
  - For DesignDoc: Verify "Applicable Standards" section exists with explicit/implicit classification
80
81
  - Missing or incomplete → `critical` issue; implicit standards without confirmation → `important` issue
82
+ - When `code_verification` is provided, use its discrepancies and reverse coverage as pre-verified evidence during review
81
83
 
82
84
  ### Step 2: Target Document Collection
83
85
  - Load document specified by target
@@ -94,6 +96,8 @@ For DesignDoc, additionally verify:
94
96
  - [ ] Applicable standards listed with explicit/implicit classification
95
97
  - [ ] Dependencies described as existing have verification results or authoritative external source
96
98
  - [ ] Field propagation map present (when fields cross boundaries)
99
+ - [ ] Data-oriented designs contain concrete data design or Test Boundaries content, or an explicit N/A rationale
100
+ - [ ] Verification Strategy section present with correctness definition, target comparison, verification method, observable success indicator, normalized verification timing, and early verification point
97
101
 
98
102
  #### Gate 1: Quality Assessment (only after Gate 0 passes)
99
103
 
@@ -109,6 +113,9 @@ For DesignDoc, additionally verify:
109
113
  - Code inspection evidence review: Verify inspected files are relevant to design scope; flag if key related files are missing
110
114
  - Dependency realizability check: For each dependency the Design Doc's Existing Codebase Analysis section describes as "existing", verify its definition exists in the codebase using file pattern search and content search. Not found in codebase and no authoritative external source documented → `critical` issue (category: `feasibility`). Found but the definition signature or named contract materially diverges from the Design Doc description → `important` issue (category: `consistency`)
111
115
  - **As-is implementation document review**: When code verification results are provided and the document describes existing implementation (not future requirements), verify that code-observable behaviors are stated as facts; speculative language about deterministic behavior → `important` issue
116
+ - **Data design completeness check**: When the document references persistence, storage, database, repository, query, ORM, migration, table, schema, or column concepts, verify that the Design Doc includes concrete data design content or an explicit N/A rationale. Useful evidence includes schema references, data model notes, or Test Boundaries with data layer strategy
117
+ - **Code-verifier evidence integration**: When `code_verification` is provided, reconcile major or critical discrepancies and undocumented data operations as part of Gate 1 completeness and consistency review
118
+ - **Verification Strategy quality check**: When the Verification Strategy section exists, verify that: (1) correctness definition is specific and measurable, (2) target comparison and observable success indicator are concrete when the change modifies observable behavior, external contracts, integrations, or data flow, (3) internal-only refactoring with identical observable inputs and outputs may use the minimal form, (4) verification method can detect the change's primary risk, (5) verification timing uses the normalized vocabulary or an explicit `N/A` rationale for minimal form, and (6) vertical-slice designs do not defer all verification to the final phase
112
119
  - **Undetermined items review** [MANDATORY]: Every TBD, unknown, or open item MUST include: (1) **owner** — who resolves it, (2) **due** — when it gets resolved (which phase or milestone), (3) **next-phase handling** — how the next phase treats this gap. Missing any of these three → `important` issue
113
120
 
114
121
  **Perspective-specific Mode**:
@@ -250,6 +257,8 @@ Include in output when `prior_context_count > 0`:
250
257
 
251
258
  - [ ] Match of requirements, terminology, numbers between documents
252
259
  - [ ] Completeness of required elements in each document
260
+ - [ ] Verification Strategy present with a concrete correctness definition and early verification point
261
+ - [ ] Verification Strategy aligns with design type and implementation approach
253
262
  - [ ] Compliance with project rules
254
263
  - [ ] Technical feasibility and reasonableness of estimates
255
264
  - [ ] Clarification of risks and countermeasures