@atlashub/smartstack-cli 1.34.0 → 1.35.0

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 (56) hide show
  1. package/.documentation/installation.html +56 -31
  2. package/dist/index.js +1098 -582
  3. package/dist/index.js.map +1 -1
  4. package/package.json +1 -1
  5. package/templates/agents/docs-context-reader.md +125 -0
  6. package/templates/agents/docs-sync-checker.md +122 -0
  7. package/templates/hooks/docs-drift-check.md +97 -0
  8. package/templates/skills/_resources/context-digest-template.md +53 -0
  9. package/templates/skills/_resources/doc-context-cache.md +62 -0
  10. package/templates/skills/_resources/docs-manifest-schema.md +157 -0
  11. package/templates/skills/_resources/mcp-validate-documentation-spec.md +183 -0
  12. package/templates/skills/_shared.md +8 -0
  13. package/templates/skills/apex/SKILL.md +6 -0
  14. package/templates/skills/apex/steps/step-00-init.md +9 -0
  15. package/templates/skills/apex/steps/step-01-analyze.md +36 -0
  16. package/templates/skills/apex/steps/step-02-plan.md +38 -0
  17. package/templates/skills/apex/steps/step-03-execute.md +39 -0
  18. package/templates/skills/apex/steps/step-04-validate.md +31 -1
  19. package/templates/skills/apex/steps/step-04b-doc-sync.md +162 -0
  20. package/templates/skills/apex/steps/step-05-examine.md +7 -0
  21. package/templates/skills/apex/templates/04b-doc-sync.md +31 -0
  22. package/templates/skills/apex/templates/context-digest.md +35 -0
  23. package/templates/skills/business-analyse/SKILL.md +18 -5
  24. package/templates/skills/business-analyse/_shared.md +306 -4
  25. package/templates/skills/business-analyse/questionnaire/01-context.md +21 -6
  26. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +34 -0
  27. package/templates/skills/business-analyse/questionnaire/03-scope.md +23 -0
  28. package/templates/skills/business-analyse/questionnaire/04-data.md +44 -0
  29. package/templates/skills/business-analyse/questionnaire/05-integrations.md +29 -7
  30. package/templates/skills/business-analyse/questionnaire/06-security.md +28 -0
  31. package/templates/skills/business-analyse/questionnaire/07-ui.md +32 -7
  32. package/templates/skills/business-analyse/questionnaire/08-performance.md +21 -0
  33. package/templates/skills/business-analyse/questionnaire/09-constraints.md +29 -6
  34. package/templates/skills/business-analyse/questionnaire/10-documentation.md +27 -6
  35. package/templates/skills/business-analyse/questionnaire/11-data-lifecycle.md +59 -0
  36. package/templates/skills/business-analyse/questionnaire/12-migration.md +58 -0
  37. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +69 -0
  38. package/templates/skills/business-analyse/steps/step-00-init.md +110 -16
  39. package/templates/skills/business-analyse/steps/step-01-discover.md +530 -85
  40. package/templates/skills/business-analyse/steps/step-02-analyse.md +81 -25
  41. package/templates/skills/business-analyse/steps/step-03-specify.md +116 -24
  42. package/templates/skills/business-analyse/steps/step-04-validate.md +107 -33
  43. package/templates/skills/business-analyse/steps/step-05-handoff.md +256 -33
  44. package/templates/skills/business-analyse/steps/step-06-doc-html.md +84 -25
  45. package/templates/skills/business-analyse/templates/{frd-handoff.md → tpl-handoff.md} +18 -4
  46. package/templates/skills/business-analyse/templates-frd.md +19 -5
  47. package/templates/skills/business-analyse/tracking/change-template.md +30 -0
  48. package/templates/skills/documentation/SKILL.md +68 -31
  49. package/templates/skills/documentation/data-schema.md +198 -0
  50. package/templates/skills/documentation/templates.md +30 -1
  51. package/templates/skills/gitflow/steps/step-init.md +128 -1
  52. package/templates/skills/gitflow/templates/config.json +7 -0
  53. package/templates/skills/ralph-loop/SKILL.md +3 -0
  54. /package/templates/skills/business-analyse/templates/{frd-brd.md → tpl-brd.md} +0 -0
  55. /package/templates/skills/business-analyse/templates/{frd-discovery.md → tpl-discovery.md} +0 -0
  56. /package/templates/skills/business-analyse/templates/{frd-spec.md → tpl-frd.md} +0 -0
