codex-workflows 0.6.7 → 0.6.9

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 (36) hide show
  1. package/.agents/skills/ai-development-guide/SKILL.md +5 -3
  2. package/.agents/skills/ai-development-guide/references/frontend.md +11 -19
  3. package/.agents/skills/coding-rules/references/typescript.md +17 -12
  4. package/.agents/skills/documentation-criteria/references/plan-template.md +1 -1
  5. package/.agents/skills/documentation-criteria/references/task-template.md +8 -0
  6. package/.agents/skills/integration-e2e-testing/SKILL.md +1 -1
  7. package/.agents/skills/recipe-build/SKILL.md +10 -3
  8. package/.agents/skills/recipe-front-build/SKILL.md +10 -3
  9. package/.agents/skills/recipe-fullstack-build/SKILL.md +10 -3
  10. package/.agents/skills/recipe-fullstack-implement/SKILL.md +1 -1
  11. package/.agents/skills/recipe-prepare-implementation/SKILL.md +1 -0
  12. package/.agents/skills/subagents-orchestration-guide/SKILL.md +9 -6
  13. package/.agents/skills/task-analyzer/references/skills-index.yaml +1 -1
  14. package/.agents/skills/testing/SKILL.md +5 -5
  15. package/.agents/skills/testing/references/typescript.md +2 -6
  16. package/.codex/agents/acceptance-test-generator.toml +61 -96
  17. package/.codex/agents/code-reviewer.toml +4 -57
  18. package/.codex/agents/code-verifier.toml +1 -47
  19. package/.codex/agents/codebase-analyzer.toml +1 -106
  20. package/.codex/agents/design-sync.toml +2 -64
  21. package/.codex/agents/document-reviewer.toml +3 -78
  22. package/.codex/agents/integration-test-reviewer.toml +1 -26
  23. package/.codex/agents/investigator.toml +1 -73
  24. package/.codex/agents/quality-fixer-frontend.toml +4 -105
  25. package/.codex/agents/quality-fixer.toml +4 -122
  26. package/.codex/agents/requirement-analyzer.toml +1 -29
  27. package/.codex/agents/rule-advisor.toml +1 -79
  28. package/.codex/agents/scope-discoverer.toml +1 -70
  29. package/.codex/agents/security-reviewer.toml +1 -19
  30. package/.codex/agents/solver.toml +5 -54
  31. package/.codex/agents/task-decomposer.toml +18 -0
  32. package/.codex/agents/task-executor-frontend.toml +16 -142
  33. package/.codex/agents/task-executor.toml +16 -142
  34. package/.codex/agents/ui-analyzer.toml +1 -157
  35. package/.codex/agents/verifier.toml +2 -65
  36. package/package.json +1 -1
@@ -165,7 +165,9 @@ To isolate problems, attempt reproduction with minimal code:
165
165
  - Replace external dependencies with mocks
166
166
  - Create minimal configuration that reproduces problem
167
167
 
