@anhth2/spec-driven-dev-plugin 0.6.0 → 0.8.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 (86) hide show
  1. package/bin/index.js +285 -11
  2. package/commands/debug.md +233 -11
  3. package/commands/debug.tmpl +170 -6
  4. package/commands/define-product.md +68 -6
  5. package/commands/define-product.tmpl +5 -1
  6. package/commands/fix-bug.md +111 -11
  7. package/commands/fix-bug.tmpl +48 -6
  8. package/commands/generate-bdd.md +86 -9
  9. package/commands/generate-bdd.tmpl +23 -4
  10. package/commands/generate-code.md +146 -19
  11. package/commands/generate-code.tmpl +83 -14
  12. package/commands/generate-design-spec.md +754 -0
  13. package/commands/generate-design-spec.tmpl +399 -0
  14. package/commands/generate-prd.md +91 -7
  15. package/commands/generate-prd.tmpl +28 -2
  16. package/commands/generate-spec-manifest.md +519 -0
  17. package/commands/generate-spec-manifest.tmpl +164 -0
  18. package/commands/generate-tech-docs.md +122 -9
  19. package/commands/generate-tech-docs.tmpl +59 -4
  20. package/commands/generate-tests.md +491 -37
  21. package/commands/generate-tests.tmpl +428 -32
  22. package/commands/refine-prd.md +76 -8
  23. package/commands/refine-prd.tmpl +13 -3
  24. package/commands/review-code.md +94 -6
  25. package/commands/review-code.tmpl +31 -1
  26. package/commands/review-context.md +118 -12
  27. package/commands/review-context.tmpl +55 -7
  28. package/commands/review-tech-docs.md +76 -9
  29. package/commands/review-tech-docs.tmpl +13 -4
  30. package/commands/run-tests.md +196 -18
  31. package/commands/run-tests.tmpl +133 -13
  32. package/commands/setup-ai-first.md +192 -6
  33. package/commands/setup-ai-first.tmpl +136 -5
  34. package/commands/smoke-test.md +228 -22
  35. package/commands/smoke-test.tmpl +165 -17
  36. package/commands/validate-traces.md +77 -8
  37. package/commands/validate-traces.tmpl +14 -3
  38. package/core/FRAMEWORK_VERSION +1 -1
  39. package/core/commands/debug.md +233 -11
  40. package/core/commands/define-product.md +68 -6
  41. package/core/commands/fix-bug.md +111 -11
  42. package/core/commands/generate-bdd.md +86 -9
  43. package/core/commands/generate-code.md +146 -19
  44. package/core/commands/generate-design-spec.md +754 -0
  45. package/core/commands/generate-prd.md +91 -7
  46. package/core/commands/generate-spec-manifest.md +519 -0
  47. package/core/commands/generate-tech-docs.md +122 -9
  48. package/core/commands/generate-tests.md +491 -37
  49. package/core/commands/refine-prd.md +76 -8
  50. package/core/commands/review-code.md +94 -6
  51. package/core/commands/review-context.md +118 -12
  52. package/core/commands/review-tech-docs.md +76 -9
  53. package/core/commands/run-tests.md +196 -18
  54. package/core/commands/setup-ai-first.md +192 -6
  55. package/core/commands/smoke-test.md +228 -22
  56. package/core/commands/validate-traces.md +77 -8
  57. package/core/skills/code/SKILL.md +68 -8
  58. package/core/skills/debug/SKILL.md +72 -10
  59. package/core/skills/design-spec/SKILL.md +450 -0
  60. package/core/skills/discovery/SKILL.md +62 -4
  61. package/core/skills/prd/SKILL.md +12 -8
  62. package/core/skills/setup-ai-first/SKILL.md +5 -3
  63. package/core/skills/spec/SKILL.md +11 -7
  64. package/core/skills/test/SKILL.md +130 -12
  65. package/core/steps/context-loader.md +57 -1
  66. package/core/steps/gate.md +1 -1
  67. package/core/steps/report-footer.md +5 -3
  68. package/core/steps/spawn-agent.md +3 -1
  69. package/core/templates/design-spec.template.md +209 -0
  70. package/core/templates/project-context.yaml +29 -0
  71. package/package.json +1 -1
  72. package/skills/code/SKILL.md +68 -8
  73. package/skills/debug/SKILL.md +72 -10
  74. package/skills/design-spec/SKILL.md +450 -0
  75. package/skills/design-spec/SKILL.tmpl +95 -0
  76. package/skills/discovery/SKILL.md +62 -4
  77. package/skills/prd/SKILL.md +12 -8
  78. package/skills/setup-ai-first/SKILL.md +5 -3
  79. package/skills/spec/SKILL.md +11 -7
  80. package/skills/test/SKILL.md +130 -12
  81. package/steps/context-loader.md +57 -1
  82. package/steps/gate.md +1 -1
  83. package/steps/report-footer.md +5 -3
  84. package/steps/spawn-agent.md +3 -1
  85. package/templates/design-spec.template.md +209 -0
  86. package/templates/project-context.yaml +29 -0
