@anhth2/spec-driven-dev-plugin 0.6.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 (73) hide show
  1. package/bin/index.js +180 -11
  2. package/commands/debug.md +196 -10
  3. package/commands/debug.tmpl +170 -6
  4. package/commands/define-product.md +31 -5
  5. package/commands/define-product.tmpl +5 -1
  6. package/commands/fix-bug.md +74 -10
  7. package/commands/fix-bug.tmpl +48 -6
  8. package/commands/generate-bdd.md +49 -8
  9. package/commands/generate-bdd.tmpl +23 -4
  10. package/commands/generate-code.md +109 -18
  11. package/commands/generate-code.tmpl +83 -14
  12. package/commands/generate-prd.md +33 -6
  13. package/commands/generate-prd.tmpl +7 -2
  14. package/commands/generate-tech-docs.md +85 -8
  15. package/commands/generate-tech-docs.tmpl +59 -4
  16. package/commands/generate-tests.md +454 -36
  17. package/commands/generate-tests.tmpl +428 -32
  18. package/commands/refine-prd.md +39 -7
  19. package/commands/refine-prd.tmpl +13 -3
  20. package/commands/review-code.md +57 -5
  21. package/commands/review-code.tmpl +31 -1
  22. package/commands/review-context.md +41 -11
  23. package/commands/review-context.tmpl +15 -7
  24. package/commands/review-tech-docs.md +39 -8
  25. package/commands/review-tech-docs.tmpl +13 -4
  26. package/commands/run-tests.md +159 -17
  27. package/commands/run-tests.tmpl +133 -13
  28. package/commands/setup-ai-first.md +61 -3
  29. package/commands/setup-ai-first.tmpl +6 -2
  30. package/commands/smoke-test.md +191 -21
  31. package/commands/smoke-test.tmpl +165 -17
  32. package/commands/validate-traces.md +40 -7
  33. package/commands/validate-traces.tmpl +14 -3
  34. package/core/FRAMEWORK_VERSION +1 -1
  35. package/core/commands/debug.md +196 -10
  36. package/core/commands/define-product.md +31 -5
  37. package/core/commands/fix-bug.md +74 -10
  38. package/core/commands/generate-bdd.md +49 -8
  39. package/core/commands/generate-code.md +109 -18
  40. package/core/commands/generate-prd.md +33 -6
  41. package/core/commands/generate-tech-docs.md +85 -8
  42. package/core/commands/generate-tests.md +454 -36
  43. package/core/commands/refine-prd.md +39 -7
  44. package/core/commands/review-code.md +57 -5
  45. package/core/commands/review-context.md +41 -11
  46. package/core/commands/review-tech-docs.md +39 -8
  47. package/core/commands/run-tests.md +159 -17
  48. package/core/commands/setup-ai-first.md +61 -3
  49. package/core/commands/smoke-test.md +191 -21
  50. package/core/commands/validate-traces.md +40 -7
  51. package/core/skills/code/SKILL.md +29 -6
  52. package/core/skills/debug/SKILL.md +31 -7
  53. package/core/skills/discovery/SKILL.md +25 -3
  54. package/core/skills/prd/SKILL.md +8 -6
  55. package/core/skills/setup-ai-first/SKILL.md +3 -2
  56. package/core/skills/spec/SKILL.md +7 -5
  57. package/core/skills/test/SKILL.md +54 -9
  58. package/core/steps/context-loader.md +22 -1
  59. package/core/steps/gate.md +1 -1
  60. package/core/steps/report-footer.md +3 -2
  61. package/core/steps/spawn-agent.md +3 -1
  62. package/package.json +1 -1
  63. package/skills/code/SKILL.md +29 -6
  64. package/skills/debug/SKILL.md +31 -7
  65. package/skills/discovery/SKILL.md +25 -3
  66. package/skills/prd/SKILL.md +8 -6
  67. package/skills/setup-ai-first/SKILL.md +3 -2
  68. package/skills/spec/SKILL.md +7 -5
  69. package/skills/test/SKILL.md +54 -9
  70. package/steps/context-loader.md +22 -1
  71. package/steps/gate.md +1 -1
  72. package/steps/report-footer.md +3 -2
  73. package/steps/spawn-agent.md +3 -1
@@ -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
  ```
@@ -12,13 +12,33 @@
12
12
 
13
13
  ---
14
14
 
15
+ ## Pre-Review Scan
16
+
17
+ *(Separate from the Gate CHECKPOINT — this lists the actual files and scenarios in scope.)*
18
+
19
+ Scan for implementation files and scenarios, then display:
20
+
21
+ ```
22
+ Review Scope — {UC-ID}
23
+ ──────────────────────────────────────
24
+ UC : {UC-ID}
25
+ Files : {list of files tagged @trace.implements={UC-ID}}
26
+ Scenarios : {N} scenarios in .feature file
27
+
28
+ Proceed with review? (Y/N)
29
+ ```
30
+
31
+ Wait for explicit "Y" before proceeding.
32
+
33
+ ---
34
+
15
35
  ## Review Dimensions
16
36
 
17
37
  ### 1. Traceability
18
38
  - [ ] Every controller endpoint has `@trace.implements` tag?
19
39
  - [ ] Every test file has `@trace.verifies` tag?
20
40
  - [ ] No `@trace` tags on wrong layers?
21
- - [ ] `{paths.trace_dir}/{UC-ID}.tsv` up to date?
41
+ - [ ] `{paths.trace_dir}/{UC-ID}.tsv` up to date? (if stale → run `/validate-traces {UC-ID}` first, then re-run this review)
22
42
 
23
43
  ### 2. Layer Architecture (from CLAUDE.md §2)
24
44
  - [ ] Each class in the correct layer?
@@ -53,5 +73,15 @@ Critical: {X} | Major: {Y} | Minor: {Z}
53
73
  ### Minor
54
74
  | # | File | Line | Issue | Suggested Fix |
55
75
 
76
+ Output Artifacts: none (read-only)
77
+
56
78
  Verdict: APPROVED ✅ | NEEDS_FIX ❌
79
+
80
+ If APPROVED ✅:
81
+ Next: /generate-tests {UC-ID}
82
+
83
+ If NEEDS_FIX ❌:
84
+ - Small fix (1–3 lines, no logic change) → fix inline → re-run /review-code {UC-ID}
85
+ - Logic / architecture issue → /fix-bug {TICKET_ID}
86
+ - Spec mismatch (code ≠ scenario) → /generate-code {feature-file} (re-gen affected UC)
57
87
  ```
@@ -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
 
@@ -135,14 +135,15 @@ Using `{paths.business_dictionary}` and `{paths.core_entities}`:
135
135
  ### B4 — Compliance Checks (C.1–C.5)
136
136
 
137
137
  - [ ] C.1 Wireframe Coverage: every screen component/action has ≥1 SC → finding per missing item
138
- - [ ] C.2 PRD Traceability: same as B1 (deduplicate)
138
+ - [ ] C.2 PRD Traceability: covered fully by B1 — do NOT create new findings here; deduplicate against B1 findings
139
139
  - [ ] C.3 Business Dictionary terms used → same as B2
140
140
  - [ ] C.4 Banned Terms: 0 banned terms → **critical**, auto-fixable
141
141
  - [ ] C.5 NHÓM Grouping: if ≥3 SCs, grouped by business theme → **major**, auto-fixable
142
142
 
143
143
  ### B5 — Metadata & Structural Check
144
144
 
145
- - [ ] File header has all `@trace.*` fields → **minor**, auto-fixable
145
+ - [ ] 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
146
+ - Note: `@trace.revision` is always `1` (static field — see generate-bdd.tmpl). Only check for presence; do NOT flag value as stale.
146
147
  - [ ] Every scenario has `# @trace.scenario`, `# @trace.sc_version`, `# @trace.business_rules`, `# Side-effects:` → **minor**, auto-fixable
147
148
  - [ ] Coverage Matrix at end of file → **major**, auto-fixable (AI regenerates)
148
149
  - [ ] Pre-merge Checklist at end of file → **minor**, auto-fixable
@@ -203,7 +204,9 @@ Mode: {PRD | BDD}
203
204
  Findings: {total} | 🔴 Critical: {N} | 🟡 Major: {N} | 🟢 Minor: {N}
204
205
  Auto-fixable: {N} | Needs human decision: {N}
205
206
 
206
- Findings file: {paths.refinement_dir}/{slug}-findings.yaml
207
+ Findings file:
208
+ {If PRD}: {paths.refinement_dir}/{prd-slug}-review-context-findings.yaml
209
+ {If BDD}: {paths.refinement_dir}/{uc-id}-review-bdd-findings.yaml
207
210
 
208
211
  Next options:
209
212
  A) Quick fix : /review-context --fix {target-file}
@@ -260,7 +263,7 @@ After applying each finding, mark it `status: "applied_automatically"` in the fi
260
263
 
261
264
  ### Phase 3 — Version bump
262
265
 
263
- - **PRD**: if ≥1 finding applied → bump minor version, add Changelog entry:
266
+ - **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:
264
267
  `Auto-fix: applied {N} auto-fixable review-context findings`
265
268
  - **BDD**: if ≥1 finding applied → increment `@trace.bdd_version` by 0.1
266
269
 
@@ -280,7 +283,9 @@ Still pending (needs human decision): {N}
280
283
  {If PRD}: Version bumped: {old} → {new}
281
284
  {If BDD}: bdd_version: {old} → {new}
282
285
 
283
- Findings file: {paths.refinement_dir}/{slug}-findings.yaml
286
+ Findings file:
287
+ {If PRD}: {paths.refinement_dir}/{prd-slug}-review-context-findings.yaml
288
+ {If BDD}: {paths.refinement_dir}/{uc-id}-review-bdd-findings.yaml
284
289
  Re-run /review-context {file} to confirm 0 remaining critical findings.
285
290
  ```
286
291
 
@@ -299,8 +304,10 @@ Open findings file in Review Board → then run: /review-context --resume {file}
299
304
 
300
305
  ### Phase 1 — Read accepted findings
301
306
 
302
- 1. Derive findings filename from target file (same rule as above).
303
- 2. Read `{paths.refinement_dir}/{slug}-findings.yaml`.
307
+ 1. Derive findings filename from target file using the same rule as Detect Review Mode:
308
+ - PRD: `{paths.refinement_dir}/{prd-slug}-review-context-findings.yaml`
309
+ - BDD: `{paths.refinement_dir}/{uc-id}-review-bdd-findings.yaml`
310
+ 2. Read the findings file.
304
311
  3. Collect findings where `status: "accepted"` or `status: "modified"`.
305
312
  4. If none → report "No accepted findings. File unchanged." and stop.
306
313
 
@@ -330,6 +337,7 @@ Apply in order: critical → major → minor.
330
337
  | B6 (Side effects) | Add missing `And <side-effect>` to Then block |
331
338
 
332
339
  → After applying, increment `@trace.bdd_version` in file header by 0.1.
340
+ → 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.
333
341
 
334
342
  ### Phase 3 — Report
335
343
 
@@ -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}
@@ -174,7 +174,7 @@ Next: Open in Review Board → Accept/Modify/Reject each finding
174
174
  ## Resume Mode — Apply Accepted Findings
175
175
 
176
176
  *Triggered when `$ARGUMENTS` contains `--resume`.*
177
- *Example: `/review-tech-docs --resume tech-docs/payment/PAY-UC1-tech-design.md`*
177
+ *Example: `/review-tech-docs --resume {paths.tech_docs_dir}/payment/PAY-UC1-tech-design.md`*
178
178
 
179
179
  ### Phase 1 — Read accepted findings
180
180
 
@@ -197,10 +197,19 @@ Apply in order: critical → major → minor.
197
197
  **T1, T2, T4 findings with `auto_fixable: false`:** require a human-written resolution in the
198
198
  Review Board "Modify" note. Apply exactly what the note says. Do not invent the fix.
199
199
 
200
- ### Phase 3 — Update header + Report
200
+ ### Phase 3 — Update header + TSV + Report
201
201
 
202
- 1. Increment `@trace.revision` in the tech-doc header by 1.
203
- 2. Update `@trace.status` to `draft` (resetmust be re-approved after changes).
202
+ Edit the tech-doc file directly:
203
+ 1. Find `@trace.revision:` in the headerincrement its integer value by 1.
204
+ 2. Find `@trace.status:` in the header — set its value to `draft`.
205
+
206
+ Write both changes to the file.
207
+
208
+ Then update `{paths.trace_dir}/{UC-ID}.tsv`:
209
+ - Set `tech_doc_revision` column to the new `@trace.revision` integer for all rows of this UC.
210
+ - Set `last_updated` to today's date (`YYYY-MM-DD`) for all rows of this UC.
211
+
212
+ Print the report after all file writes are complete.
204
213
 
205
214
  ```
206
215
  /review-tech-docs --resume Applied — {target file}