168
- ### 4. Debug Log Output
168
+ ### 4. Debug Log Output (temporary)
169
+ Add structured debug logs to isolate the issue, then remove them before commit.
170
+
169
171
  ```
170
172
  Pattern: Structured logging with context
171
173
  {
@@ -204,7 +206,7 @@ Universal quality assurance phases applicable to all languages:
204
206
  ### Phase 3: Testing
205
207
  1. **Unit Tests**: Run all unit tests
206
208
  2. **Integration Tests**: Run integration tests
207
- 3. **Test Coverage**: Measure and verify coverage meets standards
209
+ 3. **Test Coverage**: Measure coverage when configured and use it to find gaps
208
210
  4. **E2E Tests**: Run end-to-end tests
209
211
 
210
212
  ### Phase 4: Final Quality Gate [MANDATORY]
@@ -212,7 +214,7 @@ All checks MUST pass before proceeding:
212
214
  - Zero static analysis errors
213
215
  - Build succeeds
214
216
  - All tests pass
215
- - Coverage meets threshold
217
+ - Coverage threshold passes when the project, task file, work plan, or Design Doc defines one. When no threshold is configured, use coverage output only to identify untested critical paths.
216
218
 
217
219
  **ENFORCEMENT**: Cannot proceed with ANY quality check failures — fix ALL errors before marking task complete
218
220
 
@@ -75,28 +75,19 @@ console.log('DEBUG:', {
75
75
 
76
76
  ## Frontend Quality Check Workflow
77
77
 
78
- Use the appropriate run command based on the `packageManager` field in package.json.
78
+ Read `package.json` scripts and run them with the project's package manager from the `packageManager` field. Map the phases below using the script names declared in `package.json`.
79
79
 
80
- ### Common Commands
81
- - `dev` - Development server
82
- - `build` - Production build
83
- - `preview` - Preview production build
84
- - `type-check` - Type check (no emit)
85
-
86
- ### Quality Check Phases
87
- **Phase 1-3: Basic Checks**
88
- - `check` - Linter + formatter (Biome, ESLint, Prettier, etc.)
89
- - `build` - TypeScript build
90
-
91
- **Phase 4-5: Tests and Final Confirmation**
92
- - `test` - Test execution
93
- - `test:coverage:fresh` - Coverage measurement (fresh cache)
94
- - `check:all` - Overall integrated check
80
+ ### Phases
81
+ 1. **Lint/format** - the project's formatter and linter, such as Biome or ESLint plus Prettier
82
+ 2. **Type check** - type check without emit when the project has a dedicated command
83
+ 3. **Build** - production build
84
+ 4. **Test** - unit and integration tests
85
+ 5. **Coverage** - coverage run when configured or when the task added or changed behavior
95
86
 
96
87
  ### Troubleshooting
97
- - **Port in use error**: Run `cleanup:processes` script if available
98
- - **Cache issues**: Run tests with fresh cache option
99
- - **Dependency errors**: Clean reinstall dependencies
88
+ - **Port already in use**: stop the stale dev, preview, or test process holding the port
89
+ - **Stale cache**: re-run with the project's fresh or clean-cache option
90
+ - **Dependency errors**: clean reinstall dependencies
100
91
 
101
92
  ## Frontend Technical Decisions
102
93
 
@@ -108,6 +99,7 @@ Use the appropriate run command based on the `packageManager` field in package.j
108
99
  ### Performance vs Readability
109
100
  - Prioritize readability unless clear bottleneck exists
110
101
  - Measure before optimizing (use React DevTools Profiler, not guesses)
102
+ - When React Compiler is enabled, routine memoization is automatic. Use manual memoization only for a measured bottleneck or stable reference identity required by third-party APIs or effect dependencies.
111
103
  - Document reason with comments when optimizing
112
104
 
113
105
  ## Frontend Impact Analysis
@@ -62,6 +62,11 @@ function isUser(value: unknown): value is User {
62
62
  - **Component Hierarchy**: Follow the project's existing component architecture. Use Atoms > Molecules > Organisms > Templates > Pages only when the project adopts Atomic Design.
63
63
  - **Co-location**: Place tests, styles, and related files alongside components
64
64
 
65
+ **Server/Client Boundary (RSC frameworks only, such as Next.js App Router)**
66
+ - Default to server components for data fetching and rendering. Isolate interactivity behind a `"use client"` boundary at the smallest scope that needs it.
67
+ - Keep browser-only APIs such as `window`, `localStorage`, and event handlers inside client components.
68
+ - Skip this section for client-only SPAs with no server-component runtime.
69
+
65
70
  **State Management Patterns**
66
71
  - **Local State**: `useState` for component-specific state
67
72
  - **Context API**: For sharing state across component tree (theme, auth, etc.)
@@ -95,19 +100,18 @@ setUsers(users)
95
100
  - Type-safe: Always define Props type explicitly
96
101
 
97
102
  **Environment Variables**
98
- - **Use build tool's environment variable system**: `process.env` does not work in browsers
99
- - Centrally manage environment variables through configuration layer
100
- - Implement proper type safety and default value handling
103
+ - **Use the build tool's env accessor**: read client-side env through the bundler's exposed accessor, such as Vite `import.meta.env` or Next.js/CRA prefixed `process.env`.
104
+ - **Only prefixed vars reach the client**: build tools expose only vars carrying their public prefix. Match the project's bundler, such as Vite `VITE_`, Next.js `NEXT_PUBLIC_`, or CRA `REACT_APP_`.
105
+ - Centrally manage environment variables through a typed configuration layer with defaults.
101
106
 
102
107
  ```typescript
103
- // Build tool environment variables (public values only)
108
+ // Client-exposed env must carry the bundler's public prefix, or it is undefined in the browser.
109
+ // Vite: import.meta.env.VITE_API_URL
110
+ // Next.js: process.env.NEXT_PUBLIC_API_URL
104
111
  const config = {
105
- apiUrl: import.meta.env.API_URL || 'http://localhost:3000',
106
- appName: import.meta.env.APP_NAME || 'My App'
112
+ apiUrl: import.meta.env.VITE_API_URL || 'http://localhost:3000',
113
+ appName: import.meta.env.VITE_APP_NAME || 'My App'
107
114
  }
108
-
109
- // Does not work in frontend
110
- // const apiUrl = process.env.API_URL
111
115
  ```
112
116
 
113
117
  **Security (Client-side Constraints)**
@@ -118,7 +122,7 @@ const config = {
118
122
 
119
123
  ```typescript
120
124
  // Bad: API key exposed in browser
121
- // const apiKey = import.meta.env.API_KEY
125
+ // const apiKey = import.meta.env.VITE_API_KEY
122
126
  // const response = await fetch(`https://api.example.com/data?key=${apiKey}`)
123
127
 
124
128
  // Good: Backend manages secrets, frontend accesses via proxy
@@ -132,6 +136,7 @@ const response = await fetch('/api/data') // Backend handles API key authenticat
132
136
  - Promise Handling: Always use `async/await`
133
137
  - Error Handling: Always handle with `try-catch` or Error Boundary
134
138
  - Type Definition: Explicitly define return value types (e.g., `Promise<Result>`)
139
+ - Effect race/cleanup: guard `useEffect` data fetches against out-of-order responses and post-unmount state updates with `AbortController`, a mounted/stale flag, or a server-state library such as React Query or SWR.
135
140
 
136
141
  **Format Rules**
137
142
  - Semicolon omission (follow project formatter settings)
@@ -209,10 +214,10 @@ Never include sensitive information (password, token, apiKey, secret, creditCard
209
214
 
210
215
  ## Performance Optimization
211
216
 
212
- - Component Memoization: Use React.memo for expensive components
217
+ - Automatic memoization: when React Compiler is enabled, rely on it. Use manual `React.memo`, `useMemo`, or `useCallback` only for a profiler-confirmed bottleneck or stable reference identity required by third-party APIs or effect dependencies.
213
218
  - State Optimization: Minimize re-renders with proper state structure
214
219
  - Lazy Loading: Use React.lazy and Suspense for code splitting
215
- - Bundle Size: Monitor with the `build` script and keep under 500KB
220
+ - Bundle Size: Monitor with the build script against the project's budget
216
221
 
217
222
  ## Non-functional Requirements
218
223
 
@@ -243,7 +243,7 @@ This phase is required for all implementation approaches.
243
243
  - [ ] Security review: Verify security considerations from Design Doc are implemented
244
244
  - [ ] Quality checks (types, lint, format)
245
245
  - [ ] Execute all tests (including integration/E2E from test skeletons, when provided)
246
- - [ ] Coverage 70%+
246
+ - [ ] Coverage threshold passes when configured
247
247
  - [ ] Document updates
248
248
 
249
249
  ### Quality Assurance
@@ -17,6 +17,13 @@ Metadata:
17
17
  Files to read before starting implementation. Use concrete file paths, optionally with a section/function hint:
18
18
  - [e.g., src/orders/checkout.ts (processOrder function)]
19
19
 
20
+ ## Change Category
21
+ (Include this field only when the task is a bug fix, regression, state-change, or boundary-change. Omit otherwise.)
22
+
23
+ `Change Category: <one or more of bug-fix, regression, state-change, boundary-change, comma-separated>`
24
+
25
+ When present, sweep cases sharing the same path, contract, persisted state, or external boundary for the same class of defect during the Red Phase.
26
+
20
27
  ## Binding Decisions
21
28
  (Include this section when the work plan's ADR Bindings table covers this task. Omit otherwise.)
22
29
 
@@ -34,6 +41,7 @@ Brief observations recorded after reading Investigation Targets:
34
41
  ## Implementation Steps (TDD: Red-Green-Refactor)
35
42
  ### 1. Red Phase
36
43
  - [ ] Read all Investigation Targets and update Investigation Notes
44
+ - [ ] (When Change Category is set) Sweep adjacent cases sharing the same path, contract, persisted state, or external boundary for the same class of defect; fold any in-scope residual into failing tests
37
45
  - [ ] Review dependency deliverables (if any)
38
46
  - [ ] Verify/create contract definitions
39
47
  - [ ] Write failing tests
@@ -156,7 +156,7 @@ The test runner or framework in the project determines the appropriate file exte
156
156
 
157
157
  | Check | Failure Condition |
158
158
  |-------|-------------------|
159
- | Behavior Verification | No assertion for "observable result" in skeleton |
159
+ | Behavior Verification | No assertion for "observable result" in the implemented test |
160
160
  | Verification Item Coverage | Listed items not all covered by assertions |
161
161
  | Mock Boundary | Real dependencies from `@real-dependency` are isolated away or internal components are mocked without rationale |
162
162
 
@@ -29,9 +29,9 @@ Work plan: $ARGUMENTS
29
29
 
30
30
  ## Pre-execution Prerequisites
31
31
 
32
- ### Implementation Readiness Check
32
+ ### Implementation Readiness Resolution
33
33
 
34
- Before task processing, locate the work plan to gate against.
34
+ Before task processing, locate the work plan and resolve implementation readiness.
35
35
 
36
36
  Resolution rule:
37
37
  1. If `$ARGUMENTS` contains a work plan path, use that exact file and derive `{plan-name}` from its basename. This takes precedence over task-file mtimes.
@@ -40,7 +40,14 @@ Resolution rule:
40
40
  4. If matching task files exist, infer `{plan-name}` from the most recent matching task file and use `docs/plans/{plan-name}.md`.
41
41
  5. If no matching task files exist, use the most recent non-template work plan in `docs/plans/`.
42
42
 
43
- Read the work plan header and apply the Implementation Readiness Marker Contract from `subagents-orchestration-guide`.
43
+ Read the work plan header and apply this readiness rule:
44
+
45
+ | Header state | Action |
46
+ |--------------|--------|
47
+ | `Implementation Readiness: ready` | Proceed to Consumed Task Set computation |
48
+ | `Implementation Readiness: pending` | Execute the Implementation Readiness Preflight Procedure from `subagents-orchestration-guide` for the resolved work plan. Re-read the resulting marker: proceed to Consumed Task Set only when it is `ready`; if it is `escalated`, follow the `escalated` row |
49
+ | `Implementation Readiness: escalated` | Present the persisted Readiness Report remaining gaps, then continue only on explicit user approval |
50
+ | marker absent | Execute the Implementation Readiness Preflight Procedure from `subagents-orchestration-guide` for the resolved work plan. Re-read the resulting marker: proceed to Consumed Task Set only when it is `ready`; if it is `escalated`, follow the `escalated` row |
44
51
 
45
52
  ### Consumed Task Set
46
53
 
@@ -29,9 +29,9 @@ Work plan: $ARGUMENTS
29
29
 
30
30
  ## Pre-execution Prerequisites
31
31
 
32
- ### Implementation Readiness Check
32
+ ### Implementation Readiness Resolution
33
33
 
34
- Before task processing, locate the work plan to gate against.
34
+ Before task processing, locate the work plan and resolve implementation readiness.
35
35
 
36
36
  Resolution rule:
37
37
  1. If `$ARGUMENTS` contains a work plan path, use that exact file and derive `{plan-name}` from its basename. This takes precedence over task-file mtimes.
@@ -40,7 +40,14 @@ Resolution rule:
40
40
  4. If matching task files exist, infer `{plan-name}` from the most recent matching task file and use `docs/plans/{plan-name}.md`.
41
41
  5. If no matching task files exist, use the most recent non-template work plan in `docs/plans/`.
42
42
 
43
- Read the work plan header and apply the Implementation Readiness Marker Contract from `subagents-orchestration-guide`.
43
+ Read the work plan header and apply this readiness rule:
44
+
45
+ | Header state | Action |
46
+ |--------------|--------|
47
+ | `Implementation Readiness: ready` | Proceed to Consumed Task Set computation |
48
+ | `Implementation Readiness: pending` | Execute the Implementation Readiness Preflight Procedure from `subagents-orchestration-guide` for the resolved work plan. Re-read the resulting marker: proceed to Consumed Task Set only when it is `ready`; if it is `escalated`, follow the `escalated` row |
49
+ | `Implementation Readiness: escalated` | Present the persisted Readiness Report remaining gaps, then continue only on explicit user approval |
50
+ | marker absent | Execute the Implementation Readiness Preflight Procedure from `subagents-orchestration-guide` for the resolved work plan. Re-read the resulting marker: proceed to Consumed Task Set only when it is `ready`; if it is `escalated`, follow the `escalated` row |
44
51
 
45
52
  ### Consumed Task Set
46
53
 
@@ -39,9 +39,9 @@ Work plan: $ARGUMENTS
39
39
 
40
40
  ## Pre-execution Prerequisites
41
41
 
42
- ### Implementation Readiness Check
42
+ ### Implementation Readiness Resolution
43
43
 
44
- Before task processing, locate the work plan to gate against.
44
+ Before task processing, locate the work plan and resolve implementation readiness.
45
45
 
46
46
  Resolution rule:
47
47
  1. If `$ARGUMENTS` contains a work plan path, use that exact file and derive `{plan-name}` from its basename. This takes precedence over task-file mtimes.
@@ -50,7 +50,14 @@ Resolution rule:
50
50
  4. If matching task files exist, infer `{plan-name}` from the most recent matching task file and use `docs/plans/{plan-name}.md`.
51
51
  5. If no matching task files exist, use the most recent non-template work plan in `docs/plans/`.
52
52
 
53
- Read the work plan header and apply the Implementation Readiness Marker Contract from `subagents-orchestration-guide`.
53
+ Read the work plan header and apply this readiness rule:
54
+
55
+ | Header state | Action |
56
+ |--------------|--------|
57
+ | `Implementation Readiness: ready` | Proceed to Consumed Task Set computation |
58
+ | `Implementation Readiness: pending` | Execute the Implementation Readiness Preflight Procedure from `subagents-orchestration-guide` for the resolved work plan. Re-read the resulting marker: proceed to Consumed Task Set only when it is `ready`; if it is `escalated`, follow the `escalated` row |
59
+ | `Implementation Readiness: escalated` | Present the persisted Readiness Report remaining gaps, then continue only on explicit user approval |
60
+ | marker absent | Execute the Implementation Readiness Preflight Procedure from `subagents-orchestration-guide` for the resolved work plan. Re-read the resulting marker: proceed to Consumed Task Set only when it is `ready`; if it is `escalated`, follow the `escalated` row |
54
61
 
55
62
  ### Consumed Task Set
56
63
 
@@ -104,7 +104,7 @@ When user responds to questions:
104
104
  **Required Flow Compliance**:
105
105
  - Run quality-fixer (layer-appropriate) before every commit
106
106
  - Obtain user approval before Edit/Write outside autonomous mode
107
- - Run implementation readiness preflight for the approved work plan before autonomous implementation, or continue without it only after explicit user approval
107
+ - Resolve implementation readiness for the approved work plan before autonomous implementation
108
108
 
109
109
  ENFORCEMENT: Commits without quality-fixer approval are invalid and MUST be reverted.
110
110
 
@@ -80,6 +80,7 @@ When all applicable criteria are `pass`:
80
80
 
81
81
  When one or more criteria fail:
82
82
  1. Present the proposed prep tasks to the user and continue only after explicit approval.
83
+ - If the user declines prep execution, persist `Implementation Readiness: escalated` with the current Readiness Report and stop before creating prep task files.
83
84
  2. Create task files in `docs/plans/tasks/` using the task template:
84
85
  - Backend prep: `{plan-name}-backend-task-prep-{NN}.md`
85
86
  - Frontend prep: `{plan-name}-frontend-task-prep-{NN}.md`
@@ -210,14 +210,14 @@ Work plans use the header line `Implementation Readiness: <status>`.
210
210
 
211
211
  | Status | Meaning | Consumer Action |
212
212
  |--------|---------|-----------------|
213
- | `pending` | Initial state from work-planner; readiness has not been checked | Present the unchecked state, recommend running implementation readiness preflight, and continue only on explicit user approval |
213
+ | `pending` | Initial state from work-planner; readiness has not been checked | Run the Implementation Readiness Preflight Procedure before task execution |
214
214
  | `ready` | Readiness scan completed and no applicable failures remain | Proceed with task execution |
215
215
  | `escalated` | Readiness scan completed, but one or more failures remain | Read the work plan's Implementation Readiness Report, present remaining gaps, and continue only on explicit user approval |
216
- | absent | Older work plan without the marker | Treat as `pending` |
216
+ | absent | Older work plan without the marker | Run the Implementation Readiness Preflight Procedure and persist the resulting marker |
217
217
 
218
218
  ## Implementation Readiness Preflight Procedure
219
219
 
220
- Use this procedure after work-plan approval and before autonomous task execution when the flow needs to verify implementation readiness.
220
+ Use this procedure after work-plan approval and before autonomous task execution when the flow needs to verify implementation readiness. The procedure supplies the evidence needed for user decisions; prompts for approval only after concrete failing criteria and proposed prep tasks are known.
221
221
 
222
222
  1. Load the approved work plan exact path and extract Verification Strategies, Quality Assurance Mechanisms, Design-to-Plan Traceability, ADR Bindings, UI Spec Component -> Task Mapping, Connection Map, test skeleton references, E2E absence reasons, phase structure, referenced Design Docs, ADRs, and UI Specs.
223
223
  2. Evaluate these criteria with evidence:
@@ -227,9 +227,12 @@ Use this procedure after work-plan approval and before autonomous task execution
227
227
  - R4 UI rendering surface exists when UI work is present
228
228
  - R5 Local service stack or browser harness procedure exists when applicable
229
229
  3. If every applicable criterion passes, persist `## Implementation Readiness Report` in the work plan and set `Implementation Readiness: ready`.
230
- 4. If any criterion fails, create the smallest approved prep tasks that close the gaps, execute each exact prep task file through the standard executor -> quality-fixer -> commit cycle, then re-run the scan.
231
- 5. After re-scan, set `Implementation Readiness: ready` when all applicable criteria pass, otherwise `Implementation Readiness: escalated`, and persist remaining gaps in the Readiness Report.
232
- 6. Collapse completed prep task references into the Readiness Report and delete only the prep task files created for the current work plan.
230
+ 4. If any criterion fails, present the failing criteria, evidence, and the smallest proposed prep tasks that close the gaps. Continue with prep execution only after explicit user approval for those tasks.
231
+ 5. If the user declines prep execution, persist `Implementation Readiness: escalated` with the remaining gaps and stop before autonomous task execution.
232
+ 6. If the user approves prep execution, create the approved prep task files under `docs/plans/tasks/` using the task template. Use `{plan-name}-task-prep-{NN}.md` for single-layer plans, `{plan-name}-backend-task-prep-{NN}.md` for backend prep, and `{plan-name}-frontend-task-prep-{NN}.md` for frontend prep.
233
+ 7. Execute each exact prep task file through the standard executor -> quality-fixer -> commit cycle, then re-run the scan.
234
+ 8. After re-scan, set `Implementation Readiness: ready` when all applicable criteria pass, otherwise `Implementation Readiness: escalated`, and persist remaining gaps in the Readiness Report.
235
+ 9. Collapse completed prep task references into the Readiness Report and delete only the prep task files created for the current work plan.
233
236
 
234
237
  ## Handling Requirement Changes
235
238
 
@@ -155,7 +155,7 @@ skills:
155
155
 
156
156
  subagents-orchestration-guide:
157
157
  skill: "subagents-orchestration-guide"
158
- tags: [orchestration, workflow, subagents, context-isolation, autonomous-execution, guided-autonomous-execution, planning, design-flow, implementation-flow, implementation-readiness, readiness-gate]
158
+ tags: [orchestration, workflow, subagents, context-isolation, autonomous-execution, guided-autonomous-execution, planning, design-flow, implementation-flow, implementation-readiness, readiness-resolution]
159
159
  typical-use: "Orchestrating subagents through implementation workflows, scale determination, stop points, guided autonomous execution mode"
160
160
  size: large
161
161
  key-references:
@@ -52,11 +52,11 @@ For language-specific testing patterns, also read:
52
52
 
53
53
  ## Quality Requirements [MANDATORY]
54
54
 
55
- ### Coverage Standards
55
+ ### Coverage
56
56
 
57
- - **Minimum 80% code coverage** for production code
58
- - Prioritize critical paths and business logic
59
- - Use coverage as a guide, not a goal
57
+ - Treat coverage as a diagnostic signal for finding untested areas, not a target. Targets get gamed into trivial tests.
58
+ - Concentrate tests on critical paths, business logic, and behavior whose regression would matter.
59
+ - Prioritize meaningful assertions over the coverage number. Any required threshold comes from the project's CI, task file, work plan, or Design Doc.
60
60
 
61
61
  ### Test Characteristics
62
62
 
@@ -279,7 +279,7 @@ Always test:
279
279
  ☐ All tests pass
280
280
  ☐ No tests skipped or commented
281
281
  ☐ No debug code left in tests
282
- Test coverage meets standards (≥ 80%)
282
+ Coverage threshold passes when the project, task file, work plan, or Design Doc defines one
283
283
  ☐ Tests run in reasonable time
284
284
 
285
285
  ### Zero Tolerance Policy
@@ -10,13 +10,9 @@ import { render, screen } from '@testing-library/react'
10
10
  import userEvent from '@testing-library/user-event'
11
11
  ```
12
12
 
13
- ### Coverage Requirements
13
+ ### Where to Concentrate Test Rigor
14
14
 
15
- - **Overall minimum**: 60%
16
- - **Atomic Design projects**: Atoms 70%+, Molecules 65%+, Organisms 60%+
17
- - **Other component architectures**: Keep 60% as the baseline and raise foundational or highly reused components to 70%+
18
- - **Custom Hooks**: 65%+
19
- - **Utils**: 70%+
15
+ Test foundational, high-reuse units the hardest: shared components, custom hooks, utilities, and business rules reused across features carry the widest blast radius. Higher-composition surfaces such as pages and organisms lean more on integration or E2E coverage. Any numeric threshold is the project's CI, task file, work plan, or Design Doc config.
20
16
 
21
17
  ### Test Types
22
18
 
@@ -180,33 +180,40 @@ Value score and E2E selection rules are defined in **integration-e2e-testing ski
180
180
 
181
181
  Adapt comment syntax to the project's language when generating annotations.
182
182
 
183
+ A skeleton is committed before its implementation exists, so its committed form contains only comments and omits executable imports, runner blocks, and runner globals such as `describe` or `it`. This keeps freshly committed skeletons green under typecheck, lint, and build gates. The implementing task adds executable imports, runner blocks, and assertions alongside the implementation.
184
+
183
185
  ```
184
186
  // [Feature Name] Integration Test - Design Doc: [filename]
185
187
  // Generated: [date] | Budget Used: 2/3 integration, 0/2 E2E
186
-
187
- [Import statement using detected test framework]
188
-
189
- [Test suite using detected framework syntax]
190
- // AC1: "After successful payment, order is created and persisted"
191
- // Value Score: 95 | Business Value: 10 (business-critical) | Frequency: 9 (90% users)
192
- // Behavior: User completes payment → Order created in DB + Payment recorded
193
- // @category: core-functionality
194
- // @dependency: PaymentService, OrderRepository, Database
195
- // @real-dependency: OrderRepository, Database
196
- // @complexity: high
197
- // Primary failure mode: payment succeeds but the order row is absent or unpersisted
198
- // Proof obligation: assert order persistence after successful payment while keeping OrderRepository and Database real; only the external payment gateway may be mocked
199
- [Test: 'AC1: Successful payment creates persisted order with correct status']
200
-
201
- // AC1-error: "Payment failure shows user-friendly error message"
202
- // Value Score: 34 | Business Value: 8 (prevents support tickets) | Frequency: 2 (rare)
203
- // Behavior: Payment fails User sees actionable error + Order not created
204
- // @category: core-functionality
205
- // @dependency: PaymentService, ErrorHandler
206
- // @complexity: medium
207
- // Primary failure mode: payment failure still creates an order or hides the user-facing error
208
- // Proof obligation: assert the visible error and the unchanged order state after a failed payment; mock only the external payment gateway failure
209
- [Test: 'AC1: Failed payment displays error without creating order']
188
+ //
189
+ // Test case: AC1 successful payment creates persisted order
190
+ // AC: "After successful payment, order is created and persisted"
191
+ // Value Score: 95 | Business Value: 10 (business-critical) | Frequency: 9 (90% users)
192
+ // Behavior: User completes payment -> Order created in DB + Payment recorded
193
+ // @category: core-functionality
194
+ // @lane: integration
195
+ // @dependency: PaymentService, OrderRepository, Database
196
+ // @real-dependency: OrderRepository, Database
197
+ // @complexity: high
198
+ // Primary failure mode: payment succeeds but the order row is absent or unpersisted
199
+ // Proof obligation: assert order persistence after successful payment while keeping OrderRepository and Database real; only the external payment gateway may be mocked
200
+ // Verification items:
201
+ // - Persisted order exists with correct status
202
+ // - Payment record exists
203
+ //
204
+ // Test case: AC1 payment failure displays error without creating order
205
+ // AC: "Payment failure shows user-friendly error message"
206
+ // Value Score: 34 | Business Value: 8 (prevents support tickets) | Frequency: 2 (rare)
207
+ // Behavior: Payment fails -> User sees actionable error + Order not created
208
+ // @category: core-functionality
209
+ // @lane: integration
210
+ // @dependency: PaymentService, ErrorHandler
211
+ // @complexity: medium
212
+ // Primary failure mode: payment failure still creates an order or hides the user-facing error
213
+ // Proof obligation: assert the visible error and the unchanged order state after a failed payment; mock only the external payment gateway failure
214
+ // Verification items:
215
+ // - Visible actionable error appears
216
+ // - Order count or order state remains unchanged
210
217
  ```
211
218
 
212
219
  ### fixture-e2e Test File
@@ -216,20 +223,20 @@ Adapt comment syntax to the project's language when generating annotations.
216
223
  // Generated: [date] | Budget Used: 1/3 fixture-e2e
217
224
  // Test Type: Browser UI with mocked backend / fixture-driven state
218
225
  // Implementation Timing: Alongside UI implementation
219
-
220
- [Import statement using detected test framework]
221
-
222
- [Test suite using detected framework syntax]
223
- // User Journey: Dismiss card -> Undo banner appears -> Undo restores card
224
- // Value Score: 60 | Business Value: 6 | Frequency: 7 | Defect Detection: 8
225
- // Verification: Browser-visible state transitions with mocked backend state
226
- // @category: fixture-e2e
227
- // @lane: fixture-e2e
228
- // @dependency: full-ui (mocked backend)
229
- // @complexity: medium
230
- // Primary failure mode: undo banner appears but the dismissed card is not restored
231
- // Proof obligation: assert browser-visible state before dismissal, after dismissal, and after undo using fixture-controlled backend state
232
- [Test: 'User Journey: Dismiss and undo restores the card']
226
+ //
227
+ // User Journey: Dismiss card -> Undo banner appears -> Undo restores card
228
+ // Value Score: 60 | Business Value: 6 | Frequency: 7 | Defect Detection: 8
229
+ // Verification: Browser-visible state transitions with mocked backend state
230
+ // @category: fixture-e2e
231
+ // @lane: fixture-e2e
232
+ // @dependency: full-ui (mocked backend)
233
+ // @complexity: medium
234
+ // Primary failure mode: undo banner appears but the dismissed card is not restored
235
+ // Proof obligation: assert browser-visible state before dismissal, after dismissal, and after undo using fixture-controlled backend state
236
+ // Verification items:
237
+ // - Card is visible before dismissal
238
+ // - Undo banner is visible after dismissal
239
+ // - Card is restored after undo
233
240
  ```
234
241
 
235
242
  ### service-integration-e2e Test File
@@ -239,72 +246,30 @@ Adapt comment syntax to the project's language when generating annotations.
239
246
  // Generated: [date] | Budget Used: 1/2 service-integration-e2e
240
247
  // Test Type: End-to-end against running local stack
241
248
  // Implementation Timing: Final phase only
242
-
243
- [Import statement using detected test framework]
244
-
245
- [Test suite using detected framework syntax]
246
- // User Journey: Complete purchase flow (browse -> checkout -> payment -> confirmation persisted)
247
- // Value Score: 120 | Business Value: 10 (business-critical) | Frequency: 10 (core flow) | Legal: true
248
- // Verification: Order persists in DB and confirmation event is emitted
249
- // @category: service-integration-e2e
250
- // @lane: service-integration-e2e
251
- // @dependency: full-system
252
- // @complexity: high
253
- // Primary failure mode: checkout appears successful but the persisted order or confirmation event is missing
254
- // Proof obligation: exercise the full local service stack and assert persisted order state plus confirmation event after checkout
255
- [Test: 'User Journey: Complete product purchase persists order and emits confirmation']
249
+ //
250
+ // User Journey: Complete purchase flow (browse -> checkout -> payment -> confirmation persisted)
251
+ // Value Score: 120 | Business Value: 10 (business-critical) | Frequency: 10 (core flow) | Legal: true
252
+ // Verification: Order persists in DB and confirmation event is emitted
253
+ // @category: service-integration-e2e
254
+ // @lane: service-integration-e2e
255
+ // @dependency: full-system
256
+ // @complexity: high
257
+ // Primary failure mode: checkout appears successful but the persisted order or confirmation event is missing
258
+ // Proof obligation: exercise the full local service stack and assert persisted order state plus confirmation event after checkout
259
+ // Verification items:
260
+ // - Checkout completes
261
+ // - Order row persists
262
+ // - Confirmation event is emitted
256
263
  ```
257
264
 
258
265
  ### Generation Report
259
266
 
260
267
  ```json
261
- {
262
- "status": "completed",
263
- "feature": "[feature name]",
264
- "generatedFiles": {
265
- "integration": "[path]/[feature].int.test.[ext]",
266
- "fixtureE2e": null,
267
- "serviceE2e": null
268
- },
269
- "budgetUsage": {
270
- "integration": "2/3",
271
- "fixtureE2e": "0/3",
272
- "serviceE2e": "0/2"
273
- },
274
- "e2eAbsenceReason": {
275
- "fixtureE2e": "all_e2e_candidates_below_threshold",
276
- "serviceE2e": "no_real_service_dependency"
277
- },
278
- "boundaryProofGaps": []
279
- }
268
+ {"status":"completed","feature":"[feature name]","generatedFiles":{"integration":"[path]/[feature].int.test.[ext]","fixtureE2e":null,"serviceE2e":null},"budgetUsage":{"integration":"2/3","fixtureE2e":"0/3","serviceE2e":"0/2"},"e2eAbsenceReason":{"fixtureE2e":"all_e2e_candidates_below_threshold","serviceE2e":"no_real_service_dependency"},"boundaryProofGaps":[]}
280
269
  ```
281
270
 
282
271
  ```json
283
- {
284
- "status": "completed",
285
- "feature": "[feature name]",
286
- "generatedFiles": {
287
- "integration": "[path]/[feature].int.test.[ext]",
288
- "fixtureE2e": "[path]/[feature].fixture.e2e.test.[ext]",
289
- "serviceE2e": "[path]/[feature].service.e2e.test.[ext]"
290
- },
291
- "budgetUsage": {
292
- "integration": "2/3",
293
- "fixtureE2e": "1/3",
294
- "serviceE2e": "1/2"
295
- },
296
- "e2eAbsenceReason": {
297
- "fixtureE2e": null,
298
- "serviceE2e": null
299
- },
300
- "boundaryProofGaps": [
301
- {
302
- "acId": "[AC-XXX]",
303
- "boundaryPath": "[branch/state/input/lifecycle/fallback/visibility path]",
304
- "reason": "budget_insufficient_for_boundary_proof"
305
- }
306
- ]
307
- }
272
+ {"status":"completed","feature":"[feature name]","generatedFiles":{"integration":"[path]/[feature].int.test.[ext]","fixtureE2e":"[path]/[feature].fixture.e2e.test.[ext]","serviceE2e":"[path]/[feature].service.e2e.test.[ext]"},"budgetUsage":{"integration":"2/3","fixtureE2e":"1/3","serviceE2e":"1/2"},"e2eAbsenceReason":{"fixtureE2e":null,"serviceE2e":null},"boundaryProofGaps":[{"acId":"[AC-XXX]","boundaryPath":"[branch/state/input/lifecycle/fallback/visibility path]","reason":"budget_insufficient_for_boundary_proof"}]}
308
273
  ```
309
274
 
310
275
  ## Test Meta Information Assignment