@@ -43,7 +43,7 @@ Display and wait for response:
43
43
  ```
44
44
  ⚙️ MODEL CHECK
45
45
  ──────────────────────────────────────────────────────────────────
46
- Recommended : claude-opus-4-5 (or claude-opus-4)
46
+ Recommended : claude-opus-4 (or latest Opus model)
47
47
  Why needed : Spec analysis, architecture review, code generation
48
48
  require deep reasoning. Smaller models miss edge cases.
49
49
 
@@ -203,21 +203,23 @@ Suggest the logical next command based on workflow phase:
203
203
 
204
204
  | Current command | Suggest next |
205
205
  |-------------------------|-----------------------------------------------|
206
+ | /setup-ai-first | `/define-product` to start your first feature |
206
207
  | /define-product | `/generate-prd {product-definition-file}` |
207
208
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
208
209
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
209
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
210
+ | /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
211
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
210
212
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
211
213
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
212
214
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
213
215
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
214
- | /generate-code | `/generate-tests {UC-ID}` |
216
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
215
217
  | /generate-tests | `/run-tests {UC-ID}` |
216
218
  | /run-tests (passing) | `/review-code {UC-ID}` |
217
219
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
218
220
  | /review-code | `/smoke-test {UC-ID}` or create PR |
219
221
  | /smoke-test | Create PR and link to ticket |
220
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
222
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
221
223
  | /fix-bug | Create PR and link to ticket |
222
224
  | /debug | `/fix-bug {ticket-id}` if fix needed |
223
225
 
@@ -333,21 +335,23 @@ Suggest the logical next command based on workflow phase:
333
335
 
334
336
  | Current command | Suggest next |
335
337
  |-------------------------|-----------------------------------------------|
338
+ | /setup-ai-first | `/define-product` to start your first feature |
336
339
  | /define-product | `/generate-prd {product-definition-file}` |
337
340
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
338
341
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
339
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
342
+ | /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
343
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
340
344
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
341
345
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
342
346
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
343
347
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
344
- | /generate-code | `/generate-tests {UC-ID}` |
348
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
345
349
  | /generate-tests | `/run-tests {UC-ID}` |
346
350
  | /run-tests (passing) | `/review-code {UC-ID}` |
347
351
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
348
352
  | /review-code | `/smoke-test {UC-ID}` or create PR |
349
353
  | /smoke-test | Create PR and link to ticket |
350
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
354
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
351
355
  | /fix-bug | Create PR and link to ticket |
352
356
  | /debug | `/fix-bug {ticket-id}` if fix needed |
353
357
 
@@ -43,7 +43,7 @@ Display and wait for response:
43
43
  ```
44
44
  ⚙️ MODEL CHECK
45
45
  ──────────────────────────────────────────────────────────────────
46
- Recommended : claude-opus-4-5 (or claude-opus-4)
46
+ Recommended : claude-opus-4 (or latest Opus model)
47
47
  Why needed : Spec analysis, architecture review, code generation