@@ -1,25 +1,21 @@
1
1
  ---
2
2
  name: step-02-analyse
3
3
  description: Analysis phase - BRD formalization with business rules
4
- model: sonnet
5
- prev_step: steps/step-01-discover.md
6
4
  next_step: steps/step-03-specify.md
7
5
  ---
8
6
 
9
- <objective>
7
+ ## YOUR TASK:
8
+
10
9
  Transform discovery findings into a formal Business Requirements Document (BRD).
11
10
  Identify and formalize all business rules with BR-XXX identifiers.
12
- </objective>
13
11
 
14
- <ultrathink>
15
- ULTRATHINK MODE - Business Rule Formalization:
16
- - Extract IMPLICIT rules from discovery responses
17
- - Challenge completeness of each rule
18
- - Verify no rule contradicts another
19
- - Ensure rules are testable
20
- </ultrathink>
12
+ > **ULTRATHINK MODE:**
13
+ > - Extract IMPLICIT rules from discovery responses
14
+ > - Challenge completeness of each rule
15
+ > - Verify no rule contradicts another
16
+ > - Ensure rules are testable
21
17
 
22
- ## EXECUTION SEQUENCE
18
+ ## EXECUTION SEQUENCE:
23
19
 
24
20
  ### 1. Read Current State
25
21
 
@@ -28,12 +24,16 @@ Read `{output_dir}/1-discovery.md` for discovery findings.
28
24
 
29
25
  Update progress: `02-analyse` -> "In Progress"
30
26
 
27
+ **Read digest from previous step:**
28
+ Read `{output_dir}/digest-01.md` for compressed context from previous step.
29
+ **DO NOT read full output files** unless in resume mode (`-r`).
30
+
31
31
  ---
32
32
 
33
33
  ### 2. Load BRD Template
34
34
 
35
35
  ```
36
- Read: templates/frd-brd.md # ~90 lines only (vs 477 lines full template)
36
+ Read: templates/tpl-brd.md # ~90 lines only (vs 477 lines full template)
37
37
  ```
38
38
 
39
39
  This template contains ONLY the BRD structure, not FRD or Handoff.
@@ -141,6 +141,10 @@ Identify:
141
141
  - All entities from discovery captured?
142
142
  - Relationships are complete?
143
143
  - No orphan entities?
144
+ - **RBAC CHECK:** No role/permission/access-level modeled as entity attribute?
145
+ - `User.Role`, `User.AccessLevel`, `User.IsAdmin` = **FORBIDDEN**
146
+ - Roles are SmartStack RBAC permission sets, not data model concepts
147
+ - If stakeholders described roles, they belong in the Permission Matrix (step-03), not here
144
148
 
145
149
  ---
146
150
 
@@ -159,7 +163,7 @@ For each integration, note:
159
163
 
160
164
  ### 9. Compile BRD Document
161
165
 
162
- Assemble using `templates/frd-brd.md` structure:
166
+ Assemble using `templates/tpl-brd.md` structure:
163
167
 
164
168
  ```markdown
165
169
  # BRD - {feature_id} {feature_description}
@@ -200,6 +204,40 @@ Assemble using `templates/frd-brd.md` structure:
200
204
 
201
205
  ---
202
206
 
207
+ ### 9b. Generate Context Digest
208
+
209
+ **Write digest to:** `{output_dir}/digest-02.md`
210
+
211
+ ```markdown
212
+ # Digest: Step 02 - Analyse
213
+
214
+ ## Changes
215
+ - {output_dir}/2-business-requirements.md: BRD created
216
+
217
+ ## Decisions
218
+ - {count} business objectives formalized
219
+ - {count} business rules identified (categories: VAL, CALC, WF, SEC, DATA)
220
+
221
+ ## Findings
222
+ - {count} entities with {count} total attributes
223
+ - {count} integrations identified
224
+ - Process flow: {summary of main flow}
225
+
226
+ ## State Updates
227
+ | Variable | New Value |
228
+ |----------|-----------|
229
+ | br_count | {count} |
230
+ | entity_count | {count} |
231
+ | integration_count | {count} |
232
+
233
+ ## For Next Step
234
+ - BR-IDs to trace: {list of BR-IDs}
235
+ - Entities to specify: {list}
236
+ - Permission paths needed for: {list of entities}
237
+ ```
238
+
239
+ ---
240
+
203
241
  ### 10. Save Output
204
242
 
205
243
  Write to: `{output_dir}/2-business-requirements.md`
@@ -213,16 +251,18 @@ Update `00-context.md`:
213
251
  ### 11. Display Summary and Load Next Step
214
252
 
215
253
  **Display:**
216
- ```
217
- ANALYSE - {feature_id}
218
- ├── Status: Complete
219
- ├── Objectives: {OBJ count}
220
- ├── Business Rules: {BR count}
221
- ├── Entities: {entity count}
222
- ├── Integrations: {integration count}
223
- ├── Output: {output_dir}/2-business-requirements.md
224
- └── Next: step-03-specify (FRD + Use Cases)
225
- ```
254
+
255
+ | Field | Value |
256
+ |-------|-------|
257
+ | Step | ANALYSE |
258
+ | Feature | {feature_id} |
259
+ | Status | Complete |
260
+ | Objectives | {OBJ count} |
261
+ | Business Rules | {BR count} |
262
+ | Entities | {entity count} |
263
+ | Integrations | {integration count} |
264
+ | Output | {output_dir}/2-business-requirements.md |
265
+ | Next | step-03-specify (FRD + Use Cases) |
226
266
 
227
267
  **If NOT auto_mode:**
228
268
  Ask: "Proceed with functional specification?"
@@ -234,10 +274,26 @@ Read and execute: steps/step-03-specify.md
234
274
 
235
275
  ---
236
276
 
237
- ## OUTPUT
277
+ ## OUTPUT FORMAT:
238
278
 
239
279
  This step produces:
240
280
  - `{output_dir}/2-business-requirements.md` (created)
241
281
  - `{output_dir}/00-context.md` (updated)
242
282
 
243
283
  Template loaded: **~90 lines** (vs 477 lines full file)
284
+
285
+ ## ERROR HANDLING:
286
+
287
+ **If discovery document is incomplete:**
288
+ 1. List missing sections
289
+ 2. Ask user: "Return to discovery to complete, or proceed with available data?"
290
+ 3. If proceeding: mark BRD sections with "[INCOMPLETE - based on partial discovery]"
291
+
292
+ **If business rules contradict each other:**
293
+ 1. Identify conflicting rules (BR-XXX vs BR-YYY)
294
+ 2. Ask user to resolve contradiction via AskUserQuestion
295
+ 3. Document resolution in BRD
296
+
297
+ ## NEXT STEP:
298
+
299
+ After completion, proceed to `steps/step-03-specify.md`
@@ -1,29 +1,25 @@
1
1
  ---
2
2
  name: step-03-specify
3
3
  description: Specification phase - FRD with use cases, requirements, permissions
4
- model: sonnet
5
- prev_step: steps/step-02-analyse.md
6
4
  next_step: steps/step-04-validate.md
7
5
  ---
8
6
 
9
- <objective>
7
+ ## YOUR TASK:
8
+
10
9
  Create comprehensive Functional Requirements Document (FRD) with:
11
10
  - Use Cases (UC-XXX)
12
11
  - Functional Requirements (FR-XXX)
13
12
  - Permission matrix
14
13
  - UI wireframes
15
14
  - Gherkin scenarios
16
- </objective>
17
15
 
18
- <ultrathink>
19
- ULTRATHINK MODE - Specification:
20
- - Each UC must be atomic and testable
21
- - FR must trace back to BR
22
- - Permissions must follow SmartStack convention
23
- - No ambiguity in scenarios
24
- </ultrathink>
16
+ > **ULTRATHINK MODE:**
17
+ > - Each UC must be atomic and testable
18
+ > - FR must trace back to BR
19
+ > - Permissions must follow SmartStack convention
20
+ > - No ambiguity in scenarios
25
21
 
26
- ## EXECUTION SEQUENCE
22
+ ## EXECUTION SEQUENCE:
27
23
 
28
24
  ### 1. Read Current State
29
25
 
@@ -32,12 +28,16 @@ Read `{output_dir}/2-business-requirements.md` for business rules.
32
28
 
33
29
  Update progress: `03-specify` -> "In Progress"
34
30
 
31
+ **Read digest from previous step:**
32
+ Read `{output_dir}/digest-02.md` for compressed context from previous step.
33
+ **DO NOT read full output files** unless in resume mode (`-r`).
34
+
35
35
  ---
36
36
 
37
37
  ### 2. Load FRD Template
38
38
 
39
39
  ```
40
- Read: templates/frd-spec.md # ~150 lines (UC + FR + permissions sections)
40
+ Read: templates/tpl-frd.md # ~150 lines (UC + FR + permissions sections)
41
41
  ```
42
42
 
43
43
  This template contains ONLY the FRD structure.
@@ -271,12 +271,86 @@ Feature: {feature_id} {feature_description}
271
271
 
272
272
  ---
273
273
 
274
+ ### 9b. Data Lifecycle & Cross-Module Specification (CONDITIONAL)
275
+
276
+ **Load ONLY if categories 11-13 were collected in discovery.**
277
+
278
+ #### If data lifecycle data collected (category 11):
279
+
280
+ | Entity | Retention Period | Archive Strategy | GDPR Impact | Base Class |
281
+ |--------|-----------------|-----------------|-------------|------------|
282
+ | {entity} | {duration} | {Archive/Purge/Anonymize} | {Yes/No + detail} | {SoftDeletableEntity/AuditableEntity} |
283
+
284
+ **State transitions:**
285
+
286
+ | Entity | States | Immutable After |
287
+ |--------|--------|-----------------|
288
+ | {entity} | {Draft -> Active -> Archived -> Deleted} | {state or "None"} |
289
+
290
+ #### If migration data collected (category 12):
291
+
292
+ | Source | Format | Volume | Quality Issues | Strategy |
293
+ |--------|--------|--------|----------------|----------|
294
+ | {source} | {Excel/CSV/DB/API} | {volume} | {issues} | {Big-bang/Progressive/Parallel} |
295
+
296
+ **Rollback plan:** {strategy from Q12.8}
297
+
298
+ #### If cross-module impact collected (category 13):
299
+
300
+ | Existing Module | Interaction Type | Shared Data | Impact on Existing |
301
+ |-----------------|-----------------|-------------|-------------------|
302
+ | {module} | {FK/Event/Query/Navigation} | {entities/data} | {None/Minor/Major} |
303
+
304
+ **MediatR events to create:**
305
+
306
+ | Event | Trigger | Consumers |
307
+ |-------|---------|-----------|
308
+ | {Entity}CreatedNotification | After create | {list of consuming modules} |
309
+
310
+ ---
311
+
274
312
  ### 10. Compile FRD Document
275
313
 
276
314
  Assemble complete FRD using template structure.
277
315
 
278
316
  ---
279
317
 
318
+ ### 10b. Generate Context Digest
319
+
320
+ **Write digest to:** `{output_dir}/digest-03.md`
321
+
322
+ ```markdown
323
+ # Digest: Step 03 - Specify
324
+
325
+ ## Changes
326
+ - {output_dir}/3-functional-specification.md: FRD created
327
+
328
+ ## Decisions
329
+ - {count} use cases defined
330
+ - {count} functional requirements (Must: X, Should: Y, Could: Z)
331
+ - Permission matrix: {count} permissions for {count} roles
332
+
333
+ ## Findings
334
+ - Gherkin scenarios: {count}
335
+ - i18n keys: {count}
336
+ - UI wireframes: {count}
337
+
338
+ ## State Updates
339
+ | Variable | New Value |
340
+ |----------|-----------|
341
+ | uc_count | {count} |
342
+ | fr_count | {count} |
343
+ | permission_count | {count} |
344
+ | scenario_count | {count} |
345
+
346
+ ## For Next Step
347
+ - Completeness checklist ready for validation
348
+ - All BR->FR traces established
349
+ - Permission matrix finalized
350
+ ```
351
+
352
+ ---
353
+
280
354
  ### 11. Save Output
281
355
 
282
356
  Write to: `{output_dir}/3-functional-specification.md`
@@ -290,16 +364,18 @@ Update `00-context.md`:
290
364
  ### 12. Display Summary and Load Next Step
291
365
 
292
366
  **Display:**
293
- ```
294
- SPECIFICATION - {feature_id}
295
- ├── Status: Complete
296
- ├── Use Cases: {UC count}
297
- ├── Requirements: {FR count} (Must: X, Should: Y, Could: Z)
298
- ├── Permissions: {permission count}
299
- ├── Gherkin scenarios: {scenario count}
300
- ├── Output: {output_dir}/3-functional-specification.md
301
- └── Next: step-04-validate (Validation Gate)
302
- ```
367
+
368
+ | Field | Value |
369
+ |-------|-------|
370
+ | Step | SPECIFICATION |
371
+ | Feature | {feature_id} |
372
+ | Status | Complete |
373
+ | Use Cases | {UC count} |
374
+ | Requirements | {FR count} (Must: X, Should: Y, Could: Z) |
375
+ | Permissions | {permission count} |
376
+ | Gherkin scenarios | {scenario count} |
377
+ | Output | {output_dir}/3-functional-specification.md |
378
+ | Next | step-04-validate (Validation Gate) |
303
379
 
304
380
  **Load next step:**
305
381
  ```
@@ -308,10 +384,26 @@ Read and execute: steps/step-04-validate.md
308
384
 
309
385
  ---
310
386
 
311
- ## OUTPUT
387
+ ## OUTPUT FORMAT:
312
388
 
313
389
  This step produces:
314
390
  - `{output_dir}/3-functional-specification.md` (created)
315
391
  - `{output_dir}/00-context.md` (updated)
316
392
 
317
393
  Template loaded: **~150 lines** (vs 477 lines full file)
394
+
395
+ ## ERROR HANDLING:
396
+
397
+ **If permission path format is invalid:**
398
+ 1. Validate with MCP: `mcp__smartstack__validate_conventions`
399
+ 2. If MCP unavailable: validate manually against pattern `business.{app}.{module}.{action}`
400
+ 3. Fix and re-generate permission matrix
401
+
402
+ **If BR has no corresponding FR:**
403
+ 1. Flag unmapped BR-IDs
404
+ 2. Create placeholder FR with "To be specified"
405
+ 3. Add to validation checklist for step-04
406
+
407
+ ## NEXT STEP:
408
+
409
+ After completion, proceed to `steps/step-04-validate.md`
@@ -1,17 +1,15 @@
1
1
  ---
2
2
  name: step-04-validate
3
3
  description: Validation gate - APPROVED or REJECTED decision
4
- model: haiku
5
- prev_step: steps/step-03-specify.md
6
4
  next_step: steps/step-05-handoff.md
7
5
  ---
8
6
 
9
- <objective>
7
+ ## YOUR TASK:
8
+
10
9
  Validate that all specifications are complete and consistent.
11
10
  Gate decision: APPROVED or REJECTED with reasons.
12
- </objective>
13
11
 
14
- ## EXECUTION SEQUENCE
12
+ ## EXECUTION SEQUENCE:
15
13
 
16
14
  ### 1. Read Current State
17
15
 
@@ -23,6 +21,10 @@ Read all previous outputs:
23
21
 
24
22
  Update progress: `04-validate` -> "In Progress"
25
23
 
24
+ **Read digest from previous step:**
25
+ Read `{output_dir}/digest-03.md` for compressed context from previous step.
26
+ **DO NOT read full output files** unless in resume mode (`-r`).
27
+
26
28
  ---
27
29
 
28
30
  ### 2. Completeness Checklist
@@ -88,7 +90,28 @@ INVALID: {app}.{module}.{action}
88
90
 
89
91
  ---
90
92
 
91
- ### 5. Risk Assessment
93
+ ### 5. Documentation Freshness Check
94
+
95
+ **If `docs-manifest.json` exists in project root:**
96
+
97
+ | Check | Expected | Status |
98
+ |-------|----------|--------|
99
+ | Module has manifest entry | Entry exists | {OK/MISSING} |
100
+ | Last doc update < 30 days from last code change | Within threshold | {OK/DRIFT} |
101
+ | All 8 business-first sections present | 8/8 | {X/8} |
102
+ | i18n FR complete (minimum) | All keys present | {OK/INCOMPLETE} |
103
+ | frd-data.ts exists | File present | {OK/MISSING} |
104
+
105
+ **If drift detected:**
106
+ - Add to validation report: `"documentationDrift": true`
107
+ - Add to issues: `"Documentation is {N} days behind code changes"`
108
+ - Severity: WARNING (non-blocking for BA validation)
109
+
110
+ **If `docs-manifest.json` absent:** Skip this section silently.
111
+
112
+ ---
113
+
114
+ ### 6. Risk Assessment
92
115
 
93
116
  | Risk | Severity | Mitigation |
94
117
  |------|----------|------------|
@@ -102,7 +125,7 @@ INVALID: {app}.{module}.{action}
102
125
 
103
126
  ---
104
127
 
105
- ### 6. Make Decision
128
+ ### 7. Make Decision
106
129
 
107
130
  **APPROVED if:**
108
131
  - All completeness checks pass (100%)
@@ -118,7 +141,42 @@ INVALID: {app}.{module}.{action}
118
141
 
119
142
  ---
120
143
 
121
- ### 7. Generate Validation Report
144
+ ### 8b. Generate Context Digest
145
+
146
+ **Write digest to:** `{output_dir}/digest-04.md`
147
+
148
+ ```markdown
149
+ # Digest: Step 04 - Validate
150
+
151
+ ## Changes
152
+ - {output_dir}/validation.json: Validation report created
153
+
154
+ ## Decisions
155
+ - Gate decision: {APPROVED/REJECTED}
156
+ - Completeness: {score}
157
+ - Consistency: {all checks status}
158
+
159
+ ## Findings
160
+ - Convention compliance: {status}
161
+ - Documentation drift: {status}
162
+ - Risks: {count} identified, {count} mitigated
163
+
164
+ ## State Updates
165
+ | Variable | New Value |
166
+ |----------|-----------|
167
+ | validation_status | {APPROVED/REJECTED} |
168
+ | completeness_score | {score} |
169
+ | risk_count | {count} |
170
+
171
+ ## For Next Step
172
+ - Validation: {APPROVED/REJECTED}
173
+ - If REJECTED: {list of issues to fix}
174
+ - If APPROVED: ready for handoff generation
175
+ ```
176
+
177
+ ---
178
+
179
+ ### 9. Generate Validation Report
122
180
 
