@anhth2/spec-driven-dev-plugin 0.10.0 → 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 (203) hide show
  1. package/commands/debug.md +38 -8
  2. package/commands/define-product.md +38 -8
  3. package/commands/dev-gen-test.md +39 -9
  4. package/commands/dev-gen-test.tmpl +1 -1
  5. package/commands/dev-run-test.md +43 -10
  6. package/commands/dev-run-test.tmpl +5 -2
  7. package/commands/dev-smoke-test.md +38 -8
  8. package/commands/fix-bug.md +38 -8
  9. package/commands/generate-bdd.md +42 -10
  10. package/commands/generate-bdd.tmpl +4 -2
  11. package/commands/generate-code.md +39 -9
  12. package/commands/generate-code.tmpl +1 -1
  13. package/commands/generate-design-spec.md +38 -8
  14. package/commands/generate-prd.md +38 -8
  15. package/commands/generate-spec-manifest.md +38 -8
  16. package/commands/generate-tech-docs.md +38 -8
  17. package/commands/learn.md +38 -8
  18. package/commands/propose-scenario.md +38 -8
  19. package/commands/qc-analyze.md +514 -0
  20. package/commands/qc-analyze.tmpl +71 -0
  21. package/commands/qc-design-test.md +510 -0
  22. package/commands/qc-design-test.tmpl +67 -0
  23. package/commands/qc-plan.md +492 -0
  24. package/commands/qc-plan.tmpl +49 -0
  25. package/commands/qc-report.md +491 -0
  26. package/commands/qc-report.tmpl +48 -0
  27. package/commands/qc-review.md +496 -0
  28. package/commands/qc-review.tmpl +53 -0
  29. package/commands/qc-run-test.md +538 -0
  30. package/commands/qc-run-test.tmpl +77 -0
  31. package/commands/refine-prd.md +38 -8
  32. package/commands/report-bug.md +38 -8
  33. package/commands/review-code.md +38 -8
  34. package/commands/review-context.md +38 -8
  35. package/commands/review-tech-docs.md +38 -8
  36. package/commands/setup-ai-first.md +7 -0
  37. package/commands/sync.md +7 -0
  38. package/commands/update-framework.md +7 -0
  39. package/commands/validate-traces.md +54 -12
  40. package/commands/validate-traces.tmpl +16 -4
  41. package/core/FRAMEWORK_VERSION +1 -1
  42. package/core/commands/debug.md +38 -8
  43. package/core/commands/define-product.md +38 -8
  44. package/core/commands/dev-gen-test.md +39 -9
  45. package/core/commands/dev-run-test.md +43 -10
  46. package/core/commands/dev-smoke-test.md +38 -8
  47. package/core/commands/fix-bug.md +38 -8
  48. package/core/commands/generate-bdd.md +42 -10
  49. package/core/commands/generate-code.md +39 -9
  50. package/core/commands/generate-design-spec.md +38 -8
  51. package/core/commands/generate-prd.md +38 -8
  52. package/core/commands/generate-spec-manifest.md +38 -8
  53. package/core/commands/generate-tech-docs.md +38 -8
  54. package/core/commands/learn.md +38 -8
  55. package/core/commands/propose-scenario.md +38 -8
  56. package/core/commands/qc-analyze.md +514 -0
  57. package/core/commands/qc-design-test.md +510 -0
  58. package/core/commands/qc-plan.md +492 -0
  59. package/core/commands/qc-report.md +491 -0
  60. package/core/commands/qc-review.md +496 -0
  61. package/core/commands/qc-run-test.md +538 -0
  62. package/core/commands/refine-prd.md +38 -8
  63. package/core/commands/report-bug.md +38 -8
  64. package/core/commands/review-code.md +38 -8
  65. package/core/commands/review-context.md +38 -8
  66. package/core/commands/review-tech-docs.md +38 -8
  67. package/core/commands/setup-ai-first.md +7 -0
  68. package/core/commands/sync.md +7 -0
  69. package/core/commands/update-framework.md +7 -0
  70. package/core/commands/validate-traces.md +54 -12
  71. package/core/modules/qc-playwright/stack-profile.yaml +65 -0
  72. package/core/skills/code/SKILL.md +45 -8
  73. package/core/skills/debug/SKILL.md +52 -8
  74. package/core/skills/design-spec/SKILL.md +38 -8
  75. package/core/skills/discovery/SKILL.md +38 -8
  76. package/core/skills/prd/SKILL.md +14 -0
  77. package/core/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  78. package/core/skills/qc/qa-analyst/acceptance-criteria.md +56 -0
  79. package/core/skills/qc/qa-analyst/business-rules.md +55 -0
  80. package/core/skills/qc/qa-analyst/data-flow.md +60 -0
  81. package/core/skills/qc/qa-analyst/spec-breakdown.md +57 -0
  82. package/core/skills/qc/qa-designer/e2e/journey.md +41 -0
  83. package/core/skills/qc/qa-designer/exploratory/charter.md +68 -0
  84. package/core/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  85. package/core/skills/qc/qa-designer/functional/api.md +45 -0
  86. package/core/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  87. package/core/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  88. package/core/skills/qc/qa-designer/integration/api.md +42 -0
  89. package/core/skills/qc/qa-designer/integration/db.md +39 -0
  90. package/core/skills/qc/qa-designer/integration/gui.md +40 -0
  91. package/core/skills/qc/qa-designer/integration/kafka.md +40 -0
  92. package/core/skills/qc/qa-designer/non-functional.md +40 -0
  93. package/core/skills/qc/qa-planner/test-plan.md +120 -0
  94. package/core/skills/qc/qa-reviewer/script/e2e.md +87 -0
  95. package/core/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  96. package/core/skills/qc/qa-reviewer/script/functional.md +101 -0
  97. package/core/skills/qc/qa-reviewer/script/integration.md +91 -0
  98. package/core/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  99. package/core/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  100. package/core/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  101. package/core/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  102. package/core/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  103. package/core/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  104. package/core/skills/qc/qa-runner/e2e.md +49 -0
  105. package/core/skills/qc/qa-runner/exploratory/session.md +36 -0
  106. package/core/skills/qc/qa-runner/functional/api.md +35 -0
  107. package/core/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  108. package/core/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  109. package/core/skills/qc/qa-runner/integration.md +47 -0
  110. package/core/skills/qc/qa-runner/non-functional.md +49 -0
  111. package/core/skills/qc/qa-runner/report/report.md +37 -0
  112. package/core/skills/setup-ai-first/SKILL.md +7 -0
  113. package/core/skills/spec/SKILL.md +14 -0
  114. package/core/skills/test/SKILL.md +83 -16
  115. package/core/steps/context-loader.md +31 -8
  116. package/core/steps/report-footer.md +7 -0
  117. package/core/templates/project-context.yaml +8 -0
  118. package/docs/01-getting-started/README.md +19 -0
  119. package/docs/01-getting-started/core-concepts.md +102 -0
  120. package/docs/01-getting-started/installation.md +154 -0
  121. package/docs/01-getting-started/quickstart.md +85 -0
  122. package/docs/02-guides/README.md +27 -0
  123. package/docs/02-guides/developer/README.md +46 -0
  124. package/docs/02-guides/developer/bdd-and-trace.md +123 -0
  125. package/docs/02-guides/developer/commands.md +76 -0
  126. package/docs/02-guides/developer/pr-checklist.md +15 -0
  127. package/docs/02-guides/developer/scenarios.md +448 -0
  128. package/docs/02-guides/developer/workflow.md +59 -0
  129. package/docs/02-guides/product-owner/README.md +77 -0
  130. package/docs/02-guides/product-owner/commands.md +30 -0
  131. package/docs/02-guides/product-owner/handoff-checklist.md +42 -0
  132. package/docs/02-guides/product-owner/prd-writing-rules.md +45 -0
  133. package/docs/02-guides/product-owner/scenarios.md +357 -0
  134. package/docs/02-guides/qc-automation.md +92 -0
  135. package/docs/02-guides/tester/README.md +72 -0
  136. package/docs/02-guides/tester/bug-reporting.md +117 -0
  137. package/docs/02-guides/tester/reading-specs.md +79 -0
  138. package/docs/02-guides/tester/scenarios.md +186 -0
  139. package/docs/02-guides/tester/spec-manifest.md +124 -0
  140. package/docs/02-guides/tester/test-checklist.md +31 -0
  141. package/docs/02-guides/tester/workflow.md +79 -0
  142. package/docs/03-concepts/README.md +19 -0
  143. package/docs/03-concepts/architecture.md +243 -0
  144. package/docs/03-concepts/pipeline.md +249 -0
  145. package/docs/03-concepts/traceability.md +148 -0
  146. package/docs/04-operations/README.md +33 -0
  147. package/docs/04-operations/bug-flow.md +321 -0
  148. package/docs/04-operations/publishing.md +137 -0
  149. package/docs/04-operations/sync-and-update.md +328 -0
  150. package/docs/05-reference/README.md +29 -0
  151. package/docs/05-reference/commands.md +229 -0
  152. package/docs/05-reference/modules.md +110 -0
  153. package/docs/05-reference/trace-schema.md +146 -0
  154. package/docs/README.md +51 -0
  155. package/modules/qc-playwright/stack-profile.yaml +65 -0
  156. package/package.json +2 -2
  157. package/skills/code/SKILL.md +45 -8
  158. package/skills/debug/SKILL.md +52 -8
  159. package/skills/design-spec/SKILL.md +38 -8
  160. package/skills/discovery/SKILL.md +38 -8
  161. package/skills/prd/SKILL.md +14 -0
  162. package/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  163. package/skills/qc/qa-analyst/acceptance-criteria.md +56 -0
  164. package/skills/qc/qa-analyst/business-rules.md +55 -0
  165. package/skills/qc/qa-analyst/data-flow.md +60 -0
  166. package/skills/qc/qa-analyst/spec-breakdown.md +57 -0
  167. package/skills/qc/qa-designer/e2e/journey.md +41 -0
  168. package/skills/qc/qa-designer/exploratory/charter.md +68 -0
  169. package/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  170. package/skills/qc/qa-designer/functional/api.md +45 -0
  171. package/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  172. package/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  173. package/skills/qc/qa-designer/integration/api.md +42 -0
  174. package/skills/qc/qa-designer/integration/db.md +39 -0
  175. package/skills/qc/qa-designer/integration/gui.md +40 -0
  176. package/skills/qc/qa-designer/integration/kafka.md +40 -0
  177. package/skills/qc/qa-designer/non-functional.md +40 -0
  178. package/skills/qc/qa-planner/test-plan.md +120 -0
  179. package/skills/qc/qa-reviewer/script/e2e.md +87 -0
  180. package/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  181. package/skills/qc/qa-reviewer/script/functional.md +101 -0
  182. package/skills/qc/qa-reviewer/script/integration.md +91 -0
  183. package/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  184. package/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  185. package/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  186. package/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  187. package/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  188. package/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  189. package/skills/qc/qa-runner/e2e.md +49 -0
  190. package/skills/qc/qa-runner/exploratory/session.md +36 -0
  191. package/skills/qc/qa-runner/functional/api.md +35 -0
  192. package/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  193. package/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  194. package/skills/qc/qa-runner/integration.md +47 -0
  195. package/skills/qc/qa-runner/non-functional.md +49 -0
  196. package/skills/qc/qa-runner/report/report.md +37 -0
  197. package/skills/setup-ai-first/SKILL.md +7 -0
  198. package/skills/spec/SKILL.md +14 -0
  199. package/skills/test/SKILL.md +83 -16
  200. package/steps/context-loader.md +31 -8
  201. package/steps/report-footer.md +7 -0
  202. package/templates/project-context.yaml +8 -0
  203. package/ARCHITECTURE.md +0 -258