48
48
  require deep reasoning. Smaller models miss edge cases.
49
49
 
@@ -246,21 +246,23 @@ Suggest the logical next command based on workflow phase:
246
246
 
247
247
  | Current command | Suggest next |
248
248
  |-------------------------|-----------------------------------------------|
249
+ | /setup-ai-first | `/define-product` to start your first feature |
249
250
  | /define-product | `/generate-prd {product-definition-file}` |
250
251
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
251
252
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
252
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
253
+ | /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
254
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
253
255
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
254
256
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
255
257
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
256
258
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
257
- | /generate-code | `/generate-tests {UC-ID}` |
259
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
258
260
  | /generate-tests | `/run-tests {UC-ID}` |
259
261
  | /run-tests (passing) | `/review-code {UC-ID}` |
260
262
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
261
263
  | /review-code | `/smoke-test {UC-ID}` or create PR |
262
264
  | /smoke-test | Create PR and link to ticket |
263
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
265
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
264
266
  | /fix-bug | Create PR and link to ticket |
265
267
  | /debug | `/fix-bug {ticket-id}` if fix needed |
266
268
 
@@ -323,6 +325,7 @@ Read `.agent/project-context.yaml`. Extract and store:
323
325
  - `paths.core_entities` → path to core-entities.md
324
326
  - `paths.tech_docs_dir` → technical documentation root
325
327
  - `paths.trace_dir` → trace state directory
328
+ - `paths.design_spec_dir` → Design Spec documents root (FE/App only)
326
329
 
327
330
  If `paths` section is absent, use these defaults:
328
331
  - `specs_dir` = `specs/bdd`
@@ -332,13 +335,46 @@ If `paths` section is absent, use these defaults:
332
335
  - `domain_knowledge_dir` = `specs/domain-knowledge`
333
336
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
334
337
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
335
- - `tech_docs_dir` = `tech-docs`
338
+ - `tech_docs_dir` = `specs/tech-docs`
336
339
  - `trace_dir` = `.trace`
340
+ - `design_spec_dir` = `specs/design-spec`
337
341
 
338
342
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
339
343
 
340
344
  ---
341
345
 
346
+ ## Step 1.5 — [SERVICE ROUTING] Resolve service paths (umbrella mode)
347
+
348
+ *Skip this step entirely if `setup.mode` is not `"umbrella"` and `services` section is absent from project-context.yaml.*
349
+
350
+ If `services` section is present:
351
+
352
+ **1. Detect active domain** (in priority order):
353
+ - Read `@trace.domain` from target file frontmatter (if Gate loaded a target file)
354
+ - Extract from target file path: segment immediately after `prd_dir` base path
355
+ *(e.g., `specs/prd/user/FEAT-01.md` → domain = `user`)*
356
+ - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
357
+
358
+ **2. Route to service** — if active domain matches a key in `services`:
359
+ - Override `paths.specs_dir` → `services.{domain}.specs_dir`
360
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
361
+ - Store `active_service` = `services.{domain}.path`
362
+ - Store `active_service_module` = `services.{domain}.module`
363
+ - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
364
+
365
+ **3. Fallback** — if domain not detected or no matching service key:
366
+ - Keep default paths from Step 1
367
+ - Set `active_service = unresolved`
368
+
369
+ **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
370
+ - Override `paths.prd_dir` → `{spec_source}/specs/prd`
371
+ - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
372
+ - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
373
+ - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
374
+ - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
375
+
376
+ ---
377
+
342
378
  ## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
343
379
 
344
380
  If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
@@ -409,6 +445,26 @@ If the file does not exist → skip silently.
409
445
 
410
446
  ---
411
447
 
448
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
449
+
450
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
451
+
452
+ ```
453
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
454
+ ```
455
+
456
+ | `platform_type` | Modules |
457
+ |---|---|
458
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
459
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
460
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
461
+
462
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
463
+
464
+ 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).
465
+
466
+ ---
467
+
412
468
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
413
469
 
414
470
  After loading all context, synthesize and output a compact summary block.
@@ -419,10 +475,12 @@ Output exactly this block:
419
475
  ```
420
476
  [CTX LOADED]
421
477
  Stack : {language} / {framework} / {database}
478
+ Platform : {active_module} ({platform_type})
422
479
  Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
423
480
  Ticket : {ticket_prefix}-
424
481
  Dict : {loaded — N canonical terms, M banned terms | missing}
425
482
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
483
+ Service : {active_service} ({active_service_module}) | single-service
426
484
  Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
427
485
  ```
428
486
 
@@ -531,21 +589,23 @@ Suggest the logical next command based on workflow phase:
531
589
 
532
590
  | Current command | Suggest next |
533
591
  |-------------------------|-----------------------------------------------|
592
+ | /setup-ai-first | `/define-product` to start your first feature |
534
593
  | /define-product | `/generate-prd {product-definition-file}` |
535
594
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
536
595
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
537
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
596
+ | /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
597
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
538
598
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
539
599
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
540
600
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
541
601
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
542
- | /generate-code | `/generate-tests {UC-ID}` |
602
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
543
603
  | /generate-tests | `/run-tests {UC-ID}` |
544
604
  | /run-tests (passing) | `/review-code {UC-ID}` |
545
605
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
546
606
  | /review-code | `/smoke-test {UC-ID}` or create PR |
547
607
  | /smoke-test | Create PR and link to ticket |
548
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
608
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
549
609
  | /fix-bug | Create PR and link to ticket |
550
610
  | /debug | `/fix-bug {ticket-id}` if fix needed |
551
611
 
@@ -611,6 +671,7 @@ Read `.agent/project-context.yaml`. Extract and store:
611
671
  - `paths.core_entities` → path to core-entities.md
612
672
  - `paths.tech_docs_dir` → technical documentation root
613
673
  - `paths.trace_dir` → trace state directory
674
+ - `paths.design_spec_dir` → Design Spec documents root (FE/App only)
614
675
 
615
676
  If `paths` section is absent, use these defaults:
616
677
  - `specs_dir` = `specs/bdd`
@@ -620,13 +681,46 @@ If `paths` section is absent, use these defaults:
620
681
  - `domain_knowledge_dir` = `specs/domain-knowledge`
621
682
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
622
683
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
623
- - `tech_docs_dir` = `tech-docs`
684
+ - `tech_docs_dir` = `specs/tech-docs`
624
685
  - `trace_dir` = `.trace`
686
+ - `design_spec_dir` = `specs/design-spec`
625
687
 
626
688
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
627
689
 
628
690
  ---
629
691
 
692
+ ## Step 1.5 — [SERVICE ROUTING] Resolve service paths (umbrella mode)
693
+
694
+ *Skip this step entirely if `setup.mode` is not `"umbrella"` and `services` section is absent from project-context.yaml.*
695
+
696
+ If `services` section is present:
697
+
698
+ **1. Detect active domain** (in priority order):
699
+ - Read `@trace.domain` from target file frontmatter (if Gate loaded a target file)
700
+ - Extract from target file path: segment immediately after `prd_dir` base path
701
+ *(e.g., `specs/prd/user/FEAT-01.md` → domain = `user`)*
702
+ - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
703
+
704
+ **2. Route to service** — if active domain matches a key in `services`:
705
+ - Override `paths.specs_dir` → `services.{domain}.specs_dir`
706
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
707
+ - Store `active_service` = `services.{domain}.path`
708
+ - Store `active_service_module` = `services.{domain}.module`
709
+ - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
710
+
711
+ **3. Fallback** — if domain not detected or no matching service key:
712
+ - Keep default paths from Step 1
713
+ - Set `active_service = unresolved`
714
+
715
+ **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
716
+ - Override `paths.prd_dir` → `{spec_source}/specs/prd`
717
+ - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
718
+ - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
719
+ - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
720
+ - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
721
+
722
+ ---
723
+
630
724
  ## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
631
725
 
632
726
  If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
@@ -697,6 +791,26 @@ If the file does not exist → skip silently.
697
791
 
698
792
  ---
699
793
 
794
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
795
+
796
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
797
+
798
+ ```
799
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
800
+ ```
801
+
802
+ | `platform_type` | Modules |
803
+ |---|---|
804
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
805
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
806
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
807
+
808
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
809
+
810
+ 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).
811
+
812
+ ---
813
+
700
814
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
701
815
 
702
816
  After loading all context, synthesize and output a compact summary block.
@@ -707,10 +821,12 @@ Output exactly this block:
707
821
  ```
708
822
  [CTX LOADED]
709
823
  Stack : {language} / {framework} / {database}
824
+ Platform : {active_module} ({platform_type})
710
825
  Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
711
826
  Ticket : {ticket_prefix}-
712
827
  Dict : {loaded — N canonical terms, M banned terms | missing}
713
828
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
829
+ Service : {active_service} ({active_service_module}) | single-service
714
830
  Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
715
831
  ```
716
832
 
@@ -834,21 +950,23 @@ Suggest the logical next command based on workflow phase:
834
950
 
835
951
  | Current command | Suggest next |
836
952
  |-------------------------|-----------------------------------------------|
953
+ | /setup-ai-first | `/define-product` to start your first feature |
837
954
  | /define-product | `/generate-prd {product-definition-file}` |
838
955
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
839
956
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
840
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
957
+ | /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
958
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
841
959
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
842
960
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
843
961
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
844
962
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
845
- | /generate-code | `/generate-tests {UC-ID}` |
963
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
846
964
  | /generate-tests | `/run-tests {UC-ID}` |
847
965
  | /run-tests (passing) | `/review-code {UC-ID}` |
848
966
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
849
967
  | /review-code | `/smoke-test {UC-ID}` or create PR |
850
968
  | /smoke-test | Create PR and link to ticket |
851
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
969
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
852
970
  | /fix-bug | Create PR and link to ticket |
853
971
  | /debug | `/fix-bug {ticket-id}` if fix needed |
854
972
 
@@ -42,6 +42,7 @@ Read `.agent/project-context.yaml`. Extract and store:
42
42
  - `paths.core_entities` → path to core-entities.md
43
43
  - `paths.tech_docs_dir` → technical documentation root
44
44
  - `paths.trace_dir` → trace state directory
45
+ - `paths.design_spec_dir` → Design Spec documents root (FE/App only)
45
46
 
46
47
  If `paths` section is absent, use these defaults:
47
48
  - `specs_dir` = `specs/bdd`
@@ -51,13 +52,46 @@ If `paths` section is absent, use these defaults:
51
52
  - `domain_knowledge_dir` = `specs/domain-knowledge`
52
53
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
53
54
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
54
- - `tech_docs_dir` = `tech-docs`
55
+ - `tech_docs_dir` = `specs/tech-docs`
55
56
  - `trace_dir` = `.trace`
57
+ - `design_spec_dir` = `specs/design-spec`
56
58
 
57
59
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
58
60
 
59
61
  ---
60
62
 
63
+ ## Step 1.5 — [SERVICE ROUTING] Resolve service paths (umbrella mode)
64
+
65
+ *Skip this step entirely if `setup.mode` is not `"umbrella"` and `services` section is absent from project-context.yaml.*
66
+
67
+ If `services` section is present:
68
+
69
+ **1. Detect active domain** (in priority order):
70
+ - Read `@trace.domain` from target file frontmatter (if Gate loaded a target file)
71
+ - Extract from target file path: segment immediately after `prd_dir` base path
72
+ *(e.g., `specs/prd/user/FEAT-01.md` → domain = `user`)*
73
+ - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
74
+
75
+ **2. Route to service** — if active domain matches a key in `services`:
76
+ - Override `paths.specs_dir` → `services.{domain}.specs_dir`
77
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
78
+ - Store `active_service` = `services.{domain}.path`
79
+ - Store `active_service_module` = `services.{domain}.module`
80
+ - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
81
+
82
+ **3. Fallback** — if domain not detected or no matching service key:
83
+ - Keep default paths from Step 1
84
+ - Set `active_service = unresolved`
85
+
86
+ **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
87
+ - Override `paths.prd_dir` → `{spec_source}/specs/prd`
88
+ - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
89
+ - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
90
+ - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
91
+ - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
92
+
93
+ ---
94
+
61
95
  ## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
