@anhth2/spec-driven-dev-plugin 0.9.2 → 0.10.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 (94) hide show
  1. package/ARCHITECTURE.md +20 -9
  2. package/commands/debug.md +12 -12
  3. package/commands/define-product.md +11 -11
  4. package/commands/{generate-tests.md → dev-gen-test.md} +47 -15
  5. package/commands/{generate-tests.tmpl → dev-gen-test.tmpl} +18 -4
  6. package/{core/commands/run-tests.md → commands/dev-run-test.md} +61 -13
  7. package/commands/{run-tests.tmpl → dev-run-test.tmpl} +32 -2
  8. package/{core/commands/smoke-test.md → commands/dev-smoke-test.md} +16 -16
  9. package/commands/{smoke-test.tmpl → dev-smoke-test.tmpl} +5 -5
  10. package/commands/fix-bug.md +12 -12
  11. package/commands/generate-bdd.md +38 -13
  12. package/commands/generate-bdd.tmpl +9 -2
  13. package/commands/generate-code.md +85 -15
  14. package/commands/generate-code.tmpl +56 -4
  15. package/commands/generate-design-spec.md +104 -39
  16. package/commands/generate-design-spec.tmpl +93 -28
  17. package/commands/generate-prd.md +11 -11
  18. package/commands/generate-spec-manifest.md +11 -11
  19. package/commands/generate-tech-docs.md +12 -12
  20. package/commands/generate-tech-docs.tmpl +1 -1
  21. package/commands/learn.md +12 -12
  22. package/commands/propose-scenario.md +12 -12
  23. package/commands/propose-scenario.tmpl +1 -1
  24. package/commands/refine-prd.md +165 -16
  25. package/commands/refine-prd.tmpl +16 -5
  26. package/commands/report-bug.md +11 -11
  27. package/commands/review-code.md +13 -13
  28. package/commands/review-code.tmpl +1 -1
  29. package/commands/review-context.md +160 -12
  30. package/commands/review-context.tmpl +11 -1
  31. package/commands/review-tech-docs.md +11 -11
  32. package/commands/setup-ai-first.md +7 -7
  33. package/commands/sync.md +23 -20
  34. package/commands/sync.tmpl +16 -13
  35. package/commands/update-framework.md +7 -7
  36. package/commands/validate-traces.md +56 -37
  37. package/commands/validate-traces.tmpl +45 -26
  38. package/core/FRAMEWORK_VERSION +1 -1
  39. package/core/commands/debug.md +12 -12
  40. package/core/commands/define-product.md +11 -11
  41. package/core/commands/{generate-tests.md → dev-gen-test.md} +47 -15
  42. package/{commands/run-tests.md → core/commands/dev-run-test.md} +61 -13
  43. package/{commands/smoke-test.md → core/commands/dev-smoke-test.md} +16 -16
  44. package/core/commands/fix-bug.md +12 -12
  45. package/core/commands/generate-bdd.md +38 -13
  46. package/core/commands/generate-code.md +85 -15
  47. package/core/commands/generate-design-spec.md +104 -39
  48. package/core/commands/generate-prd.md +11 -11
  49. package/core/commands/generate-spec-manifest.md +11 -11
  50. package/core/commands/generate-tech-docs.md +12 -12
  51. package/core/commands/learn.md +12 -12
  52. package/core/commands/propose-scenario.md +12 -12
  53. package/core/commands/refine-prd.md +165 -16
  54. package/core/commands/report-bug.md +11 -11
  55. package/core/commands/review-code.md +13 -13
  56. package/core/commands/review-context.md +160 -12
  57. package/core/commands/review-tech-docs.md +11 -11
  58. package/core/commands/setup-ai-first.md +7 -7
  59. package/core/commands/sync.md +23 -20
  60. package/core/commands/update-framework.md +7 -7
  61. package/core/commands/validate-traces.md +56 -37
  62. package/core/skills/code/SKILL.md +18 -18
  63. package/core/skills/debug/SKILL.md +26 -26
  64. package/core/skills/design-spec/SKILL.md +11 -11
  65. package/core/skills/discovery/SKILL.md +11 -11
  66. package/core/skills/prd/SKILL.md +14 -14
  67. package/core/skills/setup-ai-first/SKILL.md +7 -7
  68. package/core/skills/spec/SKILL.md +14 -14
  69. package/core/skills/test/SKILL.md +38 -38
  70. package/core/steps/capture-lesson.md +1 -1
  71. package/core/steps/context-loader.md +4 -4
  72. package/core/steps/report-footer.md +7 -7
  73. package/core/steps/review-fanout.md +138 -0
  74. package/core/steps/spawn-agent.md +1 -1
  75. package/core/steps/trace-mirror.md +18 -0
  76. package/core/templates/design-spec.template.md +16 -8
  77. package/package.json +1 -1
  78. package/skills/code/SKILL.md +18 -18
  79. package/skills/debug/SKILL.md +26 -26
  80. package/skills/debug/SKILL.tmpl +1 -1
  81. package/skills/design-spec/SKILL.md +11 -11
  82. package/skills/discovery/SKILL.md +11 -11
  83. package/skills/prd/SKILL.md +14 -14
  84. package/skills/setup-ai-first/SKILL.md +7 -7
  85. package/skills/spec/SKILL.md +14 -14
  86. package/skills/test/SKILL.md +38 -38
  87. package/skills/test/SKILL.tmpl +9 -9
  88. package/steps/capture-lesson.md +1 -1
  89. package/steps/context-loader.md +4 -4
  90. package/steps/report-footer.md +7 -7
  91. package/steps/review-fanout.md +138 -0
  92. package/steps/spawn-agent.md +1 -1
  93. package/steps/trace-mirror.md +18 -0
  94. package/templates/design-spec.template.md +16 -8
@@ -168,7 +168,7 @@ If `services` section is present:
168
168
 
169
169
  **2. Route to service** — if active domain matches a key in `services`:
170
170
  - Override `paths.specs_dir` → `services.{domain}.specs_dir`
171
- - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
171
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, the tech-design (API contract) is a cross-team artifact and must live in the shared spec repo (handled in step 4), so leave `tech_docs_dir` for step 4 to route — do NOT pin it per-service here.
172
172
  - Store `active_service` = `services.{domain}.path`
173
173
  - Store `active_service_module` = `services.{domain}.module`
174
174
  - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
@@ -180,7 +180,7 @@ If `services` section is present:
180
180
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
181
181
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
182
182
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
183
- - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **only if step 2 did not already route it to a service** (multi-service umbrellas keep per-service tech-docs). This publishes the BE-authored API contract into the shared spec repo so FE/App can read it via the spec submodule at `/generate-code --phase=integration`.
183
+ - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **always when `spec_source` is set** (step 2 no longer pins tech-docs per-service in this case). The tech-design IS the cross-team API contract: BE authors it here, and FE/App read it from the same spec submodule at `/generate-code --phase=integration`. *(Per-service tech-docs only happen when there is no `spec_source` — a pure multi-service BE repo with no shared spec module.)*
184
184
  - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
185
185
  - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
186
186
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
@@ -211,7 +211,7 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
211
211
  | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
212
212
 
213
213
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
214
- - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
214
+ - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
215
215
  - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
216
216
 
217
217
  **4. If service config not found** — keep umbrella defaults, still set `service_root = {active_service}` (path anchor is always needed even without a config override).
@@ -304,7 +304,7 @@ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
304
304
 
305
305
  If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
306
306
 
307
- 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).
307
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (dev-gen-test, debug, fix-bug, dev-smoke-test).
308
308
 
309
309
  ---
310
310
 
@@ -529,13 +529,13 @@ Suggest the logical next command based on workflow phase:
529
529
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
530
530
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
531
531
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
532
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
533
- | /generate-tests | `/run-tests {UC-ID}` |
534
- | /run-tests (passing) | `/review-code {UC-ID}` |
535
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
536
- | /review-code | `/smoke-test {UC-ID}` or create PR |
537
- | /smoke-test | Create PR and link to ticket |
538
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
532
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
533
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
534
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
535
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
536
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
537
+ | /dev-smoke-test | Create PR and link to ticket |
538
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
539
539
  | /fix-bug | Create PR and link to ticket |
540
540
  | /debug | `/fix-bug {ticket-id}` if fix needed |
541
541
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -184,7 +184,7 @@ If `services` section is present:
184
184
 
185
185
  **2. Route to service** — if active domain matches a key in `services`:
186
186
  - Override `paths.specs_dir` → `services.{domain}.specs_dir`
187
- - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
187
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, the tech-design (API contract) is a cross-team artifact and must live in the shared spec repo (handled in step 4), so leave `tech_docs_dir` for step 4 to route — do NOT pin it per-service here.
188
188
  - Store `active_service` = `services.{domain}.path`
189
189
  - Store `active_service_module` = `services.{domain}.module`
190
190
  - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
@@ -196,7 +196,7 @@ If `services` section is present:
196
196
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
197
197
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
198
198
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
199
- - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **only if step 2 did not already route it to a service** (multi-service umbrellas keep per-service tech-docs). This publishes the BE-authored API contract into the shared spec repo so FE/App can read it via the spec submodule at `/generate-code --phase=integration`.
199
+ - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **always when `spec_source` is set** (step 2 no longer pins tech-docs per-service in this case). The tech-design IS the cross-team API contract: BE authors it here, and FE/App read it from the same spec submodule at `/generate-code --phase=integration`. *(Per-service tech-docs only happen when there is no `spec_source` — a pure multi-service BE repo with no shared spec module.)*
200
200
  - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
201
201
  - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
202
202
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
@@ -227,7 +227,7 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
227
227
  | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
228
228
 
229
229
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
230
- - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
230
+ - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
231
231
  - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
232
232
 
233
233
  **4. If service config not found** — keep umbrella defaults, still set `service_root = {active_service}` (path anchor is always needed even without a config override).
@@ -320,7 +320,7 @@ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
320
320
 
321
321
  If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
322
322
 
323
- 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).
323
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (dev-gen-test, debug, fix-bug, dev-smoke-test).
324
324
 
325
325
  ---
326
326
 
@@ -518,7 +518,7 @@ cd -
518
518
  git add {spec_source} && git commit -m "chore: bump spec pointer ({UC-ID} tech design)"
519
519
  ```
520
520
 
521
- If `tech_docs_dir` is **local** (single-service, or per-service routing in a multi-service umbrella), skip this no cross-repo publish needed.
521
+ If `tech_docs_dir` is **local** — i.e. no `setup.spec_source` (single-repo, or a pure multi-service BE repo with no shared spec module) skip this; no cross-repo publish needed. Whenever `spec_source` is set, tech-docs route to the spec submodule and this publish step applies.
522
522
 
523
523
  ## Output
524
524
 
@@ -560,13 +560,13 @@ Suggest the logical next command based on workflow phase:
560
560
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
561
561
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
562
562
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
563
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
564
- | /generate-tests | `/run-tests {UC-ID}` |
565
- | /run-tests (passing) | `/review-code {UC-ID}` |
566
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
567
- | /review-code | `/smoke-test {UC-ID}` or create PR |
568
- | /smoke-test | Create PR and link to ticket |
569
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
563
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
564
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
565
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
566
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
567
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
568
+ | /dev-smoke-test | Create PR and link to ticket |
569
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
570
570
  | /fix-bug | Create PR and link to ticket |
571
571
  | /debug | `/fix-bug {ticket-id}` if fix needed |
572
572
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -165,7 +165,7 @@ cd -
165
165
  git add {spec_source} && git commit -m "chore: bump spec pointer ({UC-ID} tech design)"
166
166
  ```
167
167
 
168
- If `tech_docs_dir` is **local** (single-service, or per-service routing in a multi-service umbrella), skip this no cross-repo publish needed.
168
+ If `tech_docs_dir` is **local** — i.e. no `setup.spec_source` (single-repo, or a pure multi-service BE repo with no shared spec module) skip this; no cross-repo publish needed. Whenever `spec_source` is set, tech-docs route to the spec submodule and this publish step applies.
169
169
 
170
170
  ## Output
171
171
 
package/commands/learn.md CHANGED
@@ -172,7 +172,7 @@ If `services` section is present:
172
172
 
173
173
  **2. Route to service** — if active domain matches a key in `services`:
174
174
  - Override `paths.specs_dir` → `services.{domain}.specs_dir`
175
- - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
175
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, the tech-design (API contract) is a cross-team artifact and must live in the shared spec repo (handled in step 4), so leave `tech_docs_dir` for step 4 to route — do NOT pin it per-service here.
176
176
  - Store `active_service` = `services.{domain}.path`
177
177
  - Store `active_service_module` = `services.{domain}.module`
178
178
  - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
@@ -184,7 +184,7 @@ If `services` section is present:
184
184
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
185
185
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
186
186
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
187
- - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **only if step 2 did not already route it to a service** (multi-service umbrellas keep per-service tech-docs). This publishes the BE-authored API contract into the shared spec repo so FE/App can read it via the spec submodule at `/generate-code --phase=integration`.
187
+ - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **always when `spec_source` is set** (step 2 no longer pins tech-docs per-service in this case). The tech-design IS the cross-team API contract: BE authors it here, and FE/App read it from the same spec submodule at `/generate-code --phase=integration`. *(Per-service tech-docs only happen when there is no `spec_source` — a pure multi-service BE repo with no shared spec module.)*
188
188
  - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
189
189
  - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
190
190
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
@@ -215,7 +215,7 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
215
215
  | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
216
216
 
217
217
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
218
- - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
218
+ - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
219
219
  - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
220
220
 
221
221
  **4. If service config not found** — keep umbrella defaults, still set `service_root = {active_service}` (path anchor is always needed even without a config override).
@@ -308,7 +308,7 @@ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
308
308
 
309
309
  If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
310
310
 
311
- 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).
311
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (dev-gen-test, debug, fix-bug, dev-smoke-test).
312
312
 
313
313
  ---
314
314
 
@@ -446,7 +446,7 @@ If `lessons_path` does not exist, create it with this header first:
446
446
  | code-gen | /generate-code output |
447
447
  | bdd | /generate-bdd output |
448
448
  | tech-docs | /generate-tech-docs output |
449
- | tests | /generate-tests output |
449
+ | tests | /dev-gen-test output |
450
450
  | prd | /generate-prd, /refine-prd output |
451
451
  | general | every command |
452
452
 
@@ -513,13 +513,13 @@ Suggest the logical next command based on workflow phase:
513
513
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
514
514
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
515
515
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
516
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
517
- | /generate-tests | `/run-tests {UC-ID}` |
518
- | /run-tests (passing) | `/review-code {UC-ID}` |
519
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
520
- | /review-code | `/smoke-test {UC-ID}` or create PR |
521
- | /smoke-test | Create PR and link to ticket |
522
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
516
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
517
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
518
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
519
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
520
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
521
+ | /dev-smoke-test | Create PR and link to ticket |
522
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
523
523
  | /fix-bug | Create PR and link to ticket |
524
524
  | /debug | `/fix-bug {ticket-id}` if fix needed |
525
525
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -172,7 +172,7 @@ If `services` section is present:
172
172
 
173
173
  **2. Route to service** — if active domain matches a key in `services`:
174
174
  - Override `paths.specs_dir` → `services.{domain}.specs_dir`
175
- - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
175
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, the tech-design (API contract) is a cross-team artifact and must live in the shared spec repo (handled in step 4), so leave `tech_docs_dir` for step 4 to route — do NOT pin it per-service here.
176
176
  - Store `active_service` = `services.{domain}.path`
177
177
  - Store `active_service_module` = `services.{domain}.module`
178
178
  - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
@@ -184,7 +184,7 @@ If `services` section is present:
184
184
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
185
185
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
186
186
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
187
- - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **only if step 2 did not already route it to a service** (multi-service umbrellas keep per-service tech-docs). This publishes the BE-authored API contract into the shared spec repo so FE/App can read it via the spec submodule at `/generate-code --phase=integration`.
187
+ - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **always when `spec_source` is set** (step 2 no longer pins tech-docs per-service in this case). The tech-design IS the cross-team API contract: BE authors it here, and FE/App read it from the same spec submodule at `/generate-code --phase=integration`. *(Per-service tech-docs only happen when there is no `spec_source` — a pure multi-service BE repo with no shared spec module.)*
188
188
  - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
189
189
  - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
190
190
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
@@ -215,7 +215,7 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
215
215
  | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
216
216
 
217
217
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
218
- - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
218
+ - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
219
219
  - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
220
220
 
221
221
  **4. If service config not found** — keep umbrella defaults, still set `service_root = {active_service}` (path anchor is always needed even without a config override).
@@ -308,7 +308,7 @@ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
308
308
 
309
309
  If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
310
310
 
311
- 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).
311
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (dev-gen-test, debug, fix-bug, dev-smoke-test).
312
312
 
313
313
  ---
314
314
 
@@ -470,13 +470,13 @@ Suggest the logical next command based on workflow phase:
470
470
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
471
471
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
472
472
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
473
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
474
- | /generate-tests | `/run-tests {UC-ID}` |
475
- | /run-tests (passing) | `/review-code {UC-ID}` |
476
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
477
- | /review-code | `/smoke-test {UC-ID}` or create PR |
478
- | /smoke-test | Create PR and link to ticket |
479
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
473
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
474
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
475
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
476
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
477
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
478
+ | /dev-smoke-test | Create PR and link to ticket |
479
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
480
480
  | /fix-bug | Create PR and link to ticket |
481
481
  | /debug | `/fix-bug {ticket-id}` if fix needed |
482
482
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -511,7 +511,7 @@ Proposed scenario (DRAFT — pending PO/Dev review):
511
511
  For PO/Dev to promote:
512
512
  [ ] AC mapping correct? (or update PRD if requirement is actually new)
513
513
  [ ] Add scenario to {bdd_path} (edit, or re-run /generate-bdd if PRD changed)
514
- [ ] Then: /generate-code {UC-ID} + /generate-tests {UC-ID}
514
+ [ ] Then: /generate-code {UC-ID} + /dev-gen-test {UC-ID}
515
515
 
516
516
  Handoff : {✅ committed + pushed to spec repo | ⚠️ run git commands above / open a PR}
517
517
 
@@ -98,7 +98,7 @@ Proposed scenario (DRAFT — pending PO/Dev review):
98
98
  For PO/Dev to promote:
99
99
  [ ] AC mapping correct? (or update PRD if requirement is actually new)
100
100
  [ ] Add scenario to {bdd_path} (edit, or re-run /generate-bdd if PRD changed)
101
- [ ] Then: /generate-code {UC-ID} + /generate-tests {UC-ID}
101
+ [ ] Then: /generate-code {UC-ID} + /dev-gen-test {UC-ID}
102
102
 
103
103
  Handoff : {✅ committed + pushed to spec repo | ⚠️ run git commands above / open a PR}
104
104
 
@@ -163,7 +163,7 @@ If `services` section is present:
163
163
 
164
164
  **2. Route to service** — if active domain matches a key in `services`:
165
165
  - Override `paths.specs_dir` → `services.{domain}.specs_dir`
166
- - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
166
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, the tech-design (API contract) is a cross-team artifact and must live in the shared spec repo (handled in step 4), so leave `tech_docs_dir` for step 4 to route — do NOT pin it per-service here.
167
167
  - Store `active_service` = `services.{domain}.path`
168
168
  - Store `active_service_module` = `services.{domain}.module`
169
169
  - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
@@ -175,7 +175,7 @@ If `services` section is present:
175
175
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
176
176
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
177
177
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
178
- - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **only if step 2 did not already route it to a service** (multi-service umbrellas keep per-service tech-docs). This publishes the BE-authored API contract into the shared spec repo so FE/App can read it via the spec submodule at `/generate-code --phase=integration`.
178
+ - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **always when `spec_source` is set** (step 2 no longer pins tech-docs per-service in this case). The tech-design IS the cross-team API contract: BE authors it here, and FE/App read it from the same spec submodule at `/generate-code --phase=integration`. *(Per-service tech-docs only happen when there is no `spec_source` — a pure multi-service BE repo with no shared spec module.)*
179
179
  - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
180
180
  - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
181
181
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
@@ -206,7 +206,7 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
206
206
  | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
207
207
 
208
208
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
209
- - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
209
+ - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
210
210
  - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
211
211
 
212
212
  **4. If service config not found** — keep umbrella defaults, still set `service_root = {active_service}` (path anchor is always needed even without a config override).
@@ -299,7 +299,7 @@ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
299
299
 
300
300
  If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
301
301
 
302
- 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).
302
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (dev-gen-test, debug, fix-bug, dev-smoke-test).
303
303
 
304
304
  ---
305
305
 
@@ -363,15 +363,164 @@ Proceed to the next step of the calling command.
363
363
 
364
364
  ---
365
365
 
366
- ## Analyze — 4 Lenses (run all four)
366
+ ## Review Procedure
367
+ # Exhaustive Review Fan-Out + Completeness Convergence
367
368
 
368
- **QA Lens**: Are ACs testable? Edge cases specified? Boundary conditions defined?
369
+ **Why this exists:** A single-pass review never lists every issue at once — the model
370
+ stops at "enough" findings, so each later review round surfaces *new* problems
371
+ (whack-a-mole). This procedure forces the review to **converge in one command run**:
372
+ fan out across review dimensions in parallel, then loop a completeness critic until a
373
+ round produces nothing new, *before* writing the findings file.
369
374
 
370
- **DEV Lens**: Are API inputs/outputs clear? Business rules unambiguous? Cross-service deps fully described? Any technical risk?
375
+ The calling command supplies two things:
376
+ - **DIMENSIONS** — the list of review dimensions to fan out over
377
+ (`/refine-prd` → the 4 lenses; `/review-context` → the P-checks or B-checks).
378
+ - **FINDINGS SCHEMA** — the YAML shape each finding must follow (defined in the command).
371
379
 
372
- **SA Lens**: Fits existing architecture? Security/auth implications? Data modeling clear?
380
+ > **Sub-agent mode bypass:** If Gate Step 0 set `_agent_mode: true`, this whole
381
+ > procedure is **skipped** — the orchestrator is already running one dimension/UC per
382
+ > sub-agent. Run the command's checks directly on the scoped section and return findings.
373
383
 
374
- **PO Lens**: Scope bounded? Priorities clear? Success metrics defined? Scope creep risk?
384
+ ---
385
+
386
+ ## Phase 1 — Parallel dimension scan
387
+
388
+ **How many sub-agents:** the agent *count* is not the completeness lever — breadth is
389
+ fixed by the DIMENSION taxonomy (adding agents to the same dimension just re-finds the
390
+ same issues), and *depth* is owned by the Phase 2 critic loop. Pick the **fan-out
391
+ granularity** by target size, reusing the `steps/spawn-agent.md` thresholds:
392
+
393
+ | Target size | Granularity | Agent count |
394
+ |-------------|-------------|-------------|
395
+ | ≤ 3 UCs **and** ≤ 300 lines | one agent per DIMENSION over the whole file | = number of dimensions |
396
+ | > 3 UCs **or** > 300 lines | one agent per **DIMENSION × UC-scope** (UCs + a PRD-global scope), batched to fit the agent cap | `dimensions × (UCs + 1)`, capped (see below) |
397
+
398
+ The larger granularity keeps each sub-agent's context small and its scan exhaustive on a
399
+ single UC — which is what prevents misses on big PRDs.
400
+
401
+ > **Global (non-UC) sections — required in `DIMENSION × UC` mode.** Per-UC agents only
402
+ > see one UC each, so PRD-wide sections that belong to no UC (scope, success metrics,
403
+ > problem statement, terminology, glossary, changelog) would go unscanned. Whenever you
404
+ > fan out per UC, also include a **"PRD-global"** scope (the non-UC sections, findings get
405
+ > `uc_id: ""`) alongside the UC list. So the natural agent count is `dimensions × (UCs + 1)`.
406
+ > (Not needed in the whole-file mode — there each agent already sees the global sections.)
407
+
408
+ ### Agent cap — batch UCs when the fan-out gets too wide
409
+
410
+ `dimensions × (UCs + 1)` can explode on large PRDs (e.g. 6 checks × (8 UCs + 1) = 54
411
+ agents). Cap the wave at **`AGENT_CAP = 12`** agents and batch UC scopes to fit:
412
+
413
+ 1. Build the scope list = `[UC1, UC2, …, UCn, PRD-global]` (length `UCs + 1`).
414
+ 2. Compute scopes-per-agent-bucket: `groups = max(1, floor(AGENT_CAP / dimensions))`.
415
+ - If `groups ≥ UCs + 1` → no batching needed, run one agent per `DIMENSION × scope`.
416
+ - Else split the scope list into `groups` contiguous buckets of roughly equal size
417
+ (keep `PRD-global` in its own bucket if it fits; otherwise append it to the last
418
+ bucket). Each agent then handles **one DIMENSION over one bucket of UCs**.
419
+ 3. Resulting wave size = `dimensions × groups ≤ AGENT_CAP`.
420
+
421
+ A batched agent reviews several UCs at once — still scoped far tighter than the whole
422
+ file, so coverage stays high. `AGENT_CAP` is the only knob; raise it if the host allows
423
+ more concurrency, lower it to save tokens. Whole-file mode (≤ 3 UCs) never hits the cap.
424
+
425
+ Spawn the chosen sub-agents using the Agent tool (send them in a single message so they
426
+ run concurrently). Each sub-agent gets a **fresh context window** and scans its scope
427
+ through its **one** dimension only — deeper coverage than one session juggling every
428
+ dimension at once (avoids lost-in-the-middle).
429
+
430
+ Sub-agent prompt template (fill the braces):
431
+
432
+ ```
433
+ You are a {DIMENSION_NAME} reviewer. Read the full target file at {target_file}.
434
+ Scope: review ONLY through the {DIMENSION_NAME} lens/check — {DIMENSION_DESCRIPTION}.
435
+ Be exhaustive: scan every section, every UC, every AC/BR/scenario. Do not stop early.
436
+ Project context (terminology, entities, architecture):
437
+ {slim_context — banned terms, canonical entities, layer order, domains}
438
+
439
+ Return a JSON array of findings, each:
440
+ { "dimension": "{DIMENSION_NAME}", "severity": "critical|major|minor",
441
+ "section": "...", "uc_id": "...", "quote": "<verbatim ≤120 chars>",
442
+ "finding": "...", "suggestion": "...", "auto_fixable": true|false }
443
+ Return [] if this dimension is clean. Return ONLY the JSON array.
444
+ ```
445
+
446
+ Collect every sub-agent's array into one consolidated list `ALL_FINDINGS`.
447
+
448
+ ---
449
+
450
+ ## Phase 2 — Completeness-critic convergence loop
451
+
452
+ This is the anti-whack-a-mole step. Repeat until **two consecutive rounds add zero new
453
+ findings**, or a hard cap of **3 rounds**, whichever comes first:
454
+
455
+ 1. Spawn one **completeness-critic** sub-agent with the Agent tool. Give it:
456
+ - the full target file (`{target_file}`),
457
+ - the current `ALL_FINDINGS` list (so it knows what is already captured),
458
+ - the same slim context.
459
+ Prompt it:
460
+ ```
461
+ Here is a document and a list of issues already found. Read the WHOLE document.
462
+ List ONLY real, additional issues NOT already in the list — gaps, ambiguities,
463
+ contradictions, missing edge/negative paths, coverage holes, terminology drift,
464
+ structural omissions, and any issue that a fix to an existing finding would expose.
465
+ Do NOT repeat anything already listed. Return the same finding JSON shape, or [] if
466
+ nothing new.
467
+ ```
468
+ 2. Append any genuinely new findings (not already in `ALL_FINDINGS`) to the list.
469
+ 3. If this round returned 0 new → increment the dry-round counter; else reset it to 0.
470
+ 4. Stop when dry-round counter reaches 2, or after 3 rounds total.
471
+
472
+ Record `convergence_rounds` (how many critic rounds ran) for the report.
473
+
474
+ ---
475
+
476
+ ## Phase 3 — Dedup, resolve conflicts, merge
477
+
478
+ Sub-agents run **blind to each other** (independence = diverse coverage). They never
479
+ talk or reconcile among themselves — all duplicate/conflict resolution happens **here in
480
+ the orchestrator**, where the full set is visible.
481
+
482
+ 1. **Deduplicate** `ALL_FINDINGS`: two findings are duplicates if they target the same
483
+ `section` + `uc_id` and describe the same underlying issue. Keep the one with the
484
+ richer `suggestion`; if they differ on severity, keep the **higher** severity.
485
+ 2. **Resolve conflicts** — group remaining findings by `section` + `uc_id` and check for
486
+ contradictions (two findings whose `suggestion`s cannot both be applied, or that
487
+ propose opposite fixes for the same spot):
488
+ - If the two suggestions can be **merged** into one coherent fix → merge them into a
489
+ single finding.
490
+ - If they are **mutually exclusive** → emit **one** finding that states both options
491
+ and set `auto_fixable: false` with `status: "needs_discussion"` (PRD) /
492
+ `status: "pending"` (review) so a human picks — never silently drop one side.
493
+ - If a finding is **invalidated** by another (e.g. a structural finding says a section
494
+ is missing, but another quotes content from it) → drop the invalid one.
495
+ 3. **Sort** by severity (critical → major → minor), then by `section` order in the file.
496
+ 4. **Assign stable IDs** `F001, F002, …` in that sorted order.
497
+ 5. Map each finding's `dimension` into the command's schema field
498
+ (`lens` for `/refine-prd`; `check_id` for `/review-context`).
499
+ 6. Write the **single** findings file in the FINDINGS SCHEMA the command defines.
500
+
501
+ In the command's final report, add one line:
502
+ ```
503
+ Convergence: {convergence_rounds} critic round(s) — findings file is complete; re-running should surface 0 new issues.
504
+ ```
505
+
506
+
507
+ ---
508
+
509
+ ## Analyze — 4 Lenses (fan out over all four, then converge)
510
+
511
+ Run the review through the **Review Procedure** above (`steps/review-fanout.md`).
512
+
513
+ **DIMENSIONS** = the 4 lenses below — fan out one sub-agent per lens, each scanning the
514
+ full PRD through its single lens:
515
+
516
+ - **QA Lens**: Are ACs testable? Edge cases specified? Boundary conditions defined?
517
+ - **DEV Lens**: Are API inputs/outputs clear? Business rules unambiguous? Cross-service deps fully described? Any technical risk?
518
+ - **SA Lens**: Fits existing architecture? Security/auth implications? Data modeling clear?
519
+ - **PO Lens**: Scope bounded? Priorities clear? Success metrics defined? Scope creep risk?
520
+
521
+ The completeness-critic loop (Phase 2) is what guarantees the findings file is complete
522
+ in one run — re-running `/refine-prd` should surface **0 new** findings. Map each
523
+ dimension into the `lens` field of the schema below.
375
524
 
376
525
  ## Output File
377
526
 
@@ -451,13 +600,13 @@ Suggest the logical next command based on workflow phase:
451
600
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
452
601
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
453
602
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
454
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
455
- | /generate-tests | `/run-tests {UC-ID}` |
456
- | /run-tests (passing) | `/review-code {UC-ID}` |
457
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
458
- | /review-code | `/smoke-test {UC-ID}` or create PR |
459
- | /smoke-test | Create PR and link to ticket |
460
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
603
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
604
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
605
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
606
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
607
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
608
+ | /dev-smoke-test | Create PR and link to ticket |
609
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
461
610
  | /fix-bug | Create PR and link to ticket |
462
611
  | /debug | `/fix-bug {ticket-id}` if fix needed |
463
612
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -10,15 +10,26 @@
10
10
 
11
11
  ---
12
12
 
13
- ## Analyze — 4 Lenses (run all four)
13
+ ## Review Procedure
14
+ {{include:steps/review-fanout.md}}
14
15
 
15
- **QA Lens**: Are ACs testable? Edge cases specified? Boundary conditions defined?
16
+ ---
17
+
18
+ ## Analyze — 4 Lenses (fan out over all four, then converge)
19
+
20
+ Run the review through the **Review Procedure** above (`steps/review-fanout.md`).
16
21
 
17
- **DEV Lens**: Are API inputs/outputs clear? Business rules unambiguous? Cross-service deps fully described? Any technical risk?
22
+ **DIMENSIONS** = the 4 lenses below fan out one sub-agent per lens, each scanning the
23
+ full PRD through its single lens:
18
24
 
19
- **SA Lens**: Fits existing architecture? Security/auth implications? Data modeling clear?
25
+ - **QA Lens**: Are ACs testable? Edge cases specified? Boundary conditions defined?
26
+ - **DEV Lens**: Are API inputs/outputs clear? Business rules unambiguous? Cross-service deps fully described? Any technical risk?
27
+ - **SA Lens**: Fits existing architecture? Security/auth implications? Data modeling clear?
28
+ - **PO Lens**: Scope bounded? Priorities clear? Success metrics defined? Scope creep risk?
20
29
 
21
- **PO Lens**: Scope bounded? Priorities clear? Success metrics defined? Scope creep risk?
30
+ The completeness-critic loop (Phase 2) is what guarantees the findings file is complete
31
+ in one run — re-running `/refine-prd` should surface **0 new** findings. Map each
32
+ dimension into the `lens` field of the schema below.
22
33
 
23
34
  ## Output File
24
35
 
@@ -172,7 +172,7 @@ If `services` section is present:
172
172
 
173
173
  **2. Route to service** — if active domain matches a key in `services`:
174
174
  - Override `paths.specs_dir` → `services.{domain}.specs_dir`
175
- - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
175
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, the tech-design (API contract) is a cross-team artifact and must live in the shared spec repo (handled in step 4), so leave `tech_docs_dir` for step 4 to route — do NOT pin it per-service here.
176
176
  - Store `active_service` = `services.{domain}.path`
177
177
  - Store `active_service_module` = `services.{domain}.module`
178
178
  - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
@@ -184,7 +184,7 @@ If `services` section is present:
184
184
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
185
185
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
186
186
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
187
- - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **only if step 2 did not already route it to a service** (multi-service umbrellas keep per-service tech-docs). This publishes the BE-authored API contract into the shared spec repo so FE/App can read it via the spec submodule at `/generate-code --phase=integration`.
187
+ - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **always when `spec_source` is set** (step 2 no longer pins tech-docs per-service in this case). The tech-design IS the cross-team API contract: BE authors it here, and FE/App read it from the same spec submodule at `/generate-code --phase=integration`. *(Per-service tech-docs only happen when there is no `spec_source` — a pure multi-service BE repo with no shared spec module.)*
188
188
  - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
189
189
  - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
190
190
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
@@ -215,7 +215,7 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
215
215
  | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
216
216
 
217
217
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
218
- - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
218
+ - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
219
219
  - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
220
220
 
221
221
  **4. If service config not found** — keep umbrella defaults, still set `service_root = {active_service}` (path anchor is always needed even without a config override).
@@ -308,7 +308,7 @@ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
308
308
 
309
309
  If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
310
310
 
311
- 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).
311
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (dev-gen-test, debug, fix-bug, dev-smoke-test).
312
312
 
313
313
  ---
314
314
 
@@ -487,13 +487,13 @@ Suggest the logical next command based on workflow phase:
487
487
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
488
488
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
489
489
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
490
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
491
- | /generate-tests | `/run-tests {UC-ID}` |
492
- | /run-tests (passing) | `/review-code {UC-ID}` |
493
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
494
- | /review-code | `/smoke-test {UC-ID}` or create PR |
495
- | /smoke-test | Create PR and link to ticket |
496
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
490
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
491
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
492
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
493
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
494
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
495
+ | /dev-smoke-test | Create PR and link to ticket |
496
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
497
497
  | /fix-bug | Create PR and link to ticket |
498
498
  | /debug | `/fix-bug {ticket-id}` if fix needed |
499
499
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |