@anhth2/spec-driven-dev-plugin 0.9.2 → 0.11.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 (223) hide show
  1. package/commands/debug.md +50 -20
  2. package/commands/define-product.md +49 -19
  3. package/commands/{generate-tests.md → dev-gen-test.md} +85 -23
  4. package/commands/{generate-tests.tmpl → dev-gen-test.tmpl} +18 -4
  5. package/{core/commands/run-tests.md → commands/dev-run-test.md} +102 -21
  6. package/commands/{run-tests.tmpl → dev-run-test.tmpl} +35 -2
  7. package/commands/{smoke-test.md → dev-smoke-test.md} +54 -24
  8. package/commands/{smoke-test.tmpl → dev-smoke-test.tmpl} +5 -5
  9. package/commands/fix-bug.md +50 -20
  10. package/commands/generate-bdd.md +78 -21
  11. package/commands/generate-bdd.tmpl +11 -2
  12. package/commands/generate-code.md +123 -23
  13. package/commands/generate-code.tmpl +56 -4
  14. package/commands/generate-design-spec.md +142 -47
  15. package/commands/generate-design-spec.tmpl +93 -28
  16. package/commands/generate-prd.md +49 -19
  17. package/commands/generate-spec-manifest.md +49 -19
  18. package/commands/generate-tech-docs.md +50 -20
  19. package/commands/generate-tech-docs.tmpl +1 -1
  20. package/commands/learn.md +50 -20
  21. package/commands/propose-scenario.md +50 -20
  22. package/commands/propose-scenario.tmpl +1 -1
  23. package/commands/qc-analyze.md +514 -0
  24. package/commands/qc-analyze.tmpl +71 -0
  25. package/commands/qc-design-test.md +510 -0
  26. package/commands/qc-design-test.tmpl +67 -0
  27. package/commands/qc-plan.md +492 -0
  28. package/commands/qc-plan.tmpl +49 -0
  29. package/commands/qc-report.md +491 -0
  30. package/commands/qc-report.tmpl +48 -0
  31. package/commands/qc-review.md +496 -0
  32. package/commands/qc-review.tmpl +53 -0
  33. package/commands/qc-run-test.md +538 -0
  34. package/commands/qc-run-test.tmpl +77 -0
  35. package/commands/refine-prd.md +203 -24
  36. package/commands/refine-prd.tmpl +16 -5
  37. package/commands/report-bug.md +49 -19
  38. package/commands/review-code.md +51 -21
  39. package/commands/review-code.tmpl +1 -1
  40. package/commands/review-context.md +198 -20
  41. package/commands/review-context.tmpl +11 -1
  42. package/commands/review-tech-docs.md +49 -19
  43. package/commands/setup-ai-first.md +14 -7
  44. package/commands/sync.md +30 -20
  45. package/commands/sync.tmpl +16 -13
  46. package/commands/update-framework.md +14 -7
  47. package/commands/validate-traces.md +106 -45
  48. package/commands/validate-traces.tmpl +57 -26
  49. package/core/FRAMEWORK_VERSION +1 -1
  50. package/core/commands/debug.md +50 -20
  51. package/core/commands/define-product.md +49 -19
  52. package/core/commands/{generate-tests.md → dev-gen-test.md} +85 -23
  53. package/{commands/run-tests.md → core/commands/dev-run-test.md} +102 -21
  54. package/core/commands/{smoke-test.md → dev-smoke-test.md} +54 -24
  55. package/core/commands/fix-bug.md +50 -20
  56. package/core/commands/generate-bdd.md +78 -21
  57. package/core/commands/generate-code.md +123 -23
  58. package/core/commands/generate-design-spec.md +142 -47
  59. package/core/commands/generate-prd.md +49 -19
  60. package/core/commands/generate-spec-manifest.md +49 -19
  61. package/core/commands/generate-tech-docs.md +50 -20
  62. package/core/commands/learn.md +50 -20
  63. package/core/commands/propose-scenario.md +50 -20
  64. package/core/commands/qc-analyze.md +514 -0
  65. package/core/commands/qc-design-test.md +510 -0
  66. package/core/commands/qc-plan.md +492 -0
  67. package/core/commands/qc-report.md +491 -0
  68. package/core/commands/qc-review.md +496 -0
  69. package/core/commands/qc-run-test.md +538 -0
  70. package/core/commands/refine-prd.md +203 -24
  71. package/core/commands/report-bug.md +49 -19
  72. package/core/commands/review-code.md +51 -21
  73. package/core/commands/review-context.md +198 -20
  74. package/core/commands/review-tech-docs.md +49 -19
  75. package/core/commands/setup-ai-first.md +14 -7
  76. package/core/commands/sync.md +30 -20
  77. package/core/commands/update-framework.md +14 -7
  78. package/core/commands/validate-traces.md +106 -45
  79. package/core/modules/qc-playwright/stack-profile.yaml +65 -0
  80. package/core/skills/code/SKILL.md +63 -26
  81. package/core/skills/debug/SKILL.md +78 -34
  82. package/core/skills/design-spec/SKILL.md +49 -19
  83. package/core/skills/discovery/SKILL.md +49 -19
  84. package/core/skills/prd/SKILL.md +28 -14
  85. package/core/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  86. package/core/skills/qc/qa-analyst/acceptance-criteria.md +56 -0
  87. package/core/skills/qc/qa-analyst/business-rules.md +55 -0
  88. package/core/skills/qc/qa-analyst/data-flow.md +60 -0
  89. package/core/skills/qc/qa-analyst/spec-breakdown.md +57 -0
  90. package/core/skills/qc/qa-designer/e2e/journey.md +41 -0
  91. package/core/skills/qc/qa-designer/exploratory/charter.md +68 -0
  92. package/core/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  93. package/core/skills/qc/qa-designer/functional/api.md +45 -0
  94. package/core/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  95. package/core/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  96. package/core/skills/qc/qa-designer/integration/api.md +42 -0
  97. package/core/skills/qc/qa-designer/integration/db.md +39 -0
  98. package/core/skills/qc/qa-designer/integration/gui.md +40 -0
  99. package/core/skills/qc/qa-designer/integration/kafka.md +40 -0
  100. package/core/skills/qc/qa-designer/non-functional.md +40 -0
  101. package/core/skills/qc/qa-planner/test-plan.md +120 -0
  102. package/core/skills/qc/qa-reviewer/script/e2e.md +87 -0
  103. package/core/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  104. package/core/skills/qc/qa-reviewer/script/functional.md +101 -0
  105. package/core/skills/qc/qa-reviewer/script/integration.md +91 -0
  106. package/core/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  107. package/core/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  108. package/core/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  109. package/core/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  110. package/core/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  111. package/core/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  112. package/core/skills/qc/qa-runner/e2e.md +49 -0
  113. package/core/skills/qc/qa-runner/exploratory/session.md +36 -0
  114. package/core/skills/qc/qa-runner/functional/api.md +35 -0
  115. package/core/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  116. package/core/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  117. package/core/skills/qc/qa-runner/integration.md +47 -0
  118. package/core/skills/qc/qa-runner/non-functional.md +49 -0
  119. package/core/skills/qc/qa-runner/report/report.md +37 -0
  120. package/core/skills/setup-ai-first/SKILL.md +14 -7
  121. package/core/skills/spec/SKILL.md +28 -14
  122. package/core/skills/test/SKILL.md +121 -54
  123. package/core/steps/capture-lesson.md +1 -1
  124. package/core/steps/context-loader.md +35 -12
  125. package/core/steps/report-footer.md +14 -7
  126. package/core/steps/review-fanout.md +138 -0
  127. package/core/steps/spawn-agent.md +1 -1
  128. package/core/steps/trace-mirror.md +18 -0
  129. package/core/templates/design-spec.template.md +16 -8
  130. package/core/templates/project-context.yaml +8 -0
  131. package/docs/01-getting-started/README.md +19 -0
  132. package/docs/01-getting-started/core-concepts.md +102 -0
  133. package/docs/01-getting-started/installation.md +154 -0
  134. package/docs/01-getting-started/quickstart.md +85 -0
  135. package/docs/02-guides/README.md +27 -0
  136. package/docs/02-guides/developer/README.md +46 -0
  137. package/docs/02-guides/developer/bdd-and-trace.md +123 -0
  138. package/docs/02-guides/developer/commands.md +76 -0
  139. package/docs/02-guides/developer/pr-checklist.md +15 -0
  140. package/docs/02-guides/developer/scenarios.md +448 -0
  141. package/docs/02-guides/developer/workflow.md +59 -0
  142. package/docs/02-guides/product-owner/README.md +77 -0
  143. package/docs/02-guides/product-owner/commands.md +30 -0
  144. package/docs/02-guides/product-owner/handoff-checklist.md +42 -0
  145. package/docs/02-guides/product-owner/prd-writing-rules.md +45 -0
  146. package/docs/02-guides/product-owner/scenarios.md +357 -0
  147. package/docs/02-guides/qc-automation.md +92 -0
  148. package/docs/02-guides/tester/README.md +72 -0
  149. package/docs/02-guides/tester/bug-reporting.md +117 -0
  150. package/docs/02-guides/tester/reading-specs.md +79 -0
  151. package/docs/02-guides/tester/scenarios.md +186 -0
  152. package/docs/02-guides/tester/spec-manifest.md +124 -0
  153. package/docs/02-guides/tester/test-checklist.md +31 -0
  154. package/docs/02-guides/tester/workflow.md +79 -0
  155. package/docs/03-concepts/README.md +19 -0
  156. package/docs/03-concepts/architecture.md +243 -0
  157. package/docs/03-concepts/pipeline.md +249 -0
  158. package/docs/03-concepts/traceability.md +148 -0
  159. package/docs/04-operations/README.md +33 -0
  160. package/docs/04-operations/bug-flow.md +321 -0
  161. package/docs/04-operations/publishing.md +137 -0
  162. package/docs/04-operations/sync-and-update.md +328 -0
  163. package/docs/05-reference/README.md +29 -0
  164. package/docs/05-reference/commands.md +229 -0
  165. package/docs/05-reference/modules.md +110 -0
  166. package/docs/05-reference/trace-schema.md +146 -0
  167. package/docs/README.md +51 -0
  168. package/modules/qc-playwright/stack-profile.yaml +65 -0
  169. package/package.json +2 -2
  170. package/skills/code/SKILL.md +63 -26
  171. package/skills/debug/SKILL.md +78 -34
  172. package/skills/debug/SKILL.tmpl +1 -1
  173. package/skills/design-spec/SKILL.md +49 -19
  174. package/skills/discovery/SKILL.md +49 -19
  175. package/skills/prd/SKILL.md +28 -14
  176. package/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  177. package/skills/qc/qa-analyst/acceptance-criteria.md +56 -0
  178. package/skills/qc/qa-analyst/business-rules.md +55 -0
  179. package/skills/qc/qa-analyst/data-flow.md +60 -0
  180. package/skills/qc/qa-analyst/spec-breakdown.md +57 -0
  181. package/skills/qc/qa-designer/e2e/journey.md +41 -0
  182. package/skills/qc/qa-designer/exploratory/charter.md +68 -0
  183. package/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  184. package/skills/qc/qa-designer/functional/api.md +45 -0
  185. package/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  186. package/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  187. package/skills/qc/qa-designer/integration/api.md +42 -0
  188. package/skills/qc/qa-designer/integration/db.md +39 -0
  189. package/skills/qc/qa-designer/integration/gui.md +40 -0
  190. package/skills/qc/qa-designer/integration/kafka.md +40 -0
  191. package/skills/qc/qa-designer/non-functional.md +40 -0
  192. package/skills/qc/qa-planner/test-plan.md +120 -0
  193. package/skills/qc/qa-reviewer/script/e2e.md +87 -0
  194. package/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  195. package/skills/qc/qa-reviewer/script/functional.md +101 -0
  196. package/skills/qc/qa-reviewer/script/integration.md +91 -0
  197. package/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  198. package/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  199. package/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  200. package/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  201. package/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  202. package/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  203. package/skills/qc/qa-runner/e2e.md +49 -0
  204. package/skills/qc/qa-runner/exploratory/session.md +36 -0
  205. package/skills/qc/qa-runner/functional/api.md +35 -0
  206. package/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  207. package/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  208. package/skills/qc/qa-runner/integration.md +47 -0
  209. package/skills/qc/qa-runner/non-functional.md +49 -0
  210. package/skills/qc/qa-runner/report/report.md +37 -0
  211. package/skills/setup-ai-first/SKILL.md +14 -7
  212. package/skills/spec/SKILL.md +28 -14
  213. package/skills/test/SKILL.md +121 -54
  214. package/skills/test/SKILL.tmpl +9 -9
  215. package/steps/capture-lesson.md +1 -1
  216. package/steps/context-loader.md +35 -12
  217. package/steps/report-footer.md +14 -7
  218. package/steps/review-fanout.md +138 -0
  219. package/steps/spawn-agent.md +1 -1
  220. package/steps/trace-mirror.md +18 -0
  221. package/templates/design-spec.template.md +16 -8
  222. package/templates/project-context.yaml +8 -0
  223. package/ARCHITECTURE.md +0 -247
@@ -161,15 +161,22 @@ Suggest the logical next command based on workflow phase:
161
161
  | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
162
162
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
163
163
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
164
+ | /qc-analyze | `/qc-plan {UC-ID}` (resolve 🔴 blocker gaps first) |
165
+ | /qc-plan | `/qc-design-test {UC-ID}` |
166
+ | /qc-design-test | `/qc-review {UC-ID}` (test-case review) |
167
+ | /qc-review (test-case) | `/qc-run-test {UC-ID}` if APPROVED; fix TCs if NEEDS_FIX |
168
+ | /qc-run-test | `/qc-report {UC-ID}` then `/qc-review {UC-ID}` (script review) |
169
+ | /qc-review (script) | `/qc-report {UC-ID}` then create PR if APPROVED |
170
+ | /qc-report | `/validate-traces {UC-ID}` to refresh Living Docs (qc_status) |
164
171
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
165
172
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
166
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
167
- | /generate-tests | `/run-tests {UC-ID}` |
168
- | /run-tests (passing) | `/review-code {UC-ID}` |
169
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
170
- | /review-code | `/smoke-test {UC-ID}` or create PR |
171
- | /smoke-test | Create PR and link to ticket |
172
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
173
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
174
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
175
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
176
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
177
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
178
+ | /dev-smoke-test | Create PR and link to ticket |
179
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
173
180
  | /fix-bug | Create PR and link to ticket |
174
181
  | /debug | `/fix-bug {ticket-id}` if fix needed |
175
182
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -165,7 +165,7 @@ If `services` section is present:
165
165
 
166
166
  **2. Route to service** — if active domain matches a key in `services`:
167
167
  - Override `paths.specs_dir` → `services.{domain}.specs_dir`
168
- - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
168
+ - 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.
169
169
  - Store `active_service` = `services.{domain}.path`
170
170
  - Store `active_service_module` = `services.{domain}.module`
171
171
  - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
@@ -177,7 +177,7 @@ If `services` section is present:
177
177
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
178
178
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
179
179
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
180
- - 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`.
180
+ - 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.)*
181
181
  - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
182
182
  - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
183
183
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
@@ -208,7 +208,7 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
208
208
  | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
209
209
 
210
210
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
211
- - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
211
+ - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
212
212
  - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
213
213
 
214
214
  **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).
@@ -223,19 +223,41 @@ If the file does not exist → skip silently.
223
223
 
224
224
  ---
225
225
 
226
- ## Step 3 — [CRITICAL] Load CLAUDE.md
226
+ ## Step 3 — [CRITICAL] Load CLAUDE.md (layered: root + service overlay)
227
227
 
228
228
  *This is the highest-priority context — it defines HOW to write code and documents for this project.*
229
229
 
230
- Read `CLAUDE.md`. Extract and store:
230
+ CLAUDE.md is loaded in **two layers** so umbrella-wide rules and service-specific
231
+ architecture/coding standards compose correctly. The agent always sits at the umbrella
232
+ root, but the implementation code lives in a service submodule with its OWN stack,
233
+ architecture, and conventions — so the service's CLAUDE.md must win for code generation.
234
+
235
+ **Layer 1 — [BASE] Root CLAUDE.md (umbrella-wide).**
236
+ Read `CLAUDE.md` at the repo root. Treat its contents as the **shared baseline** for the
237
+ whole umbrella — git conventions, data-protection posture, cross-cutting rules, and (in
238
+ single-service mode) the project's only architecture + coding standards.
239
+
240
+ **Layer 2 — [OVERLAY] Service CLAUDE.md (umbrella mode only).**
241
+ *Run only if `service_root` was set in Step 1.6 (i.e. a real service was routed to).*
242
+ Read `{service_root}/CLAUDE.md`. This file defines the architecture + coding standards of
243
+ the **actual stack being implemented** (e.g. `user-service` = java-spring, `web` = nextjs).
244
+ Overlay it on top of Layer 1: **on any conflict, the service value WINS** for architecture,
245
+ coding standards, and error handling. Layer-1 values that the service does not redefine
246
+ (e.g. git conventions, banned patterns shared org-wide) remain in effect.
247
+
248
+ From the **merged** result, extract and store:
231
249
 
232
250
  - **§1 Project Overview** → project name, language, framework, build/test commands, domains
233
- - **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules
234
- - **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns
235
- - **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name
236
- - **§7 Git Conventions** → branch naming pattern, commit message format
251
+ - **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules — *service overlay wins*
252
+ - **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns — *service overlay wins*
253
+ - **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name — *service overlay wins*
254
+ - **§7 Git Conventions** → branch naming pattern, commit message format — *root baseline unless service redefines*
237
255
 
238
- If `CLAUDE.md` does not exist → note it as missing and continue with project-context.yaml data only.
256
+ **Resolution rules:**
257
+ - If both layers exist → merge as above; record `claude_md_source = root + {service_root}`.
258
+ - If only the service overlay exists (no root CLAUDE.md) → use the service file alone; `claude_md_source = {service_root}`.
259
+ - If `service_root` is set but `{service_root}/CLAUDE.md` is **missing** → fall back to root CLAUDE.md and flag ⚠️ in the Step 7 recap (the service has no architecture/coding-standards definition — code generation will use umbrella defaults, which may be the wrong stack).
260
+ - If neither exists → note CLAUDE.md as missing and continue with project-context.yaml data only.
239
261
 
240
262
  ---
241
263
 
@@ -301,7 +323,7 @@ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
301
323
 
302
324
  If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
303
325
 
304
- 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).
326
+ 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).
305
327
 
306
328
  ---
307
329
 
@@ -335,7 +357,8 @@ Output exactly this block:
335
357
  [CTX LOADED]
336
358
  Stack : {language} / {framework} / {database}
337
359
  Platform : {active_module} ({platform_type})
338
- Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
360
+ Layers : {layer order from merged CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
361
+ CLAUDE.md : {root + {service_root} | {service_root} only | root only | ⚠️ service overlay MISSING — using root | missing}
339
362
  Ticket : {ticket_prefix}-
340
363
  Dict : {loaded — N canonical terms, M banned terms | missing}
341
364
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
@@ -376,8 +399,12 @@ Check whether `services` array exists in `project-context.yaml`.
376
399
  - Use `services[N].trace_dir` if explicitly set
377
400
  - Otherwise default to `{services[N].path}/.trace`
378
401
  - Set `all_trace_dirs = [ dir1, dir2, ... ]` — one per service
379
- - Set `umbrella_root_trace = ".trace"` (at umbrella workspace root)
380
402
  - Step 1 will read TSVs from ALL dirs in `all_trace_dirs`, tagged by service name
403
+ - **Resolve the Living Docs home (canonical report location):**
404
+ - If `setup.spec_source` is set → `living_docs_dir = {spec_source}/.living-docs`
405
+ *(the shared specs module — mounted inside every service/umbrella workspace, so the panel resolves it no matter which submodule the dev is standing in)*
406
+ - Else (umbrella without a separate spec repo) → `living_docs_dir = .living-docs` at umbrella root
407
+ - **Resolve the panel mirror:** `panel_mirror = ./.trace` at the **current workspace root** (wherever this command runs). The VS Code panel reads `.trace/trace-report.json` from the open workspace — writing the merged report here is what makes the view non-empty when a dev opens a service submodule directly.
381
408
 
382
409
  **If no `services` key (single-service mode):**
383
410
  - Set `all_trace_dirs = [ {paths.trace_dir} ]`
@@ -440,6 +467,7 @@ If code was generated from an older revision → flag `TECHDOC_DRIFT`.
440
467
  *Skip this step if no TSV files existed (handled by Step 1 no-TSV path).*
441
468
 
442
469
  For each `.tsv` file processed: write updated `spec_ver`, `status`, `last_updated` back to disk.
470
+ Do **not** modify `dev_selftest`/`dev_selftest_at` (owned by `/dev-run-test`) or `qc_status`/`qc_run_at` (owned by `/qc-run-test`); this command only reads them for the report.
443
471
 
444
472
  ### Step 7 — Compute dashboard aggregates
445
473
 
@@ -455,6 +483,17 @@ test_coverage = rows where test_count > 0 / total_scs
455
483
  drift_count = rows where status == DRIFT
456
484
  untracked_count = rows where status == UNTRACKED
457
485
  gap_count = rows where status == GAP
486
+ dev_selftest_passing = rows where dev_selftest == pass
487
+ dev_selftest_failing = rows where dev_selftest == fail
488
+ dev_selftest_not_run = rows where dev_selftest in (not_run, —)
489
+ # NOTE: dev_selftest is the DEV self-check signal (did the dev run their own smoke tests),
490
+ # NOT official coverage — keep it labeled as such on the dashboard.
491
+ qc_passing = rows where qc_status == pass
492
+ qc_failing = rows where qc_status == fail
493
+ qc_skipped = rows where qc_status == skip
494
+ qc_not_run = rows where qc_status in (not_run, —)
495
+ # qc_status is the OFFICIAL QC automation result (set by /qc-run-test),
496
+ # shown alongside — never merged with — dev_selftest.
458
497
  tech_docs_count = count .md files in {paths.tech_docs_dir}/{domain}/
459
498
  ```
460
499
 
@@ -482,6 +521,13 @@ Schema:
482
521
  "drift_count": 0,
483
522
  "gap_count": 0,
484
523
  "untracked_count": 0,
524
+ "dev_selftest_passing": 0,
525
+ "dev_selftest_failing": 0,
526
+ "dev_selftest_not_run": 0,
527
+ "qc_passing": 0,
528
+ "qc_failing": 0,
529
+ "qc_skipped": 0,
530
+ "qc_not_run": 0,
485
531
  "tech_docs_count": 0
486
532
  },
487
533
  "prds": [
@@ -507,6 +553,10 @@ Schema:
507
553
  "implemented_by": "<ClassName.method or null>",
508
554
  "test_count": 0,
509
555
  "test_classes": ["<TestClass1>", "<TestClass2>"],
556
+ "dev_selftest": "pass | fail | not_run",
557
+ "dev_selftest_at": "<YYYY-MM-DD or null>",
558
+ "qc_status": "pass | fail | skip | not_run",
559
+ "qc_run_at": "<YYYY-MM-DD or null>",
510
560
  "prd_version": "<prd version when BDD was generated>",
511
561
  "bdd_version": "<bdd version when code was generated>",
512
562
  "tech_doc_revision": 0,
@@ -533,7 +583,7 @@ Schema:
533
583
  "sc_id": "<SC-ID>",
534
584
  "sc_title": "<title>",
535
585
  "implemented_by": "<method>",
536
- "fix": "/generate-tests <UC-ID>"
586
+ "fix": "/dev-gen-test <UC-ID>"
537
587
  }
538
588
  ],
539
589
  "untracked": [
@@ -571,37 +621,40 @@ Schema:
571
621
  - `tech_doc_revision`: use integer; `0` if not yet generated
572
622
  - `code_coverage_pct` / `test_coverage_pct`: round to nearest integer (0–100)
573
623
  - Always write to `{paths.trace_dir}/trace-report.json` regardless of domain filter — if a domain filter was applied, include only those PRDs in `prds[]` but note the domain in the `domain` field
574
- - **TSV `"—"` mapping**: when reading TSV files, map dash values to JSON types: `implemented_by: "—"` → `null`; `test_count: "—"` → `0`; `test_classes: "—"` → `[]`; `tech_doc_revision: "—"` → `0`
624
+ - **TSV `"—"` mapping**: when reading TSV files, map dash values to JSON types: `implemented_by: "—"` → `null`; `test_count: "—"` → `0`; `test_classes: "—"` → `[]`; `tech_doc_revision: "—"` → `0`; `dev_selftest: "—"` → `"not_run"`; `dev_selftest_at: "—"` → `null`; `qc_status: "—"` → `"not_run"`; `qc_run_at: "—"` → `null`
575
625
 
576
- ### Step 8b — Umbrella Living Docs Sync *(umbrella mode only)*
626
+ ### Step 8b — Living Docs Sync *(umbrella mode only)*
577
627
 
578
628
  *Skip this step in single-service mode.*
579
629
 
580
- After writing each service's `trace-report.json`, sync trace files to the umbrella root so the Living Docs VS Code panel (opened at umbrella root) can read them:
630
+ Authoritative trace state stays in each service submodule's `.trace/` (committed there).
631
+ This step publishes the merged report to the **canonical Living Docs home** (the specs
632
+ module) and drops a local mirror so the panel is never empty.
581
633
 
582
- 1. Create directory `{umbrella_root_trace}/` if it does not exist (`mkdir -p .trace`).
583
-
584
- 2. **Copy TSV files** from each service trace dir to umbrella trace dir with service namespace:
585
- ```
586
- {service.path}/.trace/{UC-ID}.tsv → .trace/{service-name}/{UC-ID}.tsv
587
- ```
588
- Overwrite if exists. Do not delete files in `.trace/` that no longer have a service source — they may be from a previous run.
634
+ 1. **Write canonical merged report** to `{living_docs_dir}/` (`mkdir -p` it first):
635
+ - `{living_docs_dir}/trace-report.json` — merge every per-service `trace-report.json`
636
+ into one document, add a `"service"` field per scenario row, recalc summary aggregates.
637
+ - `{living_docs_dir}/{service-name}/{UC-ID}.tsv` — copy each service's TSVs, namespaced
638
+ by service. Overwrite; don't delete TSVs whose service source is gone (prior runs).
589
639
 
590
- 3. **Write aggregated `trace-report.json`** to `{umbrella_root_trace}/trace-report.json`:
591
- - Merge all per-service `trace-report.json` data into one document
592
- - Add `"service"` field to each scenario row
593
- - Recalculate summary aggregates across all services
640
+ 2. **Mirror to the panel location** `{panel_mirror}` (`./.trace` at the current workspace
641
+ root) so a dev who opened *this* repo (umbrella **or** a single service submodule) sees
642
+ data immediately: copy `{living_docs_dir}/trace-report.json` `{panel_mirror}/trace-report.json`
643
+ (and the namespaced TSVs). If `panel_mirror` already resolves to `living_docs_dir`, skip.
594
644
 
595
- 4. **Print sync summary:**
645
+ 3. **Print sync summary:**
596
646
  ```
597
- Umbrella sync.trace/
598
- user-service : {N} TSV files copied
599
- order-service : {N} TSV files copied
647
+ Living Docs{living_docs_dir}/ (canonical, in specs module)
648
+ user-service : {N} TSV files
649
+ order-service : {N} TSV files
600
650
  trace-report.json: merged ({total} scenarios across {S} services)
601
- Living Docs panel will reflect this data immediately.
651
+ Panel mirror {panel_mirror}/trace-report.json (current workspace)
602
652
  ```
603
653
 
604
- > **Note:** `.trace/` at umbrella root is a **read-only mirror** do NOT commit it to the umbrella repo. Add `.trace/` to the umbrella's `.gitignore`. Authoritative trace state lives in each service submodule's `.trace/` dir and is committed there.
654
+ > **Note — both locations are generated, gitignored mirrors.** Add `.living-docs/` to the
655
+ > **specs module's** `.gitignore` and `.trace/` to the current repo's `.gitignore`. The only
656
+ > committed, authoritative trace state is each service submodule's own `.trace/`. The report
657
+ > is regenerated by `/validate-traces` or `/sync` — never commit it.
605
658
 
606
659
  ## Output
607
660
 
@@ -641,15 +694,22 @@ Suggest the logical next command based on workflow phase:
641
694
  | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
642
695
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
643
696
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
697
+ | /qc-analyze | `/qc-plan {UC-ID}` (resolve 🔴 blocker gaps first) |
698
+ | /qc-plan | `/qc-design-test {UC-ID}` |
699
+ | /qc-design-test | `/qc-review {UC-ID}` (test-case review) |
700
+ | /qc-review (test-case) | `/qc-run-test {UC-ID}` if APPROVED; fix TCs if NEEDS_FIX |
701
+ | /qc-run-test | `/qc-report {UC-ID}` then `/qc-review {UC-ID}` (script review) |
702
+ | /qc-review (script) | `/qc-report {UC-ID}` then create PR if APPROVED |
703
+ | /qc-report | `/validate-traces {UC-ID}` to refresh Living Docs (qc_status) |
644
704
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
645
705
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
646
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
647
- | /generate-tests | `/run-tests {UC-ID}` |
648
- | /run-tests (passing) | `/review-code {UC-ID}` |
649
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
650
- | /review-code | `/smoke-test {UC-ID}` or create PR |
651
- | /smoke-test | Create PR and link to ticket |
652
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
706
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
707
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
708
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
709
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
710
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
711
+ | /dev-smoke-test | Create PR and link to ticket |
712
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
653
713
  | /fix-bug | Create PR and link to ticket |
654
714
  | /debug | `/fix-bug {ticket-id}` if fix needed |
655
715
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -702,11 +762,12 @@ Tech-Doc Revision Drift:
702
762
 
703
763
  Recommendations:
704
764
  - /generate-code {UC-ID} for DRIFT and UNTRACKED scenarios
705
- - /generate-tests {UC-ID} for GAP (missing tests)
765
+ - /dev-gen-test {UC-ID} for GAP (missing tests)
706
766
  - /generate-bdd {prd-file} for PRD version drift
707
767
 
708
768
  [Umbrella mode only]
709
- Living Docs synced.trace/ (umbrella root)
710
- Tip: run /validate-traces after each codegen session to refresh the panel.
711
- .trace/ at umbrella root is a mirror do not commit it (add to .gitignore).
769
+ Living Docs canonical{living_docs_dir}/ (specs module — shared, gitignored)
770
+ Panel mirror → {panel_mirror}/trace-report.json (current workspace)
771
+ Tip: run /validate-traces (or /sync) after each codegen session to refresh the panel.
772
+ Both are generated mirrors — do not commit (.living-docs/ + .trace/ in .gitignore).
712
773
  ```
@@ -23,8 +23,12 @@ Check whether `services` array exists in `project-context.yaml`.
23
23
  - Use `services[N].trace_dir` if explicitly set
24
24
  - Otherwise default to `{services[N].path}/.trace`
25
25
  - Set `all_trace_dirs = [ dir1, dir2, ... ]` — one per service
26
- - Set `umbrella_root_trace = ".trace"` (at umbrella workspace root)
27
26
  - Step 1 will read TSVs from ALL dirs in `all_trace_dirs`, tagged by service name
27
+ - **Resolve the Living Docs home (canonical report location):**
28
+ - If `setup.spec_source` is set → `living_docs_dir = {spec_source}/.living-docs`
29
+ *(the shared specs module — mounted inside every service/umbrella workspace, so the panel resolves it no matter which submodule the dev is standing in)*
30
+ - Else (umbrella without a separate spec repo) → `living_docs_dir = .living-docs` at umbrella root
31
+ - **Resolve the panel mirror:** `panel_mirror = ./.trace` at the **current workspace root** (wherever this command runs). The VS Code panel reads `.trace/trace-report.json` from the open workspace — writing the merged report here is what makes the view non-empty when a dev opens a service submodule directly.
28
32
 
29
33
  **If no `services` key (single-service mode):**
30
34
  - Set `all_trace_dirs = [ {paths.trace_dir} ]`
@@ -87,6 +91,7 @@ If code was generated from an older revision → flag `TECHDOC_DRIFT`.
87
91
  *Skip this step if no TSV files existed (handled by Step 1 no-TSV path).*
88
92
 
89
93
  For each `.tsv` file processed: write updated `spec_ver`, `status`, `last_updated` back to disk.
94
+ Do **not** modify `dev_selftest`/`dev_selftest_at` (owned by `/dev-run-test`) or `qc_status`/`qc_run_at` (owned by `/qc-run-test`); this command only reads them for the report.
90
95
 
91
96
  ### Step 7 — Compute dashboard aggregates
92
97
 
@@ -102,6 +107,17 @@ test_coverage = rows where test_count > 0 / total_scs
102
107
  drift_count = rows where status == DRIFT
103
108
  untracked_count = rows where status == UNTRACKED
104
109
  gap_count = rows where status == GAP
110
+ dev_selftest_passing = rows where dev_selftest == pass
111
+ dev_selftest_failing = rows where dev_selftest == fail
112
+ dev_selftest_not_run = rows where dev_selftest in (not_run, —)
113
+ # NOTE: dev_selftest is the DEV self-check signal (did the dev run their own smoke tests),
114
+ # NOT official coverage — keep it labeled as such on the dashboard.
115
+ qc_passing = rows where qc_status == pass
116
+ qc_failing = rows where qc_status == fail
117
+ qc_skipped = rows where qc_status == skip
118
+ qc_not_run = rows where qc_status in (not_run, —)
119
+ # qc_status is the OFFICIAL QC automation result (set by /qc-run-test),
120
+ # shown alongside — never merged with — dev_selftest.
105
121
  tech_docs_count = count .md files in {paths.tech_docs_dir}/{domain}/
106
122
  ```
107
123
 
@@ -129,6 +145,13 @@ Schema:
129
145
  "drift_count": 0,
130
146
  "gap_count": 0,
131
147
  "untracked_count": 0,
148
+ "dev_selftest_passing": 0,
149
+ "dev_selftest_failing": 0,
150
+ "dev_selftest_not_run": 0,
151
+ "qc_passing": 0,
152
+ "qc_failing": 0,
153
+ "qc_skipped": 0,
154
+ "qc_not_run": 0,
132
155
  "tech_docs_count": 0
133
156
  },
134
157
  "prds": [
@@ -154,6 +177,10 @@ Schema:
154
177
  "implemented_by": "<ClassName.method or null>",
155
178
  "test_count": 0,
156
179
  "test_classes": ["<TestClass1>", "<TestClass2>"],
180
+ "dev_selftest": "pass | fail | not_run",
181
+ "dev_selftest_at": "<YYYY-MM-DD or null>",
182
+ "qc_status": "pass | fail | skip | not_run",
183
+ "qc_run_at": "<YYYY-MM-DD or null>",
157
184
  "prd_version": "<prd version when BDD was generated>",
158
185
  "bdd_version": "<bdd version when code was generated>",
159
186
  "tech_doc_revision": 0,
@@ -180,7 +207,7 @@ Schema:
180
207
  "sc_id": "<SC-ID>",
181
208
  "sc_title": "<title>",
182
209
  "implemented_by": "<method>",
183
- "fix": "/generate-tests <UC-ID>"
210
+ "fix": "/dev-gen-test <UC-ID>"
184
211
  }
185
212
  ],
186
213
  "untracked": [
@@ -218,37 +245,40 @@ Schema:
218
245
  - `tech_doc_revision`: use integer; `0` if not yet generated
219
246
  - `code_coverage_pct` / `test_coverage_pct`: round to nearest integer (0–100)
220
247
  - Always write to `{paths.trace_dir}/trace-report.json` regardless of domain filter — if a domain filter was applied, include only those PRDs in `prds[]` but note the domain in the `domain` field
221
- - **TSV `"—"` mapping**: when reading TSV files, map dash values to JSON types: `implemented_by: "—"` → `null`; `test_count: "—"` → `0`; `test_classes: "—"` → `[]`; `tech_doc_revision: "—"` → `0`
248
+ - **TSV `"—"` mapping**: when reading TSV files, map dash values to JSON types: `implemented_by: "—"` → `null`; `test_count: "—"` → `0`; `test_classes: "—"` → `[]`; `tech_doc_revision: "—"` → `0`; `dev_selftest: "—"` → `"not_run"`; `dev_selftest_at: "—"` → `null`; `qc_status: "—"` → `"not_run"`; `qc_run_at: "—"` → `null`
222
249
 
223
- ### Step 8b — Umbrella Living Docs Sync *(umbrella mode only)*
250
+ ### Step 8b — Living Docs Sync *(umbrella mode only)*
224
251
 
225
252
  *Skip this step in single-service mode.*
226
253
 
227
- After writing each service's `trace-report.json`, sync trace files to the umbrella root so the Living Docs VS Code panel (opened at umbrella root) can read them:
254
+ Authoritative trace state stays in each service submodule's `.trace/` (committed there).
255
+ This step publishes the merged report to the **canonical Living Docs home** (the specs
256
+ module) and drops a local mirror so the panel is never empty.
228
257
 
229
- 1. Create directory `{umbrella_root_trace}/` if it does not exist (`mkdir -p .trace`).
258
+ 1. **Write canonical merged report** to `{living_docs_dir}/` (`mkdir -p` it first):
259
+ - `{living_docs_dir}/trace-report.json` — merge every per-service `trace-report.json`
260
+ into one document, add a `"service"` field per scenario row, recalc summary aggregates.
261
+ - `{living_docs_dir}/{service-name}/{UC-ID}.tsv` — copy each service's TSVs, namespaced
262
+ by service. Overwrite; don't delete TSVs whose service source is gone (prior runs).
230
263
 
231
- 2. **Copy TSV files** from each service trace dir to umbrella trace dir with service namespace:
232
- ```
233
- {service.path}/.trace/{UC-ID}.tsv .trace/{service-name}/{UC-ID}.tsv
234
- ```
235
- Overwrite if exists. Do not delete files in `.trace/` that no longer have a service source — they may be from a previous run.
236
-
237
- 3. **Write aggregated `trace-report.json`** to `{umbrella_root_trace}/trace-report.json`:
238
- - Merge all per-service `trace-report.json` data into one document
239
- - Add `"service"` field to each scenario row
240
- - Recalculate summary aggregates across all services
264
+ 2. **Mirror to the panel location** `{panel_mirror}` (`./.trace` at the current workspace
265
+ root) so a dev who opened *this* repo (umbrella **or** a single service submodule) sees
266
+ data immediately: copy `{living_docs_dir}/trace-report.json` `{panel_mirror}/trace-report.json`
267
+ (and the namespaced TSVs). If `panel_mirror` already resolves to `living_docs_dir`, skip.
241
268
 
242
- 4. **Print sync summary:**
269
+ 3. **Print sync summary:**
243
270
  ```
244
- Umbrella sync.trace/
245
- user-service : {N} TSV files copied
246
- order-service : {N} TSV files copied
271
+ Living Docs{living_docs_dir}/ (canonical, in specs module)
272
+ user-service : {N} TSV files
273
+ order-service : {N} TSV files
247
274
  trace-report.json: merged ({total} scenarios across {S} services)
248
- Living Docs panel will reflect this data immediately.
275
+ Panel mirror {panel_mirror}/trace-report.json (current workspace)
249
276
  ```
250
277
 
251
- > **Note:** `.trace/` at umbrella root is a **read-only mirror** do NOT commit it to the umbrella repo. Add `.trace/` to the umbrella's `.gitignore`. Authoritative trace state lives in each service submodule's `.trace/` dir and is committed there.
278
+ > **Note — both locations are generated, gitignored mirrors.** Add `.living-docs/` to the
279
+ > **specs module's** `.gitignore` and `.trace/` to the current repo's `.gitignore`. The only
280
+ > committed, authoritative trace state is each service submodule's own `.trace/`. The report
281
+ > is regenerated by `/validate-traces` or `/sync` — never commit it.
252
282
 
253
283
  ## Output
254
284
 
@@ -289,11 +319,12 @@ Tech-Doc Revision Drift:
289
319
 
290
320
  Recommendations:
291
321
  - /generate-code {UC-ID} for DRIFT and UNTRACKED scenarios
292
- - /generate-tests {UC-ID} for GAP (missing tests)
322
+ - /dev-gen-test {UC-ID} for GAP (missing tests)
293
323
  - /generate-bdd {prd-file} for PRD version drift
294
324
 
295
325
  [Umbrella mode only]
296
- Living Docs synced.trace/ (umbrella root)
297
- Tip: run /validate-traces after each codegen session to refresh the panel.
298
- .trace/ at umbrella root is a mirror do not commit it (add to .gitignore).
326
+ Living Docs canonical{living_docs_dir}/ (specs module — shared, gitignored)
327
+ Panel mirror → {panel_mirror}/trace-report.json (current workspace)
328
+ Tip: run /validate-traces (or /sync) after each codegen session to refresh the panel.
329
+ Both are generated mirrors — do not commit (.living-docs/ + .trace/ in .gitignore).
299
330
  ```
@@ -1 +1 @@
1
- 0.9.2
1
+ 0.11.0
@@ -166,7 +166,7 @@ If `services` section is present:
166
166
 
167
167
  **2. Route to service** — if active domain matches a key in `services`:
168
168
  - Override `paths.specs_dir` → `services.{domain}.specs_dir`
169
- - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
169
+ - 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.
170
170
  - Store `active_service` = `services.{domain}.path`
171
171
  - Store `active_service_module` = `services.{domain}.module`
172
172
  - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
@@ -178,7 +178,7 @@ If `services` section is present:
178
178
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
179
179
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
180
180
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
181
- - 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`.
181
+ - 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.)*
182
182
  - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
183
183
  - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
184
184
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
@@ -209,7 +209,7 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
209
209
  | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
210
210
 
211
211
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
212
- - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
212
+ - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
213
213
  - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
214
214
 
215
215
  **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).
@@ -224,19 +224,41 @@ If the file does not exist → skip silently.
224
224
 
225
225
  ---
226
226
 
227
- ## Step 3 — [CRITICAL] Load CLAUDE.md
227
+ ## Step 3 — [CRITICAL] Load CLAUDE.md (layered: root + service overlay)
228
228
 
229
229
  *This is the highest-priority context — it defines HOW to write code and documents for this project.*
230
230
 
231
- Read `CLAUDE.md`. Extract and store:
231
+ CLAUDE.md is loaded in **two layers** so umbrella-wide rules and service-specific
232
+ architecture/coding standards compose correctly. The agent always sits at the umbrella
233
+ root, but the implementation code lives in a service submodule with its OWN stack,
234
+ architecture, and conventions — so the service's CLAUDE.md must win for code generation.
235
+
236
+ **Layer 1 — [BASE] Root CLAUDE.md (umbrella-wide).**
237
+ Read `CLAUDE.md` at the repo root. Treat its contents as the **shared baseline** for the
238
+ whole umbrella — git conventions, data-protection posture, cross-cutting rules, and (in
239
+ single-service mode) the project's only architecture + coding standards.
240
+
241
+ **Layer 2 — [OVERLAY] Service CLAUDE.md (umbrella mode only).**
242
+ *Run only if `service_root` was set in Step 1.6 (i.e. a real service was routed to).*
243
+ Read `{service_root}/CLAUDE.md`. This file defines the architecture + coding standards of
244
+ the **actual stack being implemented** (e.g. `user-service` = java-spring, `web` = nextjs).
245
+ Overlay it on top of Layer 1: **on any conflict, the service value WINS** for architecture,
246
+ coding standards, and error handling. Layer-1 values that the service does not redefine
247
+ (e.g. git conventions, banned patterns shared org-wide) remain in effect.
248
+
249
+ From the **merged** result, extract and store:
232
250
 
233
251
  - **§1 Project Overview** → project name, language, framework, build/test commands, domains
234
- - **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules
235
- - **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns
236
- - **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name
237
- - **§7 Git Conventions** → branch naming pattern, commit message format
252
+ - **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules — *service overlay wins*
253
+ - **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns — *service overlay wins*
254
+ - **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name — *service overlay wins*
255
+ - **§7 Git Conventions** → branch naming pattern, commit message format — *root baseline unless service redefines*
238
256
 
239
- If `CLAUDE.md` does not exist → note it as missing and continue with project-context.yaml data only.
257
+ **Resolution rules:**
258
+ - If both layers exist → merge as above; record `claude_md_source = root + {service_root}`.
259
+ - If only the service overlay exists (no root CLAUDE.md) → use the service file alone; `claude_md_source = {service_root}`.
260
+ - If `service_root` is set but `{service_root}/CLAUDE.md` is **missing** → fall back to root CLAUDE.md and flag ⚠️ in the Step 7 recap (the service has no architecture/coding-standards definition — code generation will use umbrella defaults, which may be the wrong stack).
261
+ - If neither exists → note CLAUDE.md as missing and continue with project-context.yaml data only.
240
262
 
241
263
  ---
242
264
 
@@ -302,7 +324,7 @@ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
302
324
 
303
325
  If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
304
326
 
305
- 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).
327
+ 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).
306
328
 
307
329
  ---
308
330
 
@@ -336,7 +358,8 @@ Output exactly this block:
336
358
  [CTX LOADED]
337
359
  Stack : {language} / {framework} / {database}
338
360
  Platform : {active_module} ({platform_type})
339
- Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
361
+ Layers : {layer order from merged CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
362
+ CLAUDE.md : {root + {service_root} | {service_root} only | root only | ⚠️ service overlay MISSING — using root | missing}
340
363
  Ticket : {ticket_prefix}-
341
364
  Dict : {loaded — N canonical terms, M banned terms | missing}
342
365
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
@@ -604,15 +627,22 @@ Suggest the logical next command based on workflow phase:
604
627
  | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
605
628
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
606
629
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
630
+ | /qc-analyze | `/qc-plan {UC-ID}` (resolve 🔴 blocker gaps first) |
631
+ | /qc-plan | `/qc-design-test {UC-ID}` |
632
+ | /qc-design-test | `/qc-review {UC-ID}` (test-case review) |
633
+ | /qc-review (test-case) | `/qc-run-test {UC-ID}` if APPROVED; fix TCs if NEEDS_FIX |
634
+ | /qc-run-test | `/qc-report {UC-ID}` then `/qc-review {UC-ID}` (script review) |
635
+ | /qc-review (script) | `/qc-report {UC-ID}` then create PR if APPROVED |
636
+ | /qc-report | `/validate-traces {UC-ID}` to refresh Living Docs (qc_status) |
607
637
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
608
638
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
609
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
610
- | /generate-tests | `/run-tests {UC-ID}` |
611
- | /run-tests (passing) | `/review-code {UC-ID}` |
612
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
613
- | /review-code | `/smoke-test {UC-ID}` or create PR |
614
- | /smoke-test | Create PR and link to ticket |
615
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
639
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
640
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
641
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
642
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
643
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
644
+ | /dev-smoke-test | Create PR and link to ticket |
645
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
616
646
  | /fix-bug | Create PR and link to ticket |
617
647
  | /debug | `/fix-bug {ticket-id}` if fix needed |
618
648
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -723,7 +753,7 @@ If `lessons_path` does not exist, create it with this header first:
723
753
  | code-gen | /generate-code output |
724
754
  | bdd | /generate-bdd output |
725
755
  | tech-docs | /generate-tech-docs output |
726
- | tests | /generate-tests output |
756
+ | tests | /dev-gen-test output |
727
757
  | prd | /generate-prd, /refine-prd output |
728
758
  | general | every command |
729
759