62
96
 
63
97
  If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
@@ -128,6 +162,26 @@ If the file does not exist → skip silently.
128
162
 
129
163
  ---
130
164
 
165
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
166
+
167
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
168
+
169
+ ```
170
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
171
+ ```
172
+
173
+ | `platform_type` | Modules |
174
+ |---|---|
175
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
176
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
177
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
178
+
179
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
180
+
181
+ 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).
182
+
183
+ ---
184
+
131
185
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
132
186
 
133
187
  After loading all context, synthesize and output a compact summary block.
@@ -138,10 +192,12 @@ Output exactly this block:
138
192
  ```
139
193
  [CTX LOADED]
140
194
  Stack : {language} / {framework} / {database}
195
+ Platform : {active_module} ({platform_type})
141
196
  Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
142
197
  Ticket : {ticket_prefix}-
143
198
  Dict : {loaded — N canonical terms, M banned terms | missing}
144
199
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
200
+ Service : {active_service} ({active_service_module}) | single-service
145
201
  Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
146
202
  ```
147
203
 
@@ -28,7 +28,7 @@ Display and wait for response:
28
28
  ```
29
29
  ⚙️ MODEL CHECK
30
30
  ──────────────────────────────────────────────────────────────────
31
- Recommended : claude-opus-4-5 (or claude-opus-4)
31
+ Recommended : claude-opus-4 (or latest Opus model)
32
32
  Why needed : Spec analysis, architecture review, code generation
33
33
  require deep reasoning. Smaller models miss edge cases.
34
34
 
@@ -26,21 +26,23 @@ Suggest the logical next command based on workflow phase:
26
26
 
27
27
  | Current command | Suggest next |
28
28
  |-------------------------|-----------------------------------------------|
29
+ | /setup-ai-first | `/define-product` to start your first feature |
29
30
  | /define-product | `/generate-prd {product-definition-file}` |
30
31
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
31
32
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
32
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
33
+ | /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
34
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
33
35
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
34
36
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
35
37
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
36
38
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
37
- | /generate-code | `/generate-tests {UC-ID}` |
39
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
38
40
  | /generate-tests | `/run-tests {UC-ID}` |
39
41
  | /run-tests (passing) | `/review-code {UC-ID}` |
40
42
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
41
43
  | /review-code | `/smoke-test {UC-ID}` or create PR |
42
44
  | /smoke-test | Create PR and link to ticket |
43
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
45
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
44
46
  | /fix-bug | Create PR and link to ticket |
45
47
  | /debug | `/fix-bug {ticket-id}` if fix needed |
46
48
 
@@ -72,7 +72,7 @@ Build payload and invoke Agent tool for each UC:
72
72
  ```json
73
73
  {
74
74
  "_agent_mode": true,
75
- "command": "{generate-bdd | generate-code | generate-tests}",
75
+ "command": "generate-bdd",
76
76
  "uc_id": "{TICKET-ID}-UC{N}",
77
77
  "target_file": "{absolute path to PRD or feature file}",
78
78
  "uc_section": { "line_start": {N}, "line_end": {N} },
@@ -80,6 +80,8 @@ Build payload and invoke Agent tool for each UC:
80
80
  }
81
81
  ```
82
82
 
83
+ > **Command scope**: Only `/generate-bdd` initiates orchestration mode. `/generate-code` and `/generate-tests` can run as sub-agents (they respect `_agent_mode: true` from Gate Step 0), but they do not spawn further sub-agents — their scope is already a single UC.
84
+
83
85
  Serialize this JSON and pass as `$ARGUMENTS` when invoking the sub-agent command.
84
86
 
85
87
  ### Step E — Collect and merge results