123
181
  ```json
124
182
  {
@@ -166,7 +224,7 @@ INVALID: {app}.{module}.{action}
166
224
 
167
225
  ---
168
226
 
169
- ### 8. Save Output
227
+ ### 10. Save Output
170
228
 
171
229
  Write to: `{output_dir}/validation.json`
172
230
 
@@ -176,39 +234,39 @@ Update `00-context.md`:
176
234
 
177
235
  ---
178
236
 
179
- ### 9. Handle Decision
237
+ ### 11. Handle Decision
180
238
 
181
239
  **If APPROVED:**
182
240
 
183
241
  Display:
184
- ```
185
- VALIDATION - {feature_id}
186
- ├── Status: APPROVED
187
- ├── Completeness: 100%
188
- ├── Consistency: All checks passed
189
- ├── Conventions: SmartStack compliant
190
- ├── Risks: {count} mitigated
191
- ├── Output: {output_dir}/validation.json
192
- └── Next: step-05-handoff (Development prompt)
193
- ```
242
+
243
+ | Field | Value |
244
+ |-------|-------|
245
+ | Step | VALIDATION |
246
+ | Feature | {feature_id} |
247
+ | Status | APPROVED |
248
+ | Completeness | 100% |
249
+ | Consistency | All checks passed |
250
+ | Conventions | SmartStack compliant |
251
+ | Risks | {count} mitigated |
252
+ | Output | {output_dir}/validation.json |
253
+ | Next | step-05-handoff (Development prompt) |
194
254
 
195
255
  Load next step: `steps/step-05-handoff.md`
196
256
 
197
257
  **If REJECTED:**
198
258
 
199
259
  Display:
200
- ```
201
- VALIDATION - {feature_id}
202
- ├── Status: REJECTED
203
- ├── Issues found:
204
- │ ├── {issue 1}
205
- │ ├── {issue 2}
206
- │ └── {issue 3}
207
- ├── Required actions:
208
- │ ├── {action 1}
209
- │ └── {action 2}
210
- └── Next: Revise specifications
211
- ```
260
+
261
+ | Field | Value |
262
+ |-------|-------|
263
+ | Step | VALIDATION |
264
+ | Feature | {feature_id} |
265
+ | Status | REJECTED |
266
+ | Issues | {issue 1}, {issue 2}, {issue 3} |
267
+ | Action 1 | {action 1} |
268
+ | Action 2 | {action 2} |
269
+ | Next | Revise specifications |
212
270
 
213
271
  **Ask user:**
214
272
  ```json
@@ -230,10 +288,26 @@ VALIDATION - {feature_id}
230
288
 
231
289
  ---
232
290
 
233
- ## OUTPUT
291
+ ## OUTPUT FORMAT:
234
292
 
235
293
  This step produces:
236
294
  - `{output_dir}/validation.json` (created)
237
295
  - `{output_dir}/00-context.md` (updated)
238
296
 
239
297
  Gate decision enables or blocks next step.
298
+
299
+ ## ERROR HANDLING:
300
+
301
+ **If previous output files are missing:**
302
+ 1. List which files exist vs expected
303
+ 2. If partial: validate only available documents
304
+ 3. Add "Missing document" as CRITICAL issue in validation report
305
+
306
+ **If validation gate REJECTED:**
307
+ 1. Present issues to user with severity
308
+ 2. Offer: auto-revise / manual revision / force approval
309
+ 3. If auto-revise: loop back to the step that needs fixing
310
+
311
+ ## NEXT STEP:
312
+
313
+ After completion, proceed to `steps/step-05-handoff.md`