buildflow-dev 4.0.1 → 4.0.2

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.
@@ -1,102 +1,228 @@
1
1
  ---
2
2
  name: buildflow-plan
3
- description: Create a spec-traced, dependency-aware execution plan with the Architect agent
3
+ description: Spec-traced, dependency-reasoned, risk-sequenced execution plan with engineering review
4
4
  allowed-tools: Read, Write
5
5
  agent: architect
6
6
  ---
7
7
 
8
8
  # /buildflow-plan
9
9
 
10
- Create a detailed, phased execution plan. Every task traces back to an acceptance criterion. The Architect reads specs, maps dependencies, and groups work into parallel waves.
10
+ Creates a precise, dependency-reasoned execution plan. Every task traces to an Acceptance Criterion. Dependencies are explained, not just listed. Tasks are risk-sequenced and effort-estimated. An Engineering Review catches design problems before a single line of code is written.
11
11
 
12
- Run after `/buildflow-spec`. If specs don't exist, the Architect will ask you to create them first.
12
+ Run after `/buildflow-spec`. Refuses to plan without locked specs.
13
13
 
14
14
  ## Usage
15
15
  - `/buildflow-plan` — plan the next phase
16
- - `/buildflow-plan phase-2` — plan a specific phase
17
- - `/buildflow-plan <feature>`plan a specific feature
16
+ - `/buildflow-plan phase-2` — plan a specific named phase
17
+ - `/buildflow-plan --scaffold-first`Wave 0 creates all file stubs before implementation begins
18
+ - `/buildflow-plan --risk-first` — orders risky/uncertain tasks to the front of each wave (fail fast)
18
19
 
19
- ## Context Packet (load only these)
20
+ ## Context Packet
20
21
  - `.buildflow/specs/PRD.md`
21
22
  - `.buildflow/specs/TDD.md`
22
23
  - `.buildflow/specs/acceptance.md`
23
- - `.buildflow/memory/light.md` (phase, framework, spec_status fields only)
24
- - `.buildflow/codebase/MAP.md` (if exists — existing projects only)
25
- - `.buildflow/codebase/DEPENDENCIES.md` (if exists existing projects only)
24
+ - `.buildflow/codebase/MAP.md` (if exists)
25
+ - `.buildflow/codebase/GRAPH.md` (if exists — for dependency chain reasoning)
26
+ - `.buildflow/memory/light.md` (phase, framework, spec_status only)
26
27
 
27
28
  Do NOT load: full codebase, old phase plans, research files, retros.
28
29
 
30
+ ---
31
+
29
32
  ## Step 1: Validate Specs
30
- Check `.buildflow/specs/acceptance.md` exists and `spec_status: locked` in light.md.
31
- If missing: "Run `/buildflow-spec` first to define acceptance criteria before planning."
33
+ Check `spec_status: locked` in `light.md` and that `acceptance.md` exists.
34
+ If not: "Run `/buildflow-spec` first. No spec, no plan."
35
+
36
+ Read all ACs. Count: [N] features, [N] user stories, [N] ACs total.
37
+ Confirm: "Planning to satisfy [N] ACs across [N] features."
38
+
39
+ ---
40
+
41
+ ## Step 2: Component & Task Derivation
42
+ For each feature in PRD, derive the implementation tasks needed to satisfy its ACs:
43
+
44
+ For each task ask:
45
+ 1. What code needs to exist that doesn't exist yet?
46
+ 2. What existing code needs to change?
47
+ 3. What tests must be written to verify the linked ACs?
48
+
49
+ Map each task to its AC refs:
50
+ ```
51
+ Task: Create JWT auth middleware
52
+ AC refs: AC-001, AC-002, AC-003
53
+ Files: src/middleware/auth.ts (new), src/routes/index.ts (modify)
54
+ Type: NEW / MODIFY / TEST
55
+ ```
56
+
57
+ ---
32
58
 
33
- ## Step 2: Scope Confirmation
34
- Read all acceptance criteria (AC-001, AC-002, ...).
35
- Confirm: "I'll plan tasks to satisfy [N] acceptance criteria. Correct?"
59
+ ## Step 3: Dependency Reasoning
60
+ For each task, identify dependencies and explain WHY they exist:
36
61
 
37
- ## Step 3: Dependency Mapping
38
- For each AC, identify all components/tasks needed. For each task:
39
- - What does it depend on?
40
- - What depends on it?
41
- - Can it be built in parallel with other tasks?
62
+ ```
63
+ Task: Create login API route
64
+ Depends on: "Create auth middleware" — HARD dependency
65
+ Reason: Route cannot be registered until middleware exists; calling undefined throws at startup
66
+
67
+ Task: Write login integration tests
68
+ Depends on: "Create login API route" — HARD dependency
69
+ Reason: Tests call the live route; no route = test suite errors on import
70
+
71
+ Task: Create UI login form
72
+ Depends on: "Create login API route" — SOFT dependency
73
+ Reason: Form can be scaffolded independently; only needs real API for E2E tests
74
+ Can proceed in parallel if mocked: YES
75
+ ```
76
+
77
+ Dependency types:
78
+ - **HARD** — code fails to compile/run without the prerequisite
79
+ - **SOFT** — can proceed with a mock/stub; full integration requires prerequisite
80
+ - **EXTERNAL** — depends on env var, database, third-party API (flag for setup checklist)
42
81
 
43
- ## Step 4: Task Breakdown
44
- For each task:
82
+ Detect circular dependencies: if A → B → A exists, flag immediately and resolve before proceeding.
83
+
84
+ External dependency checklist (generated if any EXTERNAL deps found):
45
85
  ```
46
- Task: [name]
47
- AC refs: [AC-001, AC-003] which acceptance criteria this satisfies
48
- Description: [what it does]
49
- Depends on: [prerequisite tasks or "none"]
50
- Parallelizable: yes/no
51
- Complexity: low / medium / high
52
- Files affected: [list]
86
+ Before building, verify these exist:
87
+ - [ ] DATABASE_URL env var set
88
+ - [ ] [service] API key configured
89
+ - [ ] [schema] migration run
53
90
  ```
54
91
 
55
- Every AC must be covered by at least one task. Flag uncovered ACs before proceeding.
92
+ ---
93
+
94
+ ## Step 4: Effort Estimation
95
+ Estimate each task:
96
+ | Size | Meaning |
97
+ |------|---------|
98
+ | XS | < 30 min — config, type, single function |
99
+ | S | 30–90 min — single component or endpoint |
100
+ | M | 2–4 hrs — feature with tests |
101
+ | L | 4–8 hrs — complex feature, multiple components |
102
+ | XL | > 1 day — requires research or architectural decision |
103
+
104
+ Flag XL tasks: "This task is XL — consider splitting or running `/buildflow-think` first."
105
+
106
+ ---
56
107
 
57
108
  ## Step 5: Wave Planning
58
- Group tasks into parallel waves:
109
+
110
+ Group tasks into parallel waves based on HARD dependencies only (SOFT deps don't block):
111
+
59
112
  ```
60
- Wave 1 (parallel no dependencies):
61
- Task A [AC-001]
62
- Task B [AC-002]
113
+ Wave 0Scaffolding (if --scaffold-first)
114
+ Create empty file stubs for all new files
115
+ Purpose: Builders know what exists; no "file not found" errors mid-wave
116
+
117
+ Wave 1 — Foundation (parallel, no hard dependencies)
118
+ • Task A [AC-001] S NEW
119
+ • Task B [AC-NF-001] M NEW
63
120
 
64
- Wave 2 (parallel depends on Wave 1):
65
- • Task C [AC-001, AC-003]
66
- • Task D [AC-004]
121
+ Wave 2 — Core (parallel, hard-depends on Wave 1)
122
+ • Task C [AC-001, AC-002] M MODIFY
123
+ • Task D [AC-003] S NEW
67
124
 
68
- Wave 3 (depends on Wave 2):
69
- • Task E [AC-005]
125
+ Wave 3 — Integration (depends on Wave 2)
126
+ • Task E [AC-001–AC-003] M TEST
127
+ • Task F [AC-004] L NEW
128
+
129
+ Wave 4 — UI / E2E (depends on Wave 3)
130
+ • Task G [AC-005, AC-006] M NEW
131
+ • Task H [all ACs] L TEST
70
132
  ```
71
133
 
72
- ## Step 6: AC Coverage Check
73
- Verify every acceptance criterion from `acceptance.md` is referenced in at least one task.
74
- Report:
134
+ If `--risk-first`: within each wave, sort tasks by uncertainty/novelty (most uncertain first). This surfaces problems early before other wave tasks build on broken assumptions.
135
+
136
+ ---
137
+
138
+ ## Step 6: AC Coverage Verification
139
+ Every AC must be covered by at least one task. Report:
140
+
75
141
  ```
76
142
  AC Coverage
77
143
  ───────────
78
- AC-001 ✓ covered by Task A, Task C
79
- AC-002 ✓ covered by Task B
80
- AC-003 NOT COVERED add a task or flag as out of scope
144
+ AC-001 ✓ Task C, Task E
145
+ AC-002 ✓ Task C
146
+ AC-003 Task D, Task E
147
+ AC-004 ✓ Task F
148
+ AC-005 ✓ Task G
149
+ AC-006 ✓ Task G
150
+ AC-NF-001 ✓ Task B, Task H
151
+ Uncovered: NONE
152
+ ```
153
+
154
+ If any AC is uncovered: stop. "AC-[X] has no task. Add a task or explicitly mark it out of scope."
155
+
156
+ ---
157
+
158
+ ## Step 7: Engineering Review
159
+ Before writing the plan file, review the plan as an Engineering Lead:
160
+
161
+ **Over-engineering check:**
162
+ - Is any task adding abstraction layers not required by the ACs?
163
+ - Are there tasks that implement features "for future use" not in specs?
164
+ - Flag and remove.
165
+
166
+ **Under-engineering check:**
167
+ - Are there ACs that will be technically impossible to satisfy with the planned approach?
168
+ - Are there missing error handling tasks?
169
+ - Are tests planned for every non-trivial AC?
170
+
171
+ **Architecture smell check:**
172
+ - Does the plan introduce new patterns that conflict with `PATTERNS.md`?
173
+ - Does any task modify a HOTSPOT file? If yes, flag with: "⚠ This task touches [file] (risk: [N]) — verify test coverage before proceeding."
174
+ - Are there tasks that cross module boundaries inappropriately?
175
+
176
+ **Engineering Review Report:**
177
+ ```
178
+ Engineering Review
179
+ ──────────────────
180
+ Over-engineering: [list or NONE]
181
+ Under-engineering: [list or NONE]
182
+ Architecture: [conflicts or NONE]
183
+ Hotspot warnings: [files or NONE]
184
+ Verdict: APPROVED / NEEDS REVISION
81
185
  ```
82
186
 
83
- Do not write the plan if any AC is uncovered without explicit user confirmation to skip it.
187
+ If NEEDS REVISION: apply fixes, re-run review, then proceed.
188
+
189
+ ---
190
+
191
+ ## Step 8: Write Plan
192
+ Write `.buildflow/phases/[N]/PLAN.md`:
84
193
 
85
- ## Step 7: Risk Check
86
- Flag tasks that are:
87
- - High complexity
88
- - Touching security-sensitive code
89
- - Requiring external APIs or services
90
- - Not covered by existing tests
194
+ ```markdown
195
+ # Phase [N] Plan
196
+ **Goal:** [one sentence — what the user can DO after this phase that they can't do now]
197
+ **ACs:** [N] **Tasks:** [N] **Waves:** [N] **Est. total:** [sum of estimates]
198
+ **Engineering Review:** APPROVED
199
+
200
+ ## External Dependencies Checklist
201
+ - [ ] [item] — [how to verify]
202
+
203
+ ## Waves
204
+
205
+ ### Wave 1 — [theme]
206
+ | Task | ACs | Est | Type | Files |
207
+ |------|-----|-----|------|-------|
208
+ | [name] | AC-001 | S | NEW | src/... |
209
+
210
+ ### Wave 2 — [theme]
211
+ ...
212
+
213
+ ## AC → Task Traceability
214
+ | AC | Task(s) |
215
+ |----|---------|
216
+ | AC-001 | Task C, Task E |
217
+ ```
91
218
 
92
- ## Step 8: Save Plan
93
- Write to `.buildflow/phases/[N]/PLAN.md`.
94
- Update `state.md` with current phase number.
95
219
  Update `light.md`:
96
220
  ```yaml
97
221
  current_phase: [N]
98
- ac_count: [N]
99
222
  plan_status: ready
223
+ wave_count: [N]
224
+ task_count: [N]
225
+ est_total: [size]
100
226
  ```
101
227
 
102
- ## Token Budget: ~20K
228
+ ## Token Budget: ~22K
@@ -1,147 +1,251 @@
1
1
  ---
2
2
  name: buildflow-spec
3
- description: Generate formal PRD, Technical Design, and Acceptance Criteria before planning
3
+ description: Generate user-story-backed PRD, Technical Design, and Acceptance Criteria with self-critique pass
4
4
  allowed-tools: Read, Write, WebSearch
5
5
  agent: strategist
6
6
  ---
7
7
 
8
8
  # /buildflow-spec
9
9
 
10
- Spec-Driven Development layer. Produces three locked spec artifacts before any code is planned or written. The Architect, Builder, and Reviewer agents all reference these during execution.
10
+ Spec-Driven Development layer. Produces formally structured, self-critiqued spec artifacts before any code is planned or written. Every plan task, every build output, and every ship gate references these docs.
11
11
 
12
- Run this after `/buildflow-start` and before `/buildflow-plan`.
12
+ Run after `/buildflow-start`, before `/buildflow-plan`.
13
13
 
14
14
  ## Usage
15
- - `/buildflow-spec` — generate full spec from vision
15
+ - `/buildflow-spec` — full spec from vision
16
16
  - `/buildflow-spec prd` — regenerate PRD only
17
- - `/buildflow-spec tdd` — regenerate Technical Design only
18
- - `/buildflow-spec acceptance` — regenerate acceptance criteria only
19
- - `/buildflow-spec --review` — re-read and review existing specs without regenerating
17
+ - `/buildflow-spec tdd` — regenerate TDD only
18
+ - `/buildflow-spec acceptance` — regenerate ACs only
19
+ - `/buildflow-spec --fast` — minimal spec for small features (single screen / endpoint)
20
+ - `/buildflow-spec --review` — critique existing specs without regenerating
20
21
 
21
- ## Context Packet (load only these — nothing else)
22
+ ## Context Packet
22
23
  - `.buildflow/core/vision.md`
23
- - `.buildflow/memory/light.md` (summary fields only: app_name, framework, phase)
24
- - `.buildflow/specs/` (existing specs if regenerating)
24
+ - `.buildflow/codebase/PATTERNS.md` (if exists align spec with existing architecture)
25
+ - `.buildflow/memory/light.md` (app_name, framework, phase only)
26
+ - `.buildflow/specs/` (if regenerating)
25
27
 
26
- ## Step 1: Validate Vision Exists
28
+ ---
29
+
30
+ ## Step 1: Validate Vision
27
31
  Read `.buildflow/core/vision.md`.
28
- If empty or missing: "Run /buildflow-start first to capture the project vision."
32
+ If empty: "Run `/buildflow-start` first."
29
33
 
30
- ## Step 2: Clarify Ambiguities
31
- Before writing specs, ask only questions that are unanswered in vision.md:
32
- - What does success look like for the user? (measurable outcome, not a feature)
33
- - What is explicitly OUT of scope for this phase?
34
- - Are there known constraints? (tech stack lock-in, deadline, budget, team size)
35
- - Any third-party integrations required?
34
+ If `PATTERNS.md` exists: note the existing architectural style (component structure, naming, API patterns).
35
+ The TDD must align with these don't invent new patterns unless explicitly asked.
36
36
 
37
- Ask all questions at once. Do not ask one at a time.
38
- Maximum 5 questions. Skip any already answered in vision.md.
37
+ ---
38
+
39
+ ## Step 2: Clarify (one round, all questions at once)
40
+ Ask only what vision.md left unanswered. Max 5 questions:
41
+ - What does success look like for the **user** — as a measurable outcome, not a feature list?
42
+ - What is explicitly **out of scope** this phase?
43
+ - Any **hard constraints**: tech stack, deadline, team size, compliance?
44
+ - Any **third-party integrations** required?
45
+ - If `--fast`: "Describe the single feature in one sentence."
46
+
47
+ ---
39
48
 
40
49
  ## Step 3: Generate PRD
41
50
  Write `.buildflow/specs/PRD.md`:
42
51
 
43
52
  ```markdown
44
53
  # Product Requirements Document
45
- **App:** [name] **Phase:** [N] **Date:** [today]
54
+ **App:** [name] **Phase:** [N] **Date:** [today] **Status:** DRAFT
46
55
 
47
56
  ## Problem Statement
48
- [One paragraph: what problem exists, who has it, why current solutions fail]
57
+ [One paragraph. Must answer: what exists today that's broken/missing, who suffers, why current solutions fail.]
49
58
 
50
- ## Users
51
- | User Type | Goal | Key Pain Point |
52
- |-----------|------|----------------|
53
- | [type] | [goal] | [pain] |
59
+ ## Users & Goals
60
+ | User Type | Job-to-be-Done | Current Pain |
61
+ |-----------|----------------|--------------|
62
+ | [type] | [goal — verb phrase] | [specific friction today] |
63
+
64
+ ## User Stories
65
+ | ID | Story | Acceptance Signal |
66
+ |----|-------|------------------|
67
+ | US-01 | As a [user], I want [goal] so that [outcome] | [one-line measurable signal] |
68
+ | US-02 | ... | ... |
54
69
 
55
70
  ## Features — In Scope
56
- | ID | Feature | Priority | Success Metric |
57
- |----|---------|----------|----------------|
58
- | F-01 | [name] | Must-have / Should-have / Nice-to-have | [measurable] |
71
+ | ID | Feature | Linked Stories | Priority | Success Metric |
72
+ |----|---------|---------------|----------|----------------|
73
+ | F-01 | [name] | US-01, US-02 | Must / Should / Could | [number or binary] |
59
74
 
60
- ## Out of Scope
61
- - [what we are explicitly NOT building this phase]
75
+ ## Explicitly Out of Scope
76
+ - [item] reason: [why excluded this phase]
62
77
 
63
78
  ## Constraints
64
- - [tech, timeline, team, budget constraints]
65
-
66
- ## Success Criteria
67
- Phase is complete when:
68
- - [ ] [measurable outcome 1]
69
- - [ ] [measurable outcome 2]
79
+ | Type | Constraint |
80
+ |------|-----------|
81
+ | Tech | [stack lock-in, version requirements] |
82
+ | Timeline | [deadline if any] |
83
+ | Compliance | [GDPR, HIPAA, accessibility level, etc.] |
84
+ | Team | [size, skills] |
85
+
86
+ ## Phase Complete When
87
+ - [ ] [measurable outcome — must map to a Success Metric above]
70
88
  ```
71
89
 
72
- ## Step 4: Generate Technical Design Doc
90
+ ---
91
+
92
+ ## Step 4: Generate TDD
73
93
  Write `.buildflow/specs/TDD.md`:
74
94
 
95
+ If `PATTERNS.md` exists: components and API shapes must follow existing conventions.
96
+
75
97
  ```markdown
76
98
  # Technical Design Document
77
- **App:** [name] **Phase:** [N] **Date:** [today]
99
+ **App:** [name] **Phase:** [N] **Date:** [today] **Status:** DRAFT
78
100
 
79
101
  ## Architecture Overview
80
- [Brief description of the system architecture]
102
+ [2–3 sentences. What components exist, how they communicate, what changes this phase.]
81
103
 
82
- ## Components
83
- | Component | Responsibility | Interface |
84
- |-----------|---------------|-----------|
85
- | [name] | [what it does] | [API / function / event] |
104
+ ## Component Map
105
+ | Component | Responsibility | Linked Feature | Interface Type |
106
+ |-----------|---------------|----------------|----------------|
107
+ | [name] | [single responsibility] | F-01 | REST / gRPC / event / function |
86
108
 
87
- ## Data Model
88
- [Key entities and their relationships use simple table or diagram]
109
+ ## Data Model Changes
110
+ | Entity | Fields Added/Changed | Reason |
111
+ |--------|---------------------|--------|
112
+ | [entity] | [field: type] | [F-01] |
89
113
 
90
114
  ## API Contracts
91
- | Endpoint / Function | Input | Output | Auth Required |
92
- |--------------------|-------|--------|---------------|
93
- | [name] | [type] | [type] | yes/no |
115
+ | Endpoint / Function | Method | Request Shape | Response Shape | Status Codes | Auth |
116
+ |--------------------|--------|---------------|----------------|-------------|------|
117
+ | /api/[path] | POST | `{ field: type }` | `{ field: type }` | 200, 400, 401, 500 | yes/no |
118
+
119
+ ## Error Response Format
120
+ All errors follow:
121
+ ```json
122
+ { "error": { "code": "ERROR_CODE", "message": "human readable", "field": "optional" } }
123
+ ```
94
124
 
95
125
  ## Technology Decisions
96
- | Decision | Choice | Reason | Alternatives Rejected |
97
- |----------|--------|--------|----------------------|
98
- | [area] | [choice] | [why] | [what else was considered] |
126
+ | Decision | Choice | Rationale | Alternatives Rejected | Reversibility |
127
+ |----------|--------|-----------|----------------------|--------------|
128
+ | [area] | [choice] | [why — cite constraint or principle] | [what else, why not] | easy / hard |
129
+
130
+ ## Non-Functional Requirements
131
+ | Type | Requirement | Measurement Method |
132
+ |------|------------|-------------------|
133
+ | Performance | [endpoint] responds in < [Nms] at [N] rps | Load test / APM |
134
+ | Security | [specific requirement — not "secure"] | Audit / pen test |
135
+ | Accessibility | WCAG [2.1 AA / 2.1 AAA] | Automated + manual |
136
+ | Availability | [N]% uptime | Monitoring |
137
+ | Data retention | [N] days | Automated policy |
99
138
 
100
139
  ## Known Risks
101
- | Risk | Likelihood | Impact | Mitigation |
102
- |------|-----------|--------|-----------|
103
- | [risk] | low/med/high | low/med/high | [how to mitigate] |
140
+ | Risk | Likelihood | Impact | Mitigation | Owner |
141
+ |------|-----------|--------|-----------|-------|
142
+ | [risk] | low/med/high | low/med/high | [concrete action] | dev / PM / ops |
104
143
  ```
105
144
 
145
+ ---
146
+
106
147
  ## Step 5: Generate Acceptance Criteria
107
148
  Write `.buildflow/specs/acceptance.md`:
108
149
 
109
- Each AC must be:
110
- - **Testable**a human or automated test can verify it
111
- - **Binary**pass or fail, no partial credit
112
- - **Specific** — no vague terms like "works correctly"
150
+ **Rules for every AC:**
151
+ - Binarypass or fail only, no partial credit
152
+ - Testablean automated test or explicit manual step can verify it
153
+ - Specific — no vague words (see Critic pass below)
154
+ - Covers both happy path AND at least one failure/edge case per feature
113
155
 
114
156
  ```markdown
115
157
  # Acceptance Criteria
116
158
  **App:** [name] **Phase:** [N] **Date:** [today]
117
159
 
118
- ## [Feature F-01 name]
119
- - AC-001: Given [context], when [action], then [outcome]
120
- - AC-002: Given [context], when [action], then [outcome]
160
+ ## [Feature F-01: name] → US-01, US-02
161
+ **Happy path:**
162
+ - AC-001: Given [setup state], when [user/system action], then [exact observable outcome]
163
+ - AC-002: Given [...], when [...], then [...]
121
164
 
122
- ## [Feature F-02 name]
123
- - AC-003: Given [context], when [action], then [outcome]
165
+ **Failure / edge cases (required — minimum 1 per feature):**
166
+ - AC-003: Given [invalid/boundary/error input], when [...], then [specific error behavior]
167
+ - AC-004: Given [concurrent/race/timeout scenario], when [...], then [...]
168
+
169
+ ## [Feature F-02: name] → US-03
170
+ - AC-005: Given [...], when [...], then [...]
171
+ - AC-006 (edge): Given [...], when [...], then [...]
124
172
 
125
173
  ## Non-Functional
126
- - AC-NF-001: [performance/security/accessibility requirement]
174
+ - AC-NF-001: [endpoint] under [N] concurrent users responds within [Nms] (p95)
175
+ - AC-NF-002: [page/flow] achieves WCAG 2.1 AA with zero automated violations
176
+ - AC-NF-003: No secrets present in committed code (automated scan passes)
127
177
  ```
128
178
 
129
- ## Step 6: Spec Review Gate
130
- Show a summary of all three specs. Ask:
179
+ ---
131
180
 
132
- > "Do these specs accurately capture what you want to build? (yes / revise [area])"
181
+ ## Step 6: Spec Critic Pass (automatic runs before showing user)
133
182
 
134
- - If yes: lock specs. Update `light.md`:
183
+ Before presenting specs to the user, self-review all three docs as a Spec Critic:
184
+
185
+ ### Vague Language Scan
186
+ Search every AC for these banned words. Flag any found:
187
+ `correctly` `properly` `works` `fast` `quickly` `slow` `good` `bad` `easy` `easily`
188
+ `should` `appropriate` `reasonable` `nice` `clean` `simple` `obvious` `intuitive`
189
+
190
+ For each flagged word: replace with a specific, measurable alternative or mark `[NEEDS SPECIFICITY]`.
191
+
192
+ ### Coverage Check
193
+ - Every feature in PRD has at least 2 ACs (1 happy + 1 error/edge) — flag if not
194
+ - Every user story US-XX is referenced in at least one AC's feature section — flag orphans
195
+ - Every component in TDD maps to at least one PRD feature — flag orphans
196
+ - Every NFR in TDD has a corresponding AC-NF — flag gaps
197
+
198
+ ### Testability Check
199
+ For each AC, verify it can be answered as a pass/fail automated test or explicit manual step.
200
+ Flag any AC that requires human judgment to evaluate.
201
+
202
+ ### Consistency Check
203
+ - API contracts in TDD match any referenced endpoints in ACs
204
+ - Data model changes in TDD are sufficient to support all AC outcomes
205
+ - Technology decisions don't contradict any constraints in PRD
206
+
207
+ ### Critic Report
208
+ Show the user:
209
+ ```
210
+ Spec Critic Report
211
+ ──────────────────
212
+ Vague language: [N found — fixed N, flagged N]
213
+ Coverage gaps: [list any orphaned features/stories/components]
214
+ Testability: [list any ACs needing rework]
215
+ Consistency: [any TDD/PRD conflicts]
216
+ Overall quality: STRONG / NEEDS REVISION
217
+ ```
218
+
219
+ ---
220
+
221
+ ## Step 7: User Review Gate
222
+ Show summary of all three specs + Critic Report. Ask:
223
+
224
+ > "Specs ready for review. Critic score: [STRONG / NEEDS REVISION]
225
+ > Approve to lock, or tell me what to revise."
226
+
227
+ - **Approve:** lock specs. Update `light.md`:
135
228
  ```yaml
136
229
  spec_status: locked
137
230
  spec_phase: [N]
138
231
  ac_count: [N]
232
+ us_count: [N]
233
+ spec_critic: strong/revised
139
234
  ```
140
- - If revise: ask what's wrong, update the relevant section, repeat Step 6.
235
+ - **Revise:** apply changes to the named section, re-run Critic pass, repeat Step 7.
141
236
 
142
- Do not proceed until the user approves.
237
+ Do not proceed until user approves.
143
238
 
144
- ## Step 7: Next Step
145
- "Specs locked. Run `/buildflow-plan` — the Architect will map tasks to your acceptance criteria."
239
+ ---
240
+
241
+ ## --fast Mode
242
+ For single-feature additions:
243
+ - Skip User Stories table (inline in feature row)
244
+ - Skip Technology Decisions (use existing stack)
245
+ - Generate 3 ACs minimum: 1 happy + 1 error + 1 NFR
246
+ - Skip Critic coverage check (only vague language scan)
247
+ - Token budget: ~8K
248
+
249
+ ---
146
250
 
147
- ## Token Budget: ~18K
251
+ ## Token Budget: ~20K (full) / ~8K (--fast)