@@ -0,0 +1,110 @@
1
+ [📚 Docs](../README.md) › [Reference](README.md) › Stack Modules
2
+
3
+ # Stack Modules
4
+
5
+ > Mỗi module dưới `modules/` ship một `stack-profile.yaml` chứa layer pattern, naming rule, và test pattern riêng cho framework đó. Framework detect platform type từ `tech_stack.module` (hoặc `active_module` trong multi-service) và adapt mọi artifact sinh ra.
6
+
7
+ ---
8
+
9
+ ## Mục lục
10
+
11
+ - [Danh sách module](#danh-sách-module)
12
+ - [Platform type grouping](#platform-type-grouping)
13
+ - [qc-playwright — QC automation stack](#qc-playwright--qc-automation-stack)
14
+
15
+ ---
16
+
17
+ ## Danh sách module
18
+
19
+ 15 module (xác minh bằng listing thư mục `modules/`):
20
+
21
+ | Module | Language / Framework | Platform type |
22
+ |--------|----------------------|---------------|
23
+ | `java-spring` | Java + Spring Boot | backend |
24
+ | `golang` | Go + Gin/Echo | backend |
25
+ | `dotnet` | C# + .NET / ASP.NET Core | backend |
26
+ | `php-laravel` | PHP + Laravel | backend |
27
+ | `context-engineering` | Generic AI/LLM projects | backend |
28
+ | `react` | TypeScript + React | web-frontend |
29
+ | `nextjs` | TypeScript + Next.js | web-frontend |
30
+ | `vue` | TypeScript + Vue 3 | web-frontend |
31
+ | `nuxt` | TypeScript + Nuxt 3 + @nuxt/ui | web-frontend |
32
+ | `angular` | TypeScript + Angular | web-frontend |
33
+ | `flutter` | Dart + Flutter | mobile |
34
+ | `react-native` | TypeScript + React Native / Expo | mobile |
35
+ | `ios-swiftui` | Swift + SwiftUI | mobile |
36
+ | `android-compose` | Kotlin + Jetpack Compose | mobile |
37
+ | `qc-playwright` | Python + pytest-playwright + Page Object | QC / E2E (xem dưới) |
38
+
39
+ ---
40
+
41
+ ## Platform type grouping
42
+
43
+ `platform_type` được suy ra từ module và quyết định cách adapt BDD vocabulary, tech-design sections, và test templates.
44
+
45
+ | `platform_type` | Modules |
46
+ |-----------------|---------|
47
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
48
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
49
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
50
+
51
+ Ví dụ adapt theo platform type:
52
+
53
+ - **BDD vocabulary** — backend dùng "submits a request" / "receives response"; web dùng "clicks" / "types into" / "navigates to"; mobile dùng "taps" / "enters" / "opens".
54
+ - **Tech-design sections** — backend: §4 API Endpoints / §5 Service Flow / §6 Data Model…; web-frontend: §4 Screen/Component Breakdown / §5 State Management…; mobile: §4 Screen/Widget Breakdown / §5 State & Data Flow….
55
+ - **Test templates** — Java → JUnit 5 + Mockito + `@WebMvcTest`; web → Vitest/Jest + Testing Library + Playwright/Cypress; Flutter → `testWidgets`; iOS → `XCTestCase`; Android → Compose rule + `@HiltAndroidTest`.
56
+
57
+ ---
58
+
59
+ ## qc-playwright — QC automation stack
60
+
61
+ `qc-playwright` là **stack QC automation độc lập** với dev implementation module. Nó power native QC pipeline (`/qc-run-test`, `/qc-report`) và được chọn qua `tech_stack.qc_module` hoặc per `/qc-*` run — không phụ thuộc vào stack dev (java-spring, react, flutter…). Per-layer guides nằm ở `skills/qc/<stage>/`. Xem [../02-guides/qc-automation.md](../02-guides/qc-automation.md).
62
+
63
+ **Stack** (từ `modules/qc-playwright/stack-profile.yaml`): Python 3 + pytest-playwright + Page Object Model. Report = Playwright Trace + pytest-html (**không** dùng Allure, không hand-written dashboard, không `record_video`).
64
+
65
+ **Build commands:**
66
+
67
+ | Mục đích | Command |
68
+ |----------|---------|
69
+ | Test | `python3 -m pytest` |
70
+ | E2E | `python3 -m pytest -m e2e` |
71
+ | Report | `python3 -m pytest --html=reports/<feature>/report.html --self-contained-html` |
72
+ | Show trace | `python3 -m playwright show-trace <test-results/<nodeid>/trace.zip>` |
73
+
74
+ **Key architecture rules:**
75
+ - **Markdown-first** — không sinh Python cho tới khi có `.Test.md` đã review cho feature.
76
+ - Không hard-code URL/credential/timeout — đọc từ `Env.*` và `CONFIG[...]`.
77
+ - Không `time.sleep()` — dùng Playwright auto-wait / `expect()`.
78
+ - Mỗi test độc lập qua pytest-playwright fixtures (`page` / `logged_in_page` / …).
79
+ - Page Object extends slim `BasePage`; tách 3 layer: locators `_x()`, actions `verb_noun()`, assertions `assert_x()` dùng `expect()`.
80
+ - Locator priority: `data-testid` → role → label/text → CSS → tránh XPath.
81
+ - Group test theo `(role, account)` để login/logout không interleave giữa các role.
82
+ - Cover 100% TC trong `.Test.md` — mỗi TC kết thúc Pass/Fail/Skip, không để Draft.
83
+
84
+ **Naming:** test case id `TC_<FEATURE>_<NNN>` · test class `TestFeatureHappyCase` · test function `test_TC<NNN>_<snake_case>` · page object `<feature>_page.py` (`<Feature>Page` extends `BasePage`).
85
+
86
+ **Folder structure:**
87
+ ```
88
+ docs/<project>/<feature>/ ← test-case Markdown (.Test.md) — source of truth
89
+ pages/ ← Page Object Model (base_page.py + <feature>_page.py)
90
+ tests/ ← pytest scripts, 1-1 với docs/ (conftest.py + test_<feature>.py)
91
+ utils/ ← config_loader, logger, steps, test_ordering, report helpers
92
+ test_data/ ← JSON datasets
93
+ config/config.yaml ← browser, timeout, video/screenshot/trace toggles
94
+ reports/ test-results/ ← generated (gitignored): html report, trace.zip, screenshots
95
+ ```
96
+
97
+ **Test layers:** functional (gui-screen / gui-feature / api) · integration (api/db/gui/kafka) · e2e (journey) · non-functional · exploratory.
98
+
99
+ **Trace tags** (map QC test về scenario, drive `qc_status`):
100
+ ```python
101
+ # @trace.verifies={UC-ID}-SC{N}
102
+ # @trace.source=<official .feature path>
103
+ # @trace.test_type=functional|integration|e2e|non-functional
104
+ ```
105
+
106
+ > `/qc-run-test` ghi `pass|fail|skip|not_run` + `qc_run_at` vào `{trace_dir}/{UC-ID}.tsv` (song song với `dev_selftest`), surfaced trong Living Docs là kết quả QC automation **chính thức**. Mỗi FAIL được phân loại script-bug (fix selector/logic) vs product-gap (giữ FAIL + evidence, không bao giờ fake-pass).
107
+
108
+ ---
109
+
110
+ *Xem thêm:* [Trace TSV Schema](trace-schema.md) (`qc_status` vs `dev_selftest`) · [Command Reference](commands.md) (pipeline `/qc-*`) · [02 · Guides · QC Automation](../02-guides/qc-automation.md).
@@ -0,0 +1,146 @@
1
+ [📚 Docs](../README.md) › [Reference](README.md) › Trace TSV Schema
2
+
3
+ # Trace TSV Schema
4
+
5
+ > Schema chuẩn của `.trace/{UC-ID}.tsv` — file trace state per use-case. Mỗi UC một file: 1 header row + 1 data row mỗi scenario. Đây là nguồn dữ liệu cho `/validate-traces` và panel Living Docs.
6
+
7
+ ---
8
+
9
+ ## Mục lục
10
+
11
+ - [Canonical TSV header](#canonical-tsv-header)
12
+ - [Column reference](#column-reference)
13
+ - [Two independent signals: dev_selftest vs qc_status](#two-independent-signals-dev_selftest-vs-qc_status)
14
+ - [Status computation (validate-traces)](#status-computation-validate-traces)
15
+ - [@trace tags across artifacts](#trace-tags-across-artifacts)
16
+ - [trace-report.json](#trace-reportjson)
17
+
18
+ ---
19
+
20
+ ## Canonical TSV header
21
+
22
+ Tab-separated, một header row + một data row mỗi scenario. Header chính xác (từ `generate-bdd.tmpl`):
23
+
24
+ ```
25
+ sc_id sc_title spec_ver gen_ver implemented_by test_count test_classes dev_selftest dev_selftest_at qc_status qc_run_at prd_version bdd_version tech_doc_revision prd_status uc_status fe_phase status last_updated
26
+ ```
27
+
28
+ 19 cột, theo đúng thứ tự trên.
29
+
30
+ ---
31
+
32
+ ## Column reference
33
+
34
+ | # | Column | Ý nghĩa | Giá trị khởi tạo (`/generate-bdd`) | Ai ghi |
35
+ |---|--------|---------|------------------------------------|--------|
36
+ | 1 | `sc_id` | `{UC-ID}-SC{N}` — khóa chính của row | `{UC-ID}-SC{N}` | generate-bdd |
37
+ | 2 | `sc_title` | Scenario title text | từ `.feature` | generate-bdd |
38
+ | 3 | `spec_ver` | `@trace.sc_version` hiện tại của scenario | từ `.feature` | generate-bdd / validate-traces (reconcile) |
39
+ | 4 | `gen_ver` | Version tại thời điểm code được sinh | `—` | generate-code |
40
+ | 5 | `implemented_by` | `ClassName.method` cài đặt scenario | `—` | generate-code |
41
+ | 6 | `test_count` | Số test verify scenario | `—` | dev-gen-test |
42
+ | 7 | `test_classes` | Danh sách test class | `—` | dev-gen-test |
43
+ | 8 | `dev_selftest` | Kết quả dev self-check: `pass` / `fail` / `not_run` | `—` | **dev-run-test** |
44
+ | 9 | `dev_selftest_at` | Ngày chạy dev self-check (`YYYY-MM-DD`) | `—` | **dev-run-test** |
45
+ | 10 | `qc_status` | Kết quả QC chính thức: `pass` / `fail` / `skip` / `not_run` | `—` | **qc-run-test** |
46
+ | 11 | `qc_run_at` | Ngày chạy QC (`YYYY-MM-DD`) | `—` | **qc-run-test** |
47
+ | 12 | `prd_version` | `@trace.prd_version` từ `.feature` header | từ `.feature` | generate-bdd |
48
+ | 13 | `bdd_version` | `@trace.bdd_version` từ `.feature` header | từ `.feature` | generate-bdd |
49
+ | 14 | `tech_doc_revision` | Tech-doc revision tại thời điểm codegen | `—` | generate-code |
50
+ | 15 | `prd_status` | `\| **Status** \|` từ PRD metadata | từ PRD | generate-bdd |
51
+ | 16 | `uc_status` | Trạng thái UC: `draft` / `approved` / … | `draft` (UC mới) | generate-bdd |
52
+ | 17 | `fe_phase` | FE phase khi implement (`ui` / `integration`) | `—` | generate-code `--phase` |
53
+ | 18 | `status` | Trạng thái tổng hợp: `OK` / `DRIFT` / `GAP` / `UNTRACKED` | `UNTRACKED` | validate-traces |
54
+ | 19 | `last_updated` | Ngày update gần nhất (`YYYY-MM-DD`) | today | mọi command ghi row |
55
+
56
+ > **Re-generation rules (generate-bdd):** SC đã có trong TSV & `spec_ver` không đổi → chỉ update `sc_title`, `prd_version`, `bdd_version`, `prd_status`, `uc_status`, `last_updated`. Nếu `spec_ver` đổi → thêm `spec_ver` và set `status = DRIFT` ngay. SC mới → append với `gen_ver`/`implemented_by`/`test_count`/`test_classes`/`dev_selftest`/`dev_selftest_at`/`qc_status`/`qc_run_at`/`tech_doc_revision` = `—`. SC bị xóa khỏi `.feature` → xóa row.
57
+
58
+ ---
59
+
60
+ ## Two independent signals: dev_selftest vs qc_status
61
+
62
+ Trace TSV mang **hai cột tín hiệu độc lập** — không bao giờ trộn:
63
+
64
+ | | `dev_selftest` (+ `dev_selftest_at`) | `qc_status` (+ `qc_run_at`) |
65
+ |---|--------------------------------------|------------------------------|
66
+ | Ghi bởi | `/dev-run-test` | `/qc-run-test` |
67
+ | Ý nghĩa | Dev tự smoke-check code mình vừa sinh | Kết quả QC automation **chính thức** |
68
+ | Giá trị | `pass` / `fail` / `not_run` | `pass` / `fail` / `skip` / `not_run` |
69
+ | Stack | Dev implementation module | `qc-playwright` module |
70
+ | Coverage chính thức? | **KHÔNG** — chỉ là dev self-check | **CÓ** — official QC result |
71
+ | Keyed by | `@trace.verifies={UC-ID}` | `@trace.verifies={UC-ID}-SC{N}` |
72
+
73
+ `/validate-traces` chỉ **đọc** hai cột này cho report — không bao giờ ghi đè (mỗi cột do command sở hữu nó quản lý). Living Docs hiển thị cả hai cạnh nhau.
74
+
75
+ ---
76
+
77
+ ## Status computation (validate-traces)
78
+
79
+ `/validate-traces` tính cột `status` theo thứ tự ưu tiên (rule đầu tiên khớp thì dừng):
80
+
81
+ | Rule | Status | Điều kiện |
82
+ |------|--------|-----------|
83
+ | 1 | `UNTRACKED` | `implemented_by == —` (chưa sinh code) |
84
+ | 2 | `GAP` | `implemented_by != —` AND (`test_count == —` OR `test_count == 0`) |
85
+ | 3 | `DRIFT` | `spec_ver != gen_ver` (scenario đổi sau lần codegen gần nhất) |
86
+ | 4 | `OK` | tất cả: `spec_ver == gen_ver`, `implemented_by != —`, `test_count > 0` |
87
+
88
+ Ngoài ra `/validate-traces` còn flag **`PRD_DRIFT`** (PRD version trong code/TSV trễ hơn PRD file hiện tại) và **`TECHDOC_DRIFT`** (code sinh từ tech-doc revision cũ).
89
+
90
+ ---
91
+
92
+ ## @trace tags across artifacts
93
+
94
+ Mọi artifact link với nhau qua `@trace.*` tags.
95
+
96
+ **`.feature` files:**
97
+ ```gherkin
98
+ # @trace.id: FEAT-001-UC1
99
+ # @trace.service: web-admin
100
+ # @trace.module: react
101
+ # @trace.prd_version: 1.2
102
+ # @trace.bdd_version: 3
103
+ # @trace.api_source: existing # brownfield: API đã tồn tại, contract lấy từ PRD
104
+ ```
105
+ Per-scenario trong file: `# @trace.scenario: {UC-ID}-SC{N}`, `# @trace.sc_version: 1.0`, `# @trace.business_rules: ...`.
106
+
107
+ **Code:**
108
+ ```java
109
+ // @trace.implements=FEAT-001-UC1-SC2
110
+ // @trace.prd_version=1.2
111
+ // @trace.bdd_version=3
112
+ // @trace.tech_doc_revision=2
113
+ ```
114
+
115
+ **Dev self-check tests:**
116
+ ```java
117
+ // @trace.verifies=FEAT-001-UC1
118
+ // @trace.service=api-backend
119
+ // @trace.test_type=integration
120
+ ```
121
+
122
+ **QC tests** (`qc-playwright`, drive `qc_status`):
123
+ ```python
124
+ # @trace.verifies={UC-ID}-SC{N}
125
+ # @trace.source=<official .feature path>
126
+ # @trace.test_type=functional|integration|e2e|non-functional
127
+ ```
128
+
129
+ ---
130
+
131
+ ## trace-report.json
132
+
133
+ `/validate-traces` ghi `{paths.trace_dir}/trace-report.json` — single source of truth cho web dashboards. Cấu trúc rút gọn:
134
+
135
+ - `generated_at`, `domain`
136
+ - `summary` — aggregates: `total_prds`, `approved_prds`, `total_ucs`, `approved_ucs`, `draft_ucs`, `total_scs`, `coded_scs`, `tested_scs`, `code_coverage_pct`, `test_coverage_pct`, `drift_count`, `gap_count`, `untracked_count`, `dev_selftest_passing/failing/not_run`, `qc_passing/failing/skipped/not_run`, `tech_docs_count`
137
+ - `prds[]` → `ucs[]` → `scenarios[]` — mỗi scenario có đầy đủ các trường của TSV row (gồm `dev_selftest`, `dev_selftest_at`, `qc_status`, `qc_run_at`)
138
+ - `issues` — phân loại: `drift`, `gap`, `untracked`, `prd_version_drift`, `techdoc_drift`, mỗi entry kèm `fix` command gợi ý
139
+
140
+ **TSV `"—"` → JSON mapping:** `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`.
141
+
142
+ > **Umbrella mode:** mỗi service submodule giữ `.trace/` riêng (committed). `/validate-traces` (hoặc `/sync`) publish merged report vào `{spec_source}/.living-docs/` (canonical) + mirror `./.trace/trace-report.json` ở workspace hiện tại. Cả hai là generated mirror — gitignore, không commit.
143
+
144
+ ---
145
+
146
+ *Xem thêm:* [Command Reference](commands.md) (`/validate-traces`, `/qc-run-test`, `/dev-run-test`) · [03 · Concepts](../03-concepts/) (traceability system).
package/docs/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # 📚 Spec-Driven Dev — Documentation
2
+
3
+ > AI-First Spec-Driven Development for Claude Code: Discovery → PRD → Design-Spec → BDD →
4
+ > Code → Dev self-check → QC automation, with traceability and human review gates.
5
+
6
+ Tài liệu được chia theo **vai trò** và **chủ đề**. Bắt đầu ở mục phù hợp với bạn:
7
+
8
+ | Bạn là… | Bắt đầu ở |
9
+ |---------|-----------|
10
+ | Người mới / cài đặt lần đầu | [01 · Getting Started](01-getting-started/) |
11
+ | Product Owner | [Guide · Product Owner](02-guides/product-owner/README.md) |
12
+ | Developer | [Guide · Developer](02-guides/developer/README.md) |
13
+ | Tester | [Guide · Tester](02-guides/tester/README.md) |
14
+ | QC Automation | [Guide · QC Automation](02-guides/qc-automation.md) |
15
+ | Muốn hiểu kiến trúc | [03 · Concepts](03-concepts/) |
16
+ | Vận hành / admin | [04 · Operations](04-operations/) |
17
+ | Tra cứu lệnh | [05 · Reference](05-reference/) |
18
+
19
+ ---
20
+
21
+ ## Mục lục
22
+
23
+ ### 01 · [Getting Started](01-getting-started/)
24
+ - [Installation](01-getting-started/installation.md) — cài framework, prerequisites
25
+ - [Quick Start](01-getting-started/quickstart.md) — chạy feature đầu tiên end-to-end
26
+ - [Core Concepts](01-getting-started/core-concepts.md) — khái niệm trong 5 phút
27
+
28
+ ### 02 · [Guides (theo vai trò)](02-guides/)
29
+ - [Product Owner](02-guides/product-owner/README.md) — define-product, PRD, design-spec, review
30
+ - [Developer](02-guides/developer/README.md) — BDD, tech-docs, code, dev self-check
31
+ - [Tester](02-guides/tester/README.md) — spec-manifest, report-bug, propose-scenario, Living Docs
32
+ - [QC Automation](02-guides/qc-automation.md) — pipeline `/qc-*`, qc_status
33
+
34
+ ### 03 · [Concepts](03-concepts/)
35
+ - [Architecture](03-concepts/architecture.md) — layers, modules, plug-in system
36
+ - [Pipeline](03-concepts/pipeline.md) — các phase Discovery → QC
37
+ - [Traceability & Living Docs](03-concepts/traceability.md) — trace TSV, dev_selftest vs qc_status
38
+
39
+ ### 04 · [Operations](04-operations/)
40
+ - [Sync & Update](04-operations/sync-and-update.md) — `/sync`, `/update-framework`, umbrella
41
+ - [Bug Flow](04-operations/bug-flow.md) — report → fix → verify
42
+ - [Publishing](04-operations/publishing.md) — build + npm publish
43
+
44
+ ### 05 · [Reference](05-reference/)
45
+ - [Commands](05-reference/commands.md) — bảng đầy đủ mọi slash command
46
+ - [Trace Schema](05-reference/trace-schema.md) — cột TSV, trace tags
47
+ - [Modules](05-reference/modules.md) — stack modules (java-spring, react, …, qc-playwright)
48
+
49
+ ---
50
+
51
+ *Mỗi file có breadcrumb điều hướng ở đầu. Phiên bản framework: xem `core/FRAMEWORK_VERSION`.*
@@ -0,0 +1,65 @@
1
+ # QC automation module — Python + pytest-playwright + Page Object
2
+ # Used by the /qc-* commands (the official QC automation pipeline ported from the QC team).
3
+ # This is the QC test-authoring/execution stack, independent of the dev implementation
4
+ # module (java-spring, react, flutter, …). Selected via tech_stack.qc_module or per /qc-* run.
5
+
6
+ build:
7
+ test: "python3 -m pytest"
8
+ e2e: "python3 -m pytest -m e2e"
9
+ report: "python3 -m pytest --html=reports/<feature>/report.html --self-contained-html"
10
+ show_trace: "python3 -m playwright show-trace <test-results/<nodeid>/trace.zip>"
11
+
12
+ architecture:
13
+ style: "Page Object Model over pytest-playwright — Markdown test-case first, Python second"
14
+ key_rules:
15
+ - "Markdown-first: never generate Python until a reviewed .Test.md exists for the feature"
16
+ - "No Allure, no hand-written dashboard, no record_video — use Playwright Trace + pytest-html"
17
+ - "No hard-coded URL/credential/timeout — read from Env.* and CONFIG[...]"
18
+ - "No time.sleep() — use Playwright auto-wait / expect()"
19
+ - "Each test independent via pytest-playwright fixtures (page / logged_in_page / …)"
20
+ - "Page Object extends slim BasePage; split 3 layers: locators _x(), actions verb_noun(), assertions assert_x() using expect()"
21
+ - "Locator priority: data-testid → role → label/text → CSS → avoid XPath"
22
+ - "Group tests by (role, account) so login/logout never interleaves across roles"
23
+ - "Cover 100% of TCs in the .Test.md — every TC ends Pass/Fail/Skip, none left Draft"
24
+ folder_structure: |
25
+ docs/<project>/<feature>/ ← test-case Markdown (.Test.md) — source of truth
26
+ pages/ ← Page Object Model
27
+ │ ├── base_page.py ← slim BasePage (click/fill/wait/screenshot)
28
+ │ └── <feature>_page.py
29
+ tests/ ← pytest scripts, 1-1 with docs/
30
+ │ ├── conftest.py ← fixtures: browser, page, logged_in_page, tracing
31
+ │ └── <project>/test_<feature>.py
32
+ utils/ ← config_loader, logger, steps, test_ordering, report helpers
33
+ test_data/ ← JSON datasets
34
+ config/config.yaml ← browser, timeout, video/screenshot/trace toggles
35
+ reports/ test-results/ ← generated (gitignored): html report, trace.zip, screenshots
36
+
37
+ coding_standards:
38
+ naming:
39
+ test_case_id: "TC_<FEATURE>_<NNN>"
40
+ test_class: "TestFeatureHappyCase"
41
+ test_function: "test_TC<NNN>_<snake_case>"
42
+ page_object: "<feature>_page.py with <Feature>Page class extending BasePage"
43
+ files:
44
+ test_case_md: "docs/<project>/<feature>/TC_<FEATURE>.Test.md"
45
+ page_object: "pages/<feature>_page.py"
46
+ test_script: "tests/<project>/test_<feature>.py"
47
+ patterns:
48
+ steps: "wrap steps with `with step(\"…\")` (from utils.steps import step)"
49
+ assertions: "Playwright expect() — never bare assert on dynamic UI"
50
+ fixtures: "auth fixtures register via register_auth_fixtures([...]) in project conftest"
51
+ fail_triage: "classify each FAIL as script-bug (fix selector/logic) vs product-gap (keep FAIL + evidence, never fake-pass)"
52
+
53
+ testing:
54
+ layers: "functional (gui-screen / gui-feature / api), integration (api/db/gui/kafka), e2e (journey), non-functional, exploratory"
55
+ runner: "pytest-playwright; trace via context.tracing.start in conftest"
56
+ report: "pytest-html (--html ... --self-contained-html) + Playwright Trace viewer"
57
+
58
+ trace_tags:
59
+ # QC tests map back to the framework's scenarios — drives qc_status in the trace TSV.
60
+ verifies: "# @trace.verifies={UC-ID}-SC{N}"
61
+ source: "# @trace.source=<official .feature path>"
62
+ test_type: "# @trace.test_type=functional|integration|e2e|non-functional"
63
+
64
+ # qc_status: /qc-run-test writes pass|fail|skip|not_run + qc_run_at into {trace_dir}/{UC-ID}.tsv
65
+ # (parallel to dev_selftest), surfaced in Living Docs as the OFFICIAL QC automation result.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anhth2/spec-driven-dev-plugin",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "AI-First Spec-Driven Development workflow plugin for Claude Code",
5
5
  "bin": {
6
6
  "spec-driven-dev": "./bin/index.js"
@@ -24,7 +24,7 @@
24
24
  "skills/",
25
25
  "steps/",
26
26
  "templates/",
27
- "ARCHITECTURE.md"
27
+ "docs/"
28
28
  ],
29
29
  "keywords": [
30
30
  "claude-code",
@@ -248,19 +248,41 @@ If the file does not exist → skip silently.
248
248
 
249
249
  ---
250
250
 
251
- ## Step 3 — [CRITICAL] Load CLAUDE.md
251
+ ## Step 3 — [CRITICAL] Load CLAUDE.md (layered: root + service overlay)
252
252
 
253
253
  *This is the highest-priority context — it defines HOW to write code and documents for this project.*
254
254
 
255
- Read `CLAUDE.md`. Extract and store:
255
+ CLAUDE.md is loaded in **two layers** so umbrella-wide rules and service-specific
256
+ architecture/coding standards compose correctly. The agent always sits at the umbrella
257
+ root, but the implementation code lives in a service submodule with its OWN stack,
258
+ architecture, and conventions — so the service's CLAUDE.md must win for code generation.
259
+
260
+ **Layer 1 — [BASE] Root CLAUDE.md (umbrella-wide).**
261
+ Read `CLAUDE.md` at the repo root. Treat its contents as the **shared baseline** for the
262
+ whole umbrella — git conventions, data-protection posture, cross-cutting rules, and (in
263
+ single-service mode) the project's only architecture + coding standards.
264
+
265
+ **Layer 2 — [OVERLAY] Service CLAUDE.md (umbrella mode only).**
266
+ *Run only if `service_root` was set in Step 1.6 (i.e. a real service was routed to).*
267
+ Read `{service_root}/CLAUDE.md`. This file defines the architecture + coding standards of
268
+ the **actual stack being implemented** (e.g. `user-service` = java-spring, `web` = nextjs).
269
+ Overlay it on top of Layer 1: **on any conflict, the service value WINS** for architecture,
270
+ coding standards, and error handling. Layer-1 values that the service does not redefine
271
+ (e.g. git conventions, banned patterns shared org-wide) remain in effect.
272
+
273
+ From the **merged** result, extract and store:
256
274
 
257
275
  - **§1 Project Overview** → project name, language, framework, build/test commands, domains
258
- - **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules
259
- - **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns
260
- - **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name
261
- - **§7 Git Conventions** → branch naming pattern, commit message format
276
+ - **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules — *service overlay wins*
277
+ - **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns — *service overlay wins*
278
+ - **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name — *service overlay wins*
279
+ - **§7 Git Conventions** → branch naming pattern, commit message format — *root baseline unless service redefines*
262
280
 
263
- If `CLAUDE.md` does not exist → note it as missing and continue with project-context.yaml data only.
281
+ **Resolution rules:**
282
+ - If both layers exist → merge as above; record `claude_md_source = root + {service_root}`.
283
+ - If only the service overlay exists (no root CLAUDE.md) → use the service file alone; `claude_md_source = {service_root}`.
284
+ - 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).
285
+ - If neither exists → note CLAUDE.md as missing and continue with project-context.yaml data only.
264
286
 
265
287
  ---
266
288
 
@@ -360,7 +382,8 @@ Output exactly this block:
360
382
  [CTX LOADED]
361
383
  Stack : {language} / {framework} / {database}
362
384
  Platform : {active_module} ({platform_type})
363
- Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
385
+ Layers : {layer order from merged CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
386
+ CLAUDE.md : {root + {service_root} | {service_root} only | root only | ⚠️ service overlay MISSING — using root | missing}
364
387
  Ticket : {ticket_prefix}-
365
388
  Dict : {loaded — N canonical terms, M banned terms | missing}
366
389
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
@@ -504,6 +527,13 @@ Suggest the logical next command based on workflow phase:
504
527
  | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
505
528
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
506
529
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
530
+ | /qc-analyze | `/qc-plan {UC-ID}` (resolve 🔴 blocker gaps first) |
531
+ | /qc-plan | `/qc-design-test {UC-ID}` |
532
+ | /qc-design-test | `/qc-review {UC-ID}` (test-case review) |
533
+ | /qc-review (test-case) | `/qc-run-test {UC-ID}` if APPROVED; fix TCs if NEEDS_FIX |
534
+ | /qc-run-test | `/qc-report {UC-ID}` then `/qc-review {UC-ID}` (script review) |
535
+ | /qc-review (script) | `/qc-report {UC-ID}` then create PR if APPROVED |
536
+ | /qc-report | `/validate-traces {UC-ID}` to refresh Living Docs (qc_status) |
507
537
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
508
538
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
509
539
  | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
@@ -622,6 +652,13 @@ Suggest the logical next command based on workflow phase:
622
652
  | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
623
653
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
624
654
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
655
+ | /qc-analyze | `/qc-plan {UC-ID}` (resolve 🔴 blocker gaps first) |
656
+ | /qc-plan | `/qc-design-test {UC-ID}` |
657
+ | /qc-design-test | `/qc-review {UC-ID}` (test-case review) |
658
+ | /qc-review (test-case) | `/qc-run-test {UC-ID}` if APPROVED; fix TCs if NEEDS_FIX |
659
+ | /qc-run-test | `/qc-report {UC-ID}` then `/qc-review {UC-ID}` (script review) |
660
+ | /qc-review (script) | `/qc-report {UC-ID}` then create PR if APPROVED |
661
+ | /qc-report | `/validate-traces {UC-ID}` to refresh Living Docs (qc_status) |
625
662
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
626
663
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
627
664
  | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
@@ -163,19 +163,41 @@ If the file does not exist → skip silently.
163
163
 
164
164
  ---
165
165
 
166
- ## Step 3 — [CRITICAL] Load CLAUDE.md
166
+ ## Step 3 — [CRITICAL] Load CLAUDE.md (layered: root + service overlay)
167
167
 
168
168
  *This is the highest-priority context — it defines HOW to write code and documents for this project.*
169
169
 
170
- Read `CLAUDE.md`. Extract and store:
170
+ CLAUDE.md is loaded in **two layers** so umbrella-wide rules and service-specific
171
+ architecture/coding standards compose correctly. The agent always sits at the umbrella
172
+ root, but the implementation code lives in a service submodule with its OWN stack,
173
+ architecture, and conventions — so the service's CLAUDE.md must win for code generation.
174
+
175
+ **Layer 1 — [BASE] Root CLAUDE.md (umbrella-wide).**
176
+ Read `CLAUDE.md` at the repo root. Treat its contents as the **shared baseline** for the
177
+ whole umbrella — git conventions, data-protection posture, cross-cutting rules, and (in
178
+ single-service mode) the project's only architecture + coding standards.
179
+
180
+ **Layer 2 — [OVERLAY] Service CLAUDE.md (umbrella mode only).**
181
+ *Run only if `service_root` was set in Step 1.6 (i.e. a real service was routed to).*
182
+ Read `{service_root}/CLAUDE.md`. This file defines the architecture + coding standards of
183
+ the **actual stack being implemented** (e.g. `user-service` = java-spring, `web` = nextjs).
184
+ Overlay it on top of Layer 1: **on any conflict, the service value WINS** for architecture,
185
+ coding standards, and error handling. Layer-1 values that the service does not redefine
186
+ (e.g. git conventions, banned patterns shared org-wide) remain in effect.
187
+
188
+ From the **merged** result, extract and store:
171
189
 
172
190
  - **§1 Project Overview** → project name, language, framework, build/test commands, domains
173
- - **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules
174
- - **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns
175
- - **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name
176
- - **§7 Git Conventions** → branch naming pattern, commit message format
191
+ - **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules — *service overlay wins*
192
+ - **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns — *service overlay wins*
193
+ - **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name — *service overlay wins*
194
+ - **§7 Git Conventions** → branch naming pattern, commit message format — *root baseline unless service redefines*
177
195
 
178
- If `CLAUDE.md` does not exist → note it as missing and continue with project-context.yaml data only.
196
+ **Resolution rules:**
197
+ - If both layers exist → merge as above; record `claude_md_source = root + {service_root}`.
198
+ - If only the service overlay exists (no root CLAUDE.md) → use the service file alone; `claude_md_source = {service_root}`.
199
+ - 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).
200
+ - If neither exists → note CLAUDE.md as missing and continue with project-context.yaml data only.
179
201
 
180
202
  ---
181
203
 
@@ -275,7 +297,8 @@ Output exactly this block:
275
297
  [CTX LOADED]
276
298
  Stack : {language} / {framework} / {database}
277
299
  Platform : {active_module} ({platform_type})
278
- Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
300
+ Layers : {layer order from merged CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
301
+ CLAUDE.md : {root + {service_root} | {service_root} only | root only | ⚠️ service overlay MISSING — using root | missing}
279
302
  Ticket : {ticket_prefix}-
280
303
  Dict : {loaded — N canonical terms, M banned terms | missing}
281
304
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
@@ -442,6 +465,13 @@ Suggest the logical next command based on workflow phase:
442
465
  | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
443
466
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
444
467
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
468
+ | /qc-analyze | `/qc-plan {UC-ID}` (resolve 🔴 blocker gaps first) |
469
+ | /qc-plan | `/qc-design-test {UC-ID}` |
470
+ | /qc-design-test | `/qc-review {UC-ID}` (test-case review) |
471
+ | /qc-review (test-case) | `/qc-run-test {UC-ID}` if APPROVED; fix TCs if NEEDS_FIX |
472
+ | /qc-run-test | `/qc-report {UC-ID}` then `/qc-review {UC-ID}` (script review) |
473
+ | /qc-review (script) | `/qc-report {UC-ID}` then create PR if APPROVED |
474
+ | /qc-report | `/validate-traces {UC-ID}` to refresh Living Docs (qc_status) |
445
475
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
446
476
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
447
477
  | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
@@ -586,6 +616,13 @@ Suggest the logical next command based on workflow phase:
586
616
  | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
587
617
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
588
618
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
619
+ | /qc-analyze | `/qc-plan {UC-ID}` (resolve 🔴 blocker gaps first) |
620
+ | /qc-plan | `/qc-design-test {UC-ID}` |
621
+ | /qc-design-test | `/qc-review {UC-ID}` (test-case review) |
622
+ | /qc-review (test-case) | `/qc-run-test {UC-ID}` if APPROVED; fix TCs if NEEDS_FIX |
623
+ | /qc-run-test | `/qc-report {UC-ID}` then `/qc-review {UC-ID}` (script review) |
624
+ | /qc-review (script) | `/qc-report {UC-ID}` then create PR if APPROVED |
625
+ | /qc-report | `/validate-traces {UC-ID}` to refresh Living Docs (qc_status) |
589
626
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
590
627
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
591
628
  | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
@@ -687,6 +724,13 @@ Suggest the logical next command based on workflow phase:
687
724
  | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
688
725
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
689
726
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
727
+ | /qc-analyze | `/qc-plan {UC-ID}` (resolve 🔴 blocker gaps first) |
728
+ | /qc-plan | `/qc-design-test {UC-ID}` |
729
+ | /qc-design-test | `/qc-review {UC-ID}` (test-case review) |
730
+ | /qc-review (test-case) | `/qc-run-test {UC-ID}` if APPROVED; fix TCs if NEEDS_FIX |
731
+ | /qc-run-test | `/qc-report {UC-ID}` then `/qc-review {UC-ID}` (script review) |
732
+ | /qc-review (script) | `/qc-report {UC-ID}` then create PR if APPROVED |
733
+ | /qc-report | `/validate-traces {UC-ID}` to refresh Living Docs (qc_status) |
690
734
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
691
735
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
692
736
  | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |