@anhth2/spec-driven-dev-plugin 0.5.0 → 0.7.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 (76) hide show
  1. package/ARCHITECTURE.md +1 -1
  2. package/bin/index.js +184 -15
  3. package/commands/debug.md +196 -10
  4. package/commands/debug.tmpl +170 -6
  5. package/commands/define-product.md +31 -5
  6. package/commands/define-product.tmpl +5 -1
  7. package/commands/fix-bug.md +74 -10
  8. package/commands/fix-bug.tmpl +48 -6
  9. package/commands/generate-bdd.md +49 -8
  10. package/commands/generate-bdd.tmpl +23 -4
  11. package/commands/generate-code.md +109 -18
  12. package/commands/generate-code.tmpl +83 -14
  13. package/commands/generate-prd.md +33 -6
  14. package/commands/generate-prd.tmpl +7 -2
  15. package/commands/generate-tech-docs.md +85 -8
  16. package/commands/generate-tech-docs.tmpl +59 -4
  17. package/commands/generate-tests.md +454 -36
  18. package/commands/generate-tests.tmpl +428 -32
  19. package/commands/refine-prd.md +39 -7
  20. package/commands/refine-prd.tmpl +13 -3
  21. package/commands/review-code.md +57 -5
  22. package/commands/review-code.tmpl +31 -1
  23. package/commands/review-context.md +41 -11
  24. package/commands/review-context.tmpl +15 -7
  25. package/commands/review-tech-docs.md +39 -8
  26. package/commands/review-tech-docs.tmpl +13 -4
  27. package/commands/run-tests.md +159 -17
  28. package/commands/run-tests.tmpl +133 -13
  29. package/commands/setup-ai-first.md +85 -9
  30. package/commands/setup-ai-first.tmpl +30 -8
  31. package/commands/smoke-test.md +191 -21
  32. package/commands/smoke-test.tmpl +165 -17
  33. package/commands/validate-traces.md +40 -7
  34. package/commands/validate-traces.tmpl +14 -3
  35. package/core/FRAMEWORK_VERSION +1 -1
  36. package/core/commands/debug.md +196 -10
  37. package/core/commands/define-product.md +31 -5
  38. package/core/commands/fix-bug.md +74 -10
  39. package/core/commands/generate-bdd.md +49 -8
  40. package/core/commands/generate-code.md +109 -18
  41. package/core/commands/generate-prd.md +33 -6
  42. package/core/commands/generate-tech-docs.md +85 -8
  43. package/core/commands/generate-tests.md +454 -36
  44. package/core/commands/refine-prd.md +39 -7
  45. package/core/commands/review-code.md +57 -5
  46. package/core/commands/review-context.md +41 -11
  47. package/core/commands/review-tech-docs.md +39 -8
  48. package/core/commands/run-tests.md +159 -17
  49. package/core/commands/setup-ai-first.md +85 -9
  50. package/core/commands/smoke-test.md +191 -21
  51. package/core/commands/validate-traces.md +40 -7
  52. package/core/skills/code/SKILL.md +29 -6
  53. package/core/skills/debug/SKILL.md +31 -7
  54. package/core/skills/discovery/SKILL.md +25 -3
  55. package/core/skills/prd/SKILL.md +8 -6
  56. package/core/skills/setup-ai-first/SKILL.md +3 -2
  57. package/core/skills/spec/SKILL.md +7 -5
  58. package/core/skills/test/SKILL.md +54 -9
  59. package/core/steps/context-loader.md +22 -1
  60. package/core/steps/gate.md +1 -1
  61. package/core/steps/report-footer.md +3 -2
  62. package/core/steps/spawn-agent.md +3 -1
  63. package/package.json +1 -1
  64. package/scripts/init.sh +2 -2
  65. package/scripts/upgrade.sh +4 -4
  66. package/skills/code/SKILL.md +29 -6
  67. package/skills/debug/SKILL.md +31 -7
  68. package/skills/discovery/SKILL.md +25 -3
  69. package/skills/prd/SKILL.md +8 -6
  70. package/skills/setup-ai-first/SKILL.md +3 -2
  71. package/skills/spec/SKILL.md +7 -5
  72. package/skills/test/SKILL.md +54 -9
  73. package/steps/context-loader.md +22 -1
  74. package/steps/gate.md +1 -1
  75. package/steps/report-footer.md +3 -2
  76. package/steps/spawn-agent.md +3 -1
@@ -31,7 +31,7 @@ Display and wait for response:
31
31
  ```
32
32
  ⚙️ MODEL CHECK
33
33
  ──────────────────────────────────────────────────────────────────
34
- Recommended : claude-opus-4-5 (or claude-opus-4)
34
+ Recommended : claude-opus-4 (or latest Opus model)
35
35
  Why needed : Spec analysis, architecture review, code generation
36
36
  require deep reasoning. Smaller models miss edge cases.
37
37
 
@@ -140,7 +140,7 @@ If `paths` section is absent, use these defaults:
140
140
  - `domain_knowledge_dir` = `specs/domain-knowledge`
141
141
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
142
142
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
143
- - `tech_docs_dir` = `tech-docs`
143
+ - `tech_docs_dir` = `specs/tech-docs`
144
144
  - `trace_dir` = `.trace`
145
145
 
146
146
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
@@ -217,6 +217,26 @@ If the file does not exist → skip silently.
217
217
 
218
218
  ---
219
219
 
220
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
221
+
222
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
223
+
224
+ ```
225
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
226
+ ```
227
+
228
+ | `platform_type` | Modules |
229
+ |---|---|
230
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
231
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
232
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
233
+
234
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
235
+
236
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (generate-tests, debug, fix-bug, smoke-test).
237
+
238
+ ---
239
+
220
240
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
221
241
 
222
242
  After loading all context, synthesize and output a compact summary block.
@@ -227,6 +247,7 @@ Output exactly this block:
227
247
  ```
228
248
  [CTX LOADED]
229
249
  Stack : {language} / {framework} / {database}
250
+ Platform : {active_module} ({platform_type})
230
251
  Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
231
252
  Ticket : {ticket_prefix}-
232
253
  Dict : {loaded — N canonical terms, M banned terms | missing}
@@ -324,6 +345,7 @@ Suggest the logical next command based on workflow phase:
324
345
 
325
346
  | Current command | Suggest next |
326
347
  |-------------------------|-----------------------------------------------|
348
+ | /setup-ai-first | `/define-product` to start your first feature |
327
349
  | /define-product | `/generate-prd {product-definition-file}` |
328
350
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
329
351
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -332,13 +354,13 @@ Suggest the logical next command based on workflow phase:
332
354
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
333
355
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
334
356
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
335
- | /generate-code | `/generate-tests {UC-ID}` |
357
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
336
358
  | /generate-tests | `/run-tests {UC-ID}` |
337
359
  | /run-tests (passing) | `/review-code {UC-ID}` |
338
360
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
339
361
  | /review-code | `/smoke-test {UC-ID}` or create PR |
340
362
  | /smoke-test | Create PR and link to ticket |
341
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
363
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
342
364
  | /fix-bug | Create PR and link to ticket |
343
365
  | /debug | `/fix-bug {ticket-id}` if fix needed |
344
366
 
@@ -355,7 +377,9 @@ Next : {suggested command with example arguments}
355
377
  /refine-prd Complete — {PRD name}
356
378
  Findings: {total} | 🔴 Critical: {N} | 🟡 Major: {N} | 🟢 Minor: {N}
357
379
  Review: {paths.refinement_dir}/{prd-slug}-findings.yaml
358
- Next: Open in Review Board (right-click file) → Update PRD → /generate-bdd
380
+ Next: Open in Review Board (right-click file) → Update PRD
381
+ → /review-context {prd-file} ← verify PRD quality before generating BDD
382
+ → /generate-bdd {prd-file}
359
383
  ```
360
384
 
361
385
  ---
@@ -374,9 +398,16 @@ Next: Open in Review Board (right-click file) → Update PRD → /generate-bdd
374
398
 
375
399
  For each accepted finding, in order of severity (critical → major → minor):
376
400
  - Navigate to the PRD section indicated by `finding.section`.
377
- - Apply `finding.suggestion` (or the note from `modified` status if applicable).
401
+ - Apply `finding.suggestion`. For `status: "modified"` findings, the human has already edited `finding.suggestion` in the Review Board — that edited value IS the fix to apply.
378
402
  - Do not alter any sections not referenced by an accepted finding.
379
403
 
404
+ ### Phase 2.5 — Update findings file
405
+
406
+ For each finding that was applied (status was `accepted` or `modified`):
407
+ - Set `status: "applied"` in `{paths.refinement_dir}/{prd-slug}-findings.yaml`.
408
+
409
+ Update `summary.status: "applied"` in the findings file.
410
+
380
411
  ### Phase 3 — Bump version & write changelog entry
381
412
 
382
413
  1. Read current `| **Version** |` value from PRD metadata table.
@@ -404,5 +435,6 @@ Changes :
404
435
  - {change 2}
405
436
 
406
437
  ⚠️ BDD may be outdated. Run:
407
- /generate-bdd {prd-file}
438
+ /review-context {prd-file} ← verify PRD quality first
439
+ → /generate-bdd {prd-file}
408
440
  ```
@@ -33,7 +33,7 @@ Display and wait for response:
33
33
  ```
34
34
  ⚙️ MODEL CHECK
35
35
  ──────────────────────────────────────────────────────────────────
36
- Recommended : claude-opus-4-5 (or claude-opus-4)
36
+ Recommended : claude-opus-4 (or latest Opus model)
37
37
  Why needed : Spec analysis, architecture review, code generation
38
38
  require deep reasoning. Smaller models miss edge cases.
39
39
 
@@ -142,7 +142,7 @@ If `paths` section is absent, use these defaults:
142
142
  - `domain_knowledge_dir` = `specs/domain-knowledge`
143
143
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
144
144
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
145
- - `tech_docs_dir` = `tech-docs`
145
+ - `tech_docs_dir` = `specs/tech-docs`
146
146
  - `trace_dir` = `.trace`
147
147
 
148
148
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
@@ -219,6 +219,26 @@ If the file does not exist → skip silently.
219
219
 
220
220
  ---
221
221
 
222
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
223
+
224
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
225
+
226
+ ```
227
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
228
+ ```
229
+
230
+ | `platform_type` | Modules |
231
+ |---|---|
232
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
233
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
234
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
235
+
236
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
237
+
238
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (generate-tests, debug, fix-bug, smoke-test).
239
+
240
+ ---
241
+
222
242
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
223
243
 
224
244
  After loading all context, synthesize and output a compact summary block.
@@ -229,6 +249,7 @@ Output exactly this block:
229
249
  ```
230
250
  [CTX LOADED]
231
251
  Stack : {language} / {framework} / {database}
252
+ Platform : {active_module} ({platform_type})
232
253
  Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
233
254
  Ticket : {ticket_prefix}-
234
255
  Dict : {loaded — N canonical terms, M banned terms | missing}
@@ -254,6 +275,26 @@ After completing all steps, you have loaded:
254
275
  Proceed to the next step of the calling command.
255
276
 
256
277
 
278
+ ---
279
+
280
+ ## Pre-Review Scan
281
+
282
+ *(Separate from the Gate CHECKPOINT — this lists the actual files and scenarios in scope.)*
283
+
284
+ Scan for implementation files and scenarios, then display:
285
+
286
+ ```
287
+ Review Scope — {UC-ID}
288
+ ──────────────────────────────────────
289
+ UC : {UC-ID}
290
+ Files : {list of files tagged @trace.implements={UC-ID}}
291
+ Scenarios : {N} scenarios in .feature file
292
+
293
+ Proceed with review? (Y/N)
294
+ ```
295
+
296
+ Wait for explicit "Y" before proceeding.
297
+
257
298
  ---
258
299
 
259
300
  ## Review Dimensions
@@ -262,7 +303,7 @@ Proceed to the next step of the calling command.
262
303
  - [ ] Every controller endpoint has `@trace.implements` tag?
263
304
  - [ ] Every test file has `@trace.verifies` tag?
264
305
  - [ ] No `@trace` tags on wrong layers?
265
- - [ ] `{paths.trace_dir}/{UC-ID}.tsv` up to date?
306
+ - [ ] `{paths.trace_dir}/{UC-ID}.tsv` up to date? (if stale → run `/validate-traces {UC-ID}` first, then re-run this review)
266
307
 
267
308
  ### 2. Layer Architecture (from CLAUDE.md §2)
268
309
  - [ ] Each class in the correct layer?
@@ -310,6 +351,7 @@ Suggest the logical next command based on workflow phase:
310
351
 
311
352
  | Current command | Suggest next |
312
353
  |-------------------------|-----------------------------------------------|
354
+ | /setup-ai-first | `/define-product` to start your first feature |
313
355
  | /define-product | `/generate-prd {product-definition-file}` |
314
356
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
315
357
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -318,13 +360,13 @@ Suggest the logical next command based on workflow phase:
318
360
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
319
361
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
320
362
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
321
- | /generate-code | `/generate-tests {UC-ID}` |
363
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
322
364
  | /generate-tests | `/run-tests {UC-ID}` |
323
365
  | /run-tests (passing) | `/review-code {UC-ID}` |
324
366
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
325
367
  | /review-code | `/smoke-test {UC-ID}` or create PR |
326
368
  | /smoke-test | Create PR and link to ticket |
327
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
369
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
328
370
  | /fix-bug | Create PR and link to ticket |
329
371
  | /debug | `/fix-bug {ticket-id}` if fix needed |
330
372
 
@@ -350,5 +392,15 @@ Critical: {X} | Major: {Y} | Minor: {Z}
350
392
  ### Minor
351
393
  | # | File | Line | Issue | Suggested Fix |
352
394
 
395
+ Output Artifacts: none (read-only)
396
+
353
397
  Verdict: APPROVED ✅ | NEEDS_FIX ❌
398
+
399
+ If APPROVED ✅:
400
+ Next: /generate-tests {UC-ID}
401
+
402
+ If NEEDS_FIX ❌:
403
+ - Small fix (1–3 lines, no logic change) → fix inline → re-run /review-code {UC-ID}
404
+ - Logic / architecture issue → /fix-bug {TICKET_ID}
405
+ - Spec mismatch (code ≠ scenario) → /generate-code {feature-file} (re-gen affected UC)
354
406
  ```
@@ -34,7 +34,7 @@ Display and wait for response:
34
34
  ```
35
35
  ⚙️ MODEL CHECK
36
36
  ──────────────────────────────────────────────────────────────────
37
- Recommended : claude-opus-4-5 (or claude-opus-4)
37
+ Recommended : claude-opus-4 (or latest Opus model)
38
38
  Why needed : Spec analysis, architecture review, code generation
39
39
  require deep reasoning. Smaller models miss edge cases.
40
40
 
@@ -147,7 +147,7 @@ If `paths` section is absent, use these defaults:
147
147
  - `domain_knowledge_dir` = `specs/domain-knowledge`
148
148
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
149
149
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
150
- - `tech_docs_dir` = `tech-docs`
150
+ - `tech_docs_dir` = `specs/tech-docs`
151
151
  - `trace_dir` = `.trace`
152
152
 
153
153
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
@@ -224,6 +224,26 @@ If the file does not exist → skip silently.
224
224
 
225
225
  ---
226
226
 
227
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
228
+
229
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
230
+
231
+ ```
232
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
233
+ ```
234
+
235
+ | `platform_type` | Modules |
236
+ |---|---|
237
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
238
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
239
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
240
+
241
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
242
+
243
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (generate-tests, debug, fix-bug, smoke-test).
244
+
245
+ ---
246
+
227
247
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
228
248
 
229
249
  After loading all context, synthesize and output a compact summary block.
@@ -234,6 +254,7 @@ Output exactly this block:
234
254
  ```
235
255
  [CTX LOADED]
236
256
  Stack : {language} / {framework} / {database}
257
+ Platform : {active_module} ({platform_type})
237
258
  Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
238
259
  Ticket : {ticket_prefix}-
239
260
  Dict : {loaded — N canonical terms, M banned terms | missing}
@@ -379,14 +400,15 @@ Using `{paths.business_dictionary}` and `{paths.core_entities}`:
379
400
  ### B4 — Compliance Checks (C.1–C.5)
380
401
 
381
402
  - [ ] C.1 Wireframe Coverage: every screen component/action has ≥1 SC → finding per missing item
382
- - [ ] C.2 PRD Traceability: same as B1 (deduplicate)
403
+ - [ ] C.2 PRD Traceability: covered fully by B1 — do NOT create new findings here; deduplicate against B1 findings
383
404
  - [ ] C.3 Business Dictionary terms used → same as B2
384
405
  - [ ] C.4 Banned Terms: 0 banned terms → **critical**, auto-fixable
385
406
  - [ ] C.5 NHÓM Grouping: if ≥3 SCs, grouped by business theme → **major**, auto-fixable
386
407
 
387
408
  ### B5 — Metadata & Structural Check
388
409
 
389
- - [ ] File header has all `@trace.*` fields → **minor**, auto-fixable
410
+ - [ ] File header has all required `@trace.*` fields — check each explicitly: `@trace.id`, `@trace.title`, `@trace.revision`, `@trace.domain`, `@trace.service`, `@trace.module`, `@trace.status`, `@trace.author`, `@trace.created_at`, `@trace.prd`, `@trace.prd_version`, `@trace.bdd_version`, `@trace.business_rules`, `@trace.dataset` → **minor** per missing field, auto-fixable
411
+ - Note: `@trace.revision` is always `1` (static field — see generate-bdd.tmpl). Only check for presence; do NOT flag value as stale.
390
412
  - [ ] Every scenario has `# @trace.scenario`, `# @trace.sc_version`, `# @trace.business_rules`, `# Side-effects:` → **minor**, auto-fixable
391
413
  - [ ] Coverage Matrix at end of file → **major**, auto-fixable (AI regenerates)
392
414
  - [ ] Pre-merge Checklist at end of file → **minor**, auto-fixable
@@ -467,6 +489,7 @@ Suggest the logical next command based on workflow phase:
467
489
 
468
490
  | Current command | Suggest next |
469
491
  |-------------------------|-----------------------------------------------|
492
+ | /setup-ai-first | `/define-product` to start your first feature |
470
493
  | /define-product | `/generate-prd {product-definition-file}` |
471
494
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
472
495
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -475,13 +498,13 @@ Suggest the logical next command based on workflow phase:
475
498
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
476
499
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
477
500
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
478
- | /generate-code | `/generate-tests {UC-ID}` |
501
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
479
502
  | /generate-tests | `/run-tests {UC-ID}` |
480
503
  | /run-tests (passing) | `/review-code {UC-ID}` |
481
504
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
482
505
  | /review-code | `/smoke-test {UC-ID}` or create PR |
483
506
  | /smoke-test | Create PR and link to ticket |
484
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
507
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
485
508
  | /fix-bug | Create PR and link to ticket |
486
509
  | /debug | `/fix-bug {ticket-id}` if fix needed |
487
510
 
@@ -500,7 +523,9 @@ Mode: {PRD | BDD}
500
523
  Findings: {total} | 🔴 Critical: {N} | 🟡 Major: {N} | 🟢 Minor: {N}
501
524
  Auto-fixable: {N} | Needs human decision: {N}
502
525
 
503
- Findings file: {paths.refinement_dir}/{slug}-findings.yaml
526
+ Findings file:
527
+ {If PRD}: {paths.refinement_dir}/{prd-slug}-review-context-findings.yaml
528
+ {If BDD}: {paths.refinement_dir}/{uc-id}-review-bdd-findings.yaml
504
529
 
505
530
  Next options:
506
531
  A) Quick fix : /review-context --fix {target-file}
@@ -557,7 +582,7 @@ After applying each finding, mark it `status: "applied_automatically"` in the fi
557
582
 
558
583
  ### Phase 3 — Version bump
559
584
 
560
- - **PRD**: if ≥1 finding applied → bump minor version, add Changelog entry:
585
+ - **PRD**: if ≥1 finding applied → bump **minor** version (auto-fix only applies P1 banned-term replacements and P4 skeleton additions — never alters UC structure or BR content, so minor bump is always correct), add Changelog entry:
561
586
  `Auto-fix: applied {N} auto-fixable review-context findings`
562
587
  - **BDD**: if ≥1 finding applied → increment `@trace.bdd_version` by 0.1
563
588
 
@@ -577,7 +602,9 @@ Still pending (needs human decision): {N}
577
602
  {If PRD}: Version bumped: {old} → {new}
578
603
  {If BDD}: bdd_version: {old} → {new}
579
604
 
580
- Findings file: {paths.refinement_dir}/{slug}-findings.yaml
605
+ Findings file:
606
+ {If PRD}: {paths.refinement_dir}/{prd-slug}-review-context-findings.yaml
607
+ {If BDD}: {paths.refinement_dir}/{uc-id}-review-bdd-findings.yaml
581
608
  Re-run /review-context {file} to confirm 0 remaining critical findings.
582
609
  ```
583
610
 
@@ -596,8 +623,10 @@ Open findings file in Review Board → then run: /review-context --resume {file}
596
623
 
597
624
  ### Phase 1 — Read accepted findings
598
625
 
599
- 1. Derive findings filename from target file (same rule as above).
600
- 2. Read `{paths.refinement_dir}/{slug}-findings.yaml`.
626
+ 1. Derive findings filename from target file using the same rule as Detect Review Mode:
627
+ - PRD: `{paths.refinement_dir}/{prd-slug}-review-context-findings.yaml`
628
+ - BDD: `{paths.refinement_dir}/{uc-id}-review-bdd-findings.yaml`
629
+ 2. Read the findings file.
601
630
  3. Collect findings where `status: "accepted"` or `status: "modified"`.
602
631
  4. If none → report "No accepted findings. File unchanged." and stop.
603
632
 
@@ -627,6 +656,7 @@ Apply in order: critical → major → minor.
627
656
  | B6 (Side effects) | Add missing `And <side-effect>` to Then block |
628
657
 
629
658
  → After applying, increment `@trace.bdd_version` in file header by 0.1.
659
+ → Also update `{paths.trace_dir}/{UC-ID}.tsv`: set `bdd_version` column to the new `@trace.bdd_version` value for all rows, and set `last_updated` to today's date.
630
660
 
631
661
  ### Phase 3 — Report
632
662
 
@@ -34,7 +34,7 @@ Display and wait for response:
34
34
  ```
35
35
  ⚙️ MODEL CHECK
36
36
  ──────────────────────────────────────────────────────────────────
37
- Recommended : claude-opus-4-5 (or claude-opus-4)
37
+ Recommended : claude-opus-4 (or latest Opus model)
38
38
  Why needed : Spec analysis, architecture review, code generation
39
39
  require deep reasoning. Smaller models miss edge cases.
40
40
 
@@ -144,7 +144,7 @@ If `paths` section is absent, use these defaults:
144
144
  - `domain_knowledge_dir` = `specs/domain-knowledge`
145
145
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
146
146
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
147
- - `tech_docs_dir` = `tech-docs`
147
+ - `tech_docs_dir` = `specs/tech-docs`
148
148
  - `trace_dir` = `.trace`
149
149
 
150
150
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
@@ -221,6 +221,26 @@ If the file does not exist → skip silently.
221
221
 
222
222
  ---
223
223
 
224
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
225
+
226
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
227
+
228
+ ```
229
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
230
+ ```
231
+
232
+ | `platform_type` | Modules |
233
+ |---|---|
234
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
235
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
236
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
237
+
238
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
239
+
240
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (generate-tests, debug, fix-bug, smoke-test).
241
+
242
+ ---
243
+
224
244
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
225
245
 
226
246
  After loading all context, synthesize and output a compact summary block.
@@ -231,6 +251,7 @@ Output exactly this block:
231
251
  ```
232
252
  [CTX LOADED]
233
253
  Stack : {language} / {framework} / {database}
254
+ Platform : {active_module} ({platform_type})
234
255
  Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
235
256
  Ticket : {ticket_prefix}-
236
257
  Dict : {loaded — N canonical terms, M banned terms | missing}
@@ -428,6 +449,7 @@ Suggest the logical next command based on workflow phase:
428
449
 
429
450
  | Current command | Suggest next |
430
451
  |-------------------------|-----------------------------------------------|
452
+ | /setup-ai-first | `/define-product` to start your first feature |
431
453
  | /define-product | `/generate-prd {product-definition-file}` |
432
454
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
433
455
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -436,13 +458,13 @@ Suggest the logical next command based on workflow phase:
436
458
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
437
459
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
438
460
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
439
- | /generate-code | `/generate-tests {UC-ID}` |
461
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
440
462
  | /generate-tests | `/run-tests {UC-ID}` |
441
463
  | /run-tests (passing) | `/review-code {UC-ID}` |
442
464
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
443
465
  | /review-code | `/smoke-test {UC-ID}` or create PR |
444
466
  | /smoke-test | Create PR and link to ticket |
445
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
467
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
446
468
  | /fix-bug | Create PR and link to ticket |
447
469
  | /debug | `/fix-bug {ticket-id}` if fix needed |
448
470
 
@@ -471,7 +493,7 @@ Next: Open in Review Board → Accept/Modify/Reject each finding
471
493
  ## Resume Mode — Apply Accepted Findings
472
494
 
473
495
  *Triggered when `$ARGUMENTS` contains `--resume`.*
474
- *Example: `/review-tech-docs --resume tech-docs/payment/PAY-UC1-tech-design.md`*
496
+ *Example: `/review-tech-docs --resume {paths.tech_docs_dir}/payment/PAY-UC1-tech-design.md`*
475
497
 
476
498
  ### Phase 1 — Read accepted findings
477
499
 
@@ -494,10 +516,19 @@ Apply in order: critical → major → minor.
494
516
  **T1, T2, T4 findings with `auto_fixable: false`:** require a human-written resolution in the
495
517
  Review Board "Modify" note. Apply exactly what the note says. Do not invent the fix.
496
518
 
497
- ### Phase 3 — Update header + Report
519
+ ### Phase 3 — Update header + TSV + Report
520
+
521
+ Edit the tech-doc file directly:
522
+ 1. Find `@trace.revision:` in the header — increment its integer value by 1.
523
+ 2. Find `@trace.status:` in the header — set its value to `draft`.
524
+
525
+ Write both changes to the file.
526
+
527
+ Then update `{paths.trace_dir}/{UC-ID}.tsv`:
528
+ - Set `tech_doc_revision` column to the new `@trace.revision` integer for all rows of this UC.
529
+ - Set `last_updated` to today's date (`YYYY-MM-DD`) for all rows of this UC.
498
530
 
499
- 1. Increment `@trace.revision` in the tech-doc header by 1.
500
- 2. Update `@trace.status` to `draft` (reset — must be re-approved after changes).
531
+ Print the report after all file writes are complete.
501
532
 
502
533
  ```
503
534
  /review-tech-docs --resume Applied — {target file}