@anhth2/spec-driven-dev-plugin 0.10.0 → 0.12.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 (207) hide show
  1. package/commands/debug.md +43 -8
  2. package/commands/define-product.md +43 -8
  3. package/commands/dev-gen-test.md +44 -9
  4. package/commands/dev-gen-test.tmpl +1 -1
  5. package/commands/dev-run-test.md +48 -10
  6. package/commands/dev-run-test.tmpl +5 -2
  7. package/commands/dev-smoke-test.md +43 -8
  8. package/commands/fix-bug.md +79 -14
  9. package/commands/fix-bug.tmpl +36 -6
  10. package/commands/generate-bdd.md +49 -10
  11. package/commands/generate-bdd.tmpl +6 -2
  12. package/commands/generate-code.md +44 -9
  13. package/commands/generate-code.tmpl +1 -1
  14. package/commands/generate-design-spec.md +43 -8
  15. package/commands/generate-prd.md +43 -8
  16. package/commands/generate-spec-manifest.md +43 -8
  17. package/commands/generate-tech-docs.md +43 -8
  18. package/commands/learn.md +43 -8
  19. package/commands/propose-scenario.md +74 -19
  20. package/commands/propose-scenario.tmpl +31 -11
  21. package/commands/qc-analyze.md +534 -0
  22. package/commands/qc-analyze.tmpl +86 -0
  23. package/commands/qc-design-test.md +515 -0
  24. package/commands/qc-design-test.tmpl +67 -0
  25. package/commands/qc-plan.md +497 -0
  26. package/commands/qc-plan.tmpl +49 -0
  27. package/commands/qc-report.md +508 -0
  28. package/commands/qc-report.tmpl +60 -0
  29. package/commands/qc-review.md +501 -0
  30. package/commands/qc-review.tmpl +53 -0
  31. package/commands/qc-run-test.md +549 -0
  32. package/commands/qc-run-test.tmpl +83 -0
  33. package/commands/refine-prd.md +43 -8
  34. package/commands/report-bug.md +59 -10
  35. package/commands/report-bug.tmpl +16 -2
  36. package/commands/review-code.md +43 -8
  37. package/commands/review-context.md +43 -8
  38. package/commands/review-tech-docs.md +43 -8
  39. package/commands/setup-ai-first.md +7 -0
  40. package/commands/sync.md +19 -9
  41. package/commands/sync.tmpl +12 -9
  42. package/commands/update-framework.md +7 -0
  43. package/commands/validate-traces.md +67 -12
  44. package/commands/validate-traces.tmpl +24 -4
  45. package/core/FRAMEWORK_VERSION +1 -1
  46. package/core/commands/debug.md +43 -8
  47. package/core/commands/define-product.md +43 -8
  48. package/core/commands/dev-gen-test.md +44 -9
  49. package/core/commands/dev-run-test.md +48 -10
  50. package/core/commands/dev-smoke-test.md +43 -8
  51. package/core/commands/fix-bug.md +79 -14
  52. package/core/commands/generate-bdd.md +49 -10
  53. package/core/commands/generate-code.md +44 -9
  54. package/core/commands/generate-design-spec.md +43 -8
  55. package/core/commands/generate-prd.md +43 -8
  56. package/core/commands/generate-spec-manifest.md +43 -8
  57. package/core/commands/generate-tech-docs.md +43 -8
  58. package/core/commands/learn.md +43 -8
  59. package/core/commands/propose-scenario.md +74 -19
  60. package/core/commands/qc-analyze.md +534 -0
  61. package/core/commands/qc-design-test.md +515 -0
  62. package/core/commands/qc-plan.md +497 -0
  63. package/core/commands/qc-report.md +508 -0
  64. package/core/commands/qc-review.md +501 -0
  65. package/core/commands/qc-run-test.md +549 -0
  66. package/core/commands/refine-prd.md +43 -8
  67. package/core/commands/report-bug.md +59 -10
  68. package/core/commands/review-code.md +43 -8
  69. package/core/commands/review-context.md +43 -8
  70. package/core/commands/review-tech-docs.md +43 -8
  71. package/core/commands/setup-ai-first.md +7 -0
  72. package/core/commands/sync.md +19 -9
  73. package/core/commands/update-framework.md +7 -0
  74. package/core/commands/validate-traces.md +67 -12
  75. package/core/modules/qc-playwright/stack-profile.yaml +65 -0
  76. package/core/skills/code/SKILL.md +50 -8
  77. package/core/skills/debug/SKILL.md +57 -8
  78. package/core/skills/design-spec/SKILL.md +43 -8
  79. package/core/skills/discovery/SKILL.md +43 -8
  80. package/core/skills/prd/SKILL.md +14 -0
  81. package/core/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  82. package/core/skills/qc/qa-analyst/acceptance-criteria.md +60 -0
  83. package/core/skills/qc/qa-analyst/business-rules.md +59 -0
  84. package/core/skills/qc/qa-analyst/data-flow.md +64 -0
  85. package/core/skills/qc/qa-analyst/spec-breakdown.md +61 -0
  86. package/core/skills/qc/qa-designer/e2e/journey.md +41 -0
  87. package/core/skills/qc/qa-designer/exploratory/charter.md +68 -0
  88. package/core/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  89. package/core/skills/qc/qa-designer/functional/api.md +45 -0
  90. package/core/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  91. package/core/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  92. package/core/skills/qc/qa-designer/integration/api.md +42 -0
  93. package/core/skills/qc/qa-designer/integration/db.md +39 -0
  94. package/core/skills/qc/qa-designer/integration/gui.md +40 -0
  95. package/core/skills/qc/qa-designer/integration/kafka.md +40 -0
  96. package/core/skills/qc/qa-designer/non-functional.md +40 -0
  97. package/core/skills/qc/qa-planner/test-plan.md +120 -0
  98. package/core/skills/qc/qa-reviewer/script/e2e.md +87 -0
  99. package/core/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  100. package/core/skills/qc/qa-reviewer/script/functional.md +101 -0
  101. package/core/skills/qc/qa-reviewer/script/integration.md +91 -0
  102. package/core/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  103. package/core/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  104. package/core/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  105. package/core/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  106. package/core/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  107. package/core/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  108. package/core/skills/qc/qa-runner/e2e.md +49 -0
  109. package/core/skills/qc/qa-runner/exploratory/session.md +36 -0
  110. package/core/skills/qc/qa-runner/functional/api.md +35 -0
  111. package/core/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  112. package/core/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  113. package/core/skills/qc/qa-runner/integration.md +47 -0
  114. package/core/skills/qc/qa-runner/non-functional.md +49 -0
  115. package/core/skills/qc/qa-runner/report/report.md +37 -0
  116. package/core/skills/setup-ai-first/SKILL.md +7 -0
  117. package/core/skills/spec/SKILL.md +14 -0
  118. package/core/skills/test/SKILL.md +93 -16
  119. package/core/steps/context-loader.md +36 -8
  120. package/core/steps/report-footer.md +7 -0
  121. package/core/templates/project-context.yaml +27 -1
  122. package/docs/01-getting-started/README.md +19 -0
  123. package/docs/01-getting-started/core-concepts.md +102 -0
  124. package/docs/01-getting-started/installation.md +156 -0
  125. package/docs/01-getting-started/quickstart.md +85 -0
  126. package/docs/02-guides/README.md +27 -0
  127. package/docs/02-guides/developer/README.md +46 -0
  128. package/docs/02-guides/developer/bdd-and-trace.md +123 -0
  129. package/docs/02-guides/developer/commands.md +76 -0
  130. package/docs/02-guides/developer/pr-checklist.md +15 -0
  131. package/docs/02-guides/developer/scenarios.md +448 -0
  132. package/docs/02-guides/developer/workflow.md +61 -0
  133. package/docs/02-guides/product-owner/README.md +77 -0
  134. package/docs/02-guides/product-owner/commands.md +30 -0
  135. package/docs/02-guides/product-owner/handoff-checklist.md +42 -0
  136. package/docs/02-guides/product-owner/prd-writing-rules.md +45 -0
  137. package/docs/02-guides/product-owner/scenarios.md +357 -0
  138. package/docs/02-guides/qc-automation.md +157 -0
  139. package/docs/02-guides/tester/README.md +74 -0
  140. package/docs/02-guides/tester/bug-reporting.md +117 -0
  141. package/docs/02-guides/tester/reading-specs.md +79 -0
  142. package/docs/02-guides/tester/scenarios.md +186 -0
  143. package/docs/02-guides/tester/spec-manifest.md +124 -0
  144. package/docs/02-guides/tester/test-checklist.md +31 -0
  145. package/docs/02-guides/tester/workflow.md +80 -0
  146. package/docs/03-concepts/README.md +19 -0
  147. package/docs/03-concepts/architecture.md +245 -0
  148. package/docs/03-concepts/pipeline.md +262 -0
  149. package/docs/03-concepts/traceability.md +149 -0
  150. package/docs/04-operations/README.md +33 -0
  151. package/docs/04-operations/bug-flow.md +362 -0
  152. package/docs/04-operations/publishing.md +137 -0
  153. package/docs/04-operations/sync-and-update.md +365 -0
  154. package/docs/05-reference/README.md +29 -0
  155. package/docs/05-reference/commands.md +229 -0
  156. package/docs/05-reference/modules.md +110 -0
  157. package/docs/05-reference/trace-schema.md +152 -0
  158. package/docs/README.md +51 -0
  159. package/modules/qc-playwright/stack-profile.yaml +65 -0
  160. package/package.json +2 -2
  161. package/skills/code/SKILL.md +50 -8
  162. package/skills/debug/SKILL.md +57 -8
  163. package/skills/design-spec/SKILL.md +43 -8
  164. package/skills/discovery/SKILL.md +43 -8
  165. package/skills/prd/SKILL.md +14 -0
  166. package/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  167. package/skills/qc/qa-analyst/acceptance-criteria.md +60 -0
  168. package/skills/qc/qa-analyst/business-rules.md +59 -0
  169. package/skills/qc/qa-analyst/data-flow.md +64 -0
  170. package/skills/qc/qa-analyst/spec-breakdown.md +61 -0
  171. package/skills/qc/qa-designer/e2e/journey.md +41 -0
  172. package/skills/qc/qa-designer/exploratory/charter.md +68 -0
  173. package/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  174. package/skills/qc/qa-designer/functional/api.md +45 -0
  175. package/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  176. package/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  177. package/skills/qc/qa-designer/integration/api.md +42 -0
  178. package/skills/qc/qa-designer/integration/db.md +39 -0
  179. package/skills/qc/qa-designer/integration/gui.md +40 -0
  180. package/skills/qc/qa-designer/integration/kafka.md +40 -0
  181. package/skills/qc/qa-designer/non-functional.md +40 -0
  182. package/skills/qc/qa-planner/test-plan.md +120 -0
  183. package/skills/qc/qa-reviewer/script/e2e.md +87 -0
  184. package/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  185. package/skills/qc/qa-reviewer/script/functional.md +101 -0
  186. package/skills/qc/qa-reviewer/script/integration.md +91 -0
  187. package/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  188. package/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  189. package/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  190. package/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  191. package/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  192. package/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  193. package/skills/qc/qa-runner/e2e.md +49 -0
  194. package/skills/qc/qa-runner/exploratory/session.md +36 -0
  195. package/skills/qc/qa-runner/functional/api.md +35 -0
  196. package/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  197. package/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  198. package/skills/qc/qa-runner/integration.md +47 -0
  199. package/skills/qc/qa-runner/non-functional.md +49 -0
  200. package/skills/qc/qa-runner/report/report.md +37 -0
  201. package/skills/setup-ai-first/SKILL.md +7 -0
  202. package/skills/spec/SKILL.md +14 -0
  203. package/skills/test/SKILL.md +93 -16
  204. package/steps/context-loader.md +36 -8
  205. package/steps/report-footer.md +7 -0
  206. package/templates/project-context.yaml +27 -1
  207. package/ARCHITECTURE.md +0 -258
@@ -36,6 +36,21 @@ paths:
36
36
  prd_template: "specs/templates/prd.template.md"
37
37
  refinement_dir: ".agent/review"
38
38
 
39
+ # QC's OWN analysis/design working docs (qc-analyze/plan/design-test outputs:
40
+ # REQUIREMENT_ANALYSIS.md, DOC_GAPS.md, TEST_PLAN.md, test-cases/*.Test.md).
41
+ # One subfolder per UC: {qc_dir}/{UC-ID}/. Default "docs" (the QC team's own
42
+ # convention), VISIBLE — not hidden under .agent/. NOTE: specs (PRD / .feature /
43
+ # design-spec) are NOT here — they come from the PO spec submodule (spec_source).
44
+ qc_dir: "docs"
45
+
46
+ # WHERE the qc-* commands LOAD their skills from (qa-analyst / qa-designer / qa-planner
47
+ # / qa-reviewer / qa-runner + DOC_GAPS.template.md). Default = the framework-bundled
48
+ # copy at .agent/skills/qc (works standalone). The QC team OWNS these skills in their
49
+ # canonical repo (ai-automation-qc-base) — point this at that repo/submodule (e.g.
50
+ # "qc-base/.claude/skills") so the skills evolve INDEPENDENTLY and are NOT overwritten
51
+ # by framework upgrade (--init / upgrade.sh rewrite only .agent/, never this path).
52
+ qc_skills_dir: ".agent/skills/qc"
53
+
39
54
  # Product Definitions
40
55
  product_definitions_dir: "specs/product-definition"
41
56
  product_definition_template: "specs/templates/product-definition.template.md"
@@ -61,11 +76,14 @@ paths:
61
76
  # Trace
62
77
  trace_dir: ".trace"
63
78
 
64
- # Tester feedback (written by /report-bug and /propose-scenario).
79
+ # Tester / QC feedback (written by /report-bug and /propose-scenario).
65
80
  # These live in the SHARED spec repo so PO/Dev see them on their next /sync.
66
81
  # In umbrella mode, context-loader auto-resolves them under {spec_source}/feedback/.
67
82
  bug_reports_dir: "feedback/bug-reports"
68
83
  bdd_proposals_dir: "feedback/bdd-proposals"
84
+ # PRD change requests (new requirement found in test, not covered by any AC) —
85
+ # written by /propose-scenario Case B so the PO can add/extend an AC then re-/generate-bdd.
86
+ prd_change_requests_dir: "feedback/prd-change-requests"
69
87
 
70
88
  tech_stack:
71
89
  language: "{{LANGUAGE}}" # e.g., Java 17 / TypeScript / C# / Go
@@ -106,6 +124,14 @@ domains:
106
124
  # module: "{{STACK_MODULE}}" # e.g., java-spring, nextjs, flutter
107
125
  # specs_dir: "{{SERVICE_SUBMODULE_DIR}}/specs/bdd"
108
126
  # tech_docs_dir: "{{SERVICE_SUBMODULE_DIR}}/specs/tech-docs"
127
+ #
128
+ # IMPORTANT — per-service CLAUDE.md:
129
+ # Each service submodule should have its OWN CLAUDE.md ({path}/CLAUDE.md) defining its
130
+ # architecture + coding standards for ITS stack. context-loader loads CLAUDE.md in two
131
+ # layers: root CLAUDE.md (umbrella-wide shared rules) + {service}/CLAUDE.md (overlay,
132
+ # wins on conflict for architecture/coding-standards). The agent sits at the umbrella
133
+ # root, so without a service CLAUDE.md, code generation falls back to umbrella defaults
134
+ # (likely the wrong stack). Generate one per service via /setup-ai-first inside each.
109
135
  # {{DOMAIN_2}}:
110
136
  # path: "{{SERVICE_2_DIR}}"
111
137
  # module: "{{STACK_MODULE}}"
@@ -0,0 +1,19 @@
1
+ [📚 Docs](../README.md) › Getting Started
2
+
3
+ # Getting Started
4
+
5
+ Bắt đầu với spec-driven-dev framework — cài đặt, chạy feature đầu tiên, và nắm các khái niệm cốt lõi trong vài phút.
6
+
7
+ ## Mục lục (this section)
8
+
9
+ - [installation.md](installation.md) — Cài framework, prerequisites (Node, Claude Code), QC automation stack, và VS Code extension (Review Board + Living Docs panels).
10
+ - [quickstart.md](quickstart.md) — Chạy feature đầu tiên end-to-end: Discovery → PRD → BDD → Tech Design → Code → Dev self-check.
11
+ - [core-concepts.md](core-concepts.md) — Khái niệm trong 5 phút: spec-as-source-of-truth, pipeline phases, traceability, dev_selftest vs qc_status, umbrella/spec-module.
12
+
13
+ ## Đọc gì trước?
14
+
15
+ 1. Mới hoàn toàn? → bắt đầu ở [core-concepts.md](core-concepts.md) để hiểu triết lý.
16
+ 2. Sẵn sàng cài? → [installation.md](installation.md).
17
+ 3. Đã cài xong? → [quickstart.md](quickstart.md) để chạy feature đầu tiên.
18
+
19
+ > Cần đào sâu hơn? Xem các section khác trong [📚 Docs](../README.md) — concepts, multi-repo/umbrella, QC pipeline, command reference, architecture.
@@ -0,0 +1,102 @@
1
+ [📚 Docs](../README.md) › [Getting Started](README.md) › Core Concepts
2
+
3
+ # Core Concepts
4
+
5
+ Các khái niệm cốt lõi trong 5 phút. Đào sâu hơn ở [../03-concepts](../03-concepts).
6
+
7
+ ## Mục lục
8
+
9
+ - [Spec là source of truth](#spec-là-source-of-truth)
10
+ - [Pipeline phases](#pipeline-phases)
11
+ - [Traceability](#traceability)
12
+ - [dev_selftest vs qc_status](#dev_selftest-vs-qc_status)
13
+ - [Umbrella & spec module](#umbrella--spec-module)
14
+
15
+ ## Spec là source of truth
16
+
17
+ > **Write the spec first. Generate the code from the spec. Trace everything.**
18
+
19
+ - Con người định nghĩa *WHAT* — acceptance criteria, business rules, platform requirements.
20
+ - AI sinh ra *HOW* — BDD scenarios, tech design, code, tests — thích ứng theo platform.
21
+ - Mỗi artifact được review trước khi sang phase kế tiếp (AI review gate ở mọi transition).
22
+ - Mỗi dòng code truy ngược về một scenario trong file `.feature`.
23
+
24
+ **PRD platform-agnostic (Option C):** một PRD phục vụ mọi platform — chỉ mô tả nghiệp vụ, không có chi tiết UI hay API. FE/App đọc PRD → Design Spec → BDD; BE đọc PRD trực tiếp → BDD. Thêm platform mới sau không cần sửa PRD.
25
+
26
+ ## Pipeline phases
27
+
28
+ ```
29
+ Discovery → PRD → BDD Spec → Tech Design → Code → Dev Self-Check
30
+ (+ QC suite chính thức song song)
31
+ ```
32
+
33
+ | Phase | Ai | Lệnh chính | Output |
34
+ |-------|-----|-----------|--------|
35
+ | Discovery | PO + AI | `/define-product` | `specs/product-definition/{slug}.md` |
36
+ | PRD | AI → SA/PO | `/generate-prd`, `/refine-prd`, `/review-context` | `specs/prd/{domain}/{slug}.md` |
37
+ | Design Spec *(FE/App)* | AI → Designer/PO | `/generate-design-spec` | `specs/design-spec/...` |
38
+ | BDD Spec | AI → SA/Dev | `/generate-bdd`, `/review-context` | `specs/bdd/{domain}/{UC-ID}.feature` |
39
+ | Tech Design | AI → SA/Lead | `/generate-tech-docs`, `/review-tech-docs` | `tech-docs/{domain}/{UC-ID}-tech-design.md` |
40
+ | Code | AI → Dev | `/generate-code`, `/review-code` | `src/...` |
41
+ | Dev Self-Check | Dev | `/dev-gen-test`, `/dev-run-test`, `/dev-smoke-test` | `src/test/...` |
42
+ | QC Automation | QC | `/qc-analyze → /qc-plan → /qc-design-test → /qc-review → /qc-run-test → /qc-report` | QC designs + run results |
43
+ | Trace audit | Tech Lead | `/validate-traces {domain}` | Coverage + drift report |
44
+
45
+ Chi tiết từng phase + happy-path lệnh: [quickstart.md](quickstart.md).
46
+
47
+ ## Traceability
48
+
49
+ Mỗi artifact link tới artifact khác qua `@trace.*` tags:
50
+
51
+ ```
52
+ product-definition.md
53
+ └─► PRD.md (Service, Module trong metadata)
54
+ └─► {UC-ID}.feature (@trace.service, @trace.module, @trace.prd_version)
55
+ └─► tech-design.md (@trace.bdd_version)
56
+ └─► src/ code (@trace.implements, @trace.prd_version, @trace.bdd_version)
57
+ └─► src/test/ (@trace.verifies, @trace.service)
58
+ └─► .trace/{UC-ID}.tsv (drift tracking)
59
+ ```
60
+
61
+ `/validate-traces {domain}` đọc các `.trace/{UC-ID}.tsv` và báo cáo:
62
+
63
+ | Status | Nghĩa |
64
+ |--------|-------|
65
+ | ✅ OK | Code version khớp spec version |
66
+ | ⚠️ DRIFT | Code sinh từ PRD/BDD version cũ — cần re-generate |
67
+ | 🔴 GAP | Scenario có trong spec nhưng chưa có code implement |
68
+ | — UNTRACKED | Scenario ghi nhận nhưng chưa code-gen |
69
+
70
+ Chi tiết tags + chain: [../03-concepts/traceability.md](../03-concepts/traceability.md).
71
+
72
+ ## dev_selftest vs qc_status
73
+
74
+ Hai signal **độc lập** trong trace TSV — đừng nhầm lẫn:
75
+
76
+ | Signal | Set bởi | Ý nghĩa |
77
+ |--------|---------|---------|
78
+ | `dev_selftest` (+ `dev_selftest_at`) | `/dev-run-test` | Dev tự verify code của mình (smoke / self-check). **KHÔNG phải** official coverage. |
79
+ | `qc_status` (+ `qc_run_at`) | `/qc-run-test` | Bộ QC suite chính thức (native `/qc-*` pipeline), keyed theo `@trace.verifies={UC-ID}-SC{N}`. |
80
+
81
+ QC owns `qc_status`; dev owns `dev_selftest`. Living Docs panel hiển thị cả hai cạnh nhau. `/qc-run-test` & `/qc-report` dùng stack `qc-playwright` (độc lập với dev module — xem [installation.md](installation.md)).
82
+
83
+ ## Umbrella & spec module
84
+
85
+ Cho project có nhiều service repo riêng (microservices, multi-platform): pattern khuyến nghị là **umbrella repo** — repo tổng chứa các service repo dưới dạng git submodule.
86
+
87
+ ```
88
+ my-project-umbrella/ ← mở Claude Code ở đây
89
+ ├── .agent/project-context.yaml ← routing config (domain → service)
90
+ ├── my-project-specs/ ← submodule: spec module của PO (PRD, design-spec, tech-docs)
91
+ ├── user-service/ ← submodule: microservice
92
+ └── web-app/ ← submodule: FE app
93
+ ```
94
+
95
+ - **Spec module** (`{spec_source}/`): chứa PRD, Design Spec, và tech-docs (API contract) — shared để mọi umbrella đọc cùng contract. Report canonical của Living Docs cũng sinh tại `{spec_source}/.living-docs/`.
96
+ - **Routing:** context-loader đọc `@trace.domain` từ PRD → tra trong `services` config → route BDD/code vào đúng service submodule. PRD phải có `@trace.domain` khớp một key trong `services`.
97
+
98
+ Setup umbrella đầy đủ, file ownership, two-layer commit, multi-platform → [Operations › Sync & Update §4 Umbrella mode](../04-operations/sync-and-update.md#4-umbrella-mode--git-submodule).
99
+
100
+ ---
101
+
102
+ Sẵn sàng chạy? → [quickstart.md](quickstart.md).
@@ -0,0 +1,156 @@
1
+ [📚 Docs](../README.md) › [Getting Started](README.md) › Installation
2
+
3
+ # Installation
4
+
5
+ Cài đặt framework vào project và (tùy chọn) VS Code extension.
6
+
7
+ ## Mục lục
8
+
9
+ - [Prerequisites](#prerequisites)
10
+ - [Cài framework](#cài-framework)
11
+ - [Kiểm tra cài đặt](#kiểm-tra-cài-đặt)
12
+ - [Upgrade](#upgrade)
13
+ - [QC automation stack (tùy chọn)](#qc-automation-stack-tùy-chọn)
14
+ - [VS Code extension (khuyến nghị)](#vs-code-extension-khuyến-nghị)
15
+ - [Uninstall](#uninstall)
16
+
17
+ ## Prerequisites
18
+
19
+ | Tool | Version | Link |
20
+ |------|---------|------|
21
+ | Node.js | bất kỳ (check: `node -v`) | [nodejs.org](https://nodejs.org) |
22
+ | Claude Code CLI | Latest | [claude.ai/code](https://claude.ai/code) |
23
+ | VS Code | ≥ 1.85 | [code.visualstudio.com](https://code.visualstudio.com) |
24
+ | Git | bất kỳ | |
25
+
26
+ > Claude Code cần subscription (Claude Pro / Team / API key).
27
+
28
+ ## Cài framework
29
+
30
+ Chạy từ **thư mục root của project**. Cách khuyến nghị là `--init` — cài framework vào `.agent/` (commit vào git, cả team dùng chung) và tạo shortcut trong `.claude/commands/`.
31
+
32
+ ```bash
33
+ # Single-service project:
34
+ npx @anhth2/spec-driven-dev-plugin --init --module java-spring
35
+
36
+ # Multi-service monorepo (cài vào từng subfolder trong 1 lệnh):
37
+ npx @anhth2/spec-driven-dev-plugin --init \
38
+ --services backend:java-spring,web-admin:react,app-mobile:flutter
39
+ ```
40
+
41
+ Kết quả:
42
+ - `.agent/` — toàn bộ framework files (commit vào git, shared với team)
43
+ - `.claude/commands/` — shortcut trỏ về `.agent/commands/`
44
+ - `.agent/FRAMEWORK_VERSION` — tracking version để upgrade
45
+
46
+ ```bash
47
+ git add .agent/ .claude/commands/
48
+ git commit -m "chore: init spec-driven-dev"
49
+ ```
50
+
51
+ > **Multi-repo / umbrella?** Xem hướng dẫn umbrella setup chi tiết trong [Operations › Sync & Update §4 Umbrella mode](../04-operations/sync-and-update.md#4-umbrella-mode--git-submodule).
52
+
53
+ ### Legacy install (global / per-project)
54
+
55
+ ```bash
56
+ npx @anhth2/spec-driven-dev-plugin # global: ~/.claude/commands/
57
+ npx @anhth2/spec-driven-dev-plugin --project # project: ./.claude/commands/
58
+ ```
59
+
60
+ ## Kiểm tra cài đặt
61
+
62
+ Mở Claude Code tại project, gõ `/` — bạn sẽ thấy các lệnh:
63
+
64
+ ```
65
+ /setup-ai-first
66
+ /define-product
67
+ /generate-prd
68
+ /generate-bdd
69
+ ...
70
+ ```
71
+
72
+ > Không thấy lệnh? Chạy lại lệnh cài (global lưu tại `~/.claude/commands/`, trên Windows: `ls "$env:USERPROFILE\.claude\commands\"`).
73
+
74
+ ## Upgrade
75
+
76
+ Từ **trong Claude Code** (khuyến nghị — check version, xử lý umbrella mode, review diff):
77
+
78
+ ```
79
+ /update-framework
80
+ ```
81
+
82
+ Hoặc từ terminal:
83
+
84
+ ```bash
85
+ bash scripts/upgrade.sh
86
+ # hoặc:
87
+ npx @anhth2/spec-driven-dev-plugin@latest --init
88
+ git diff .agent/ && git add .agent/ && git commit -m "chore: upgrade framework"
89
+ ```
90
+
91
+ > Chỉ upgrade framework command files. `project-context.yaml`, `CLAUDE.md`, domain-knowledge, và `.trace/` không bao giờ bị ghi đè. Để sync *content* của project (submodule code/specs) dùng `/sync`.
92
+ >
93
+ > ⚠️ **QC skills & upgrade:** `--init` / `upgrade.sh` ghi đè **toàn bộ** `.agent/` — **gồm cả** `.agent/skills/qc/`. Nếu QC chỉnh skills trực tiếp trong `.agent/skills/qc/`, các thay đổi đó **mất** khi upgrade. Để giữ an toàn, trỏ `paths.qc_skills_dir` ra một repo/submodule QC **ngoài** `.agent/` (vd `qc-base/.claude/skills`) — upgrade không bao giờ chạm tới đó. Chi tiết: [../02-guides/qc-automation.md#skill-sourcing--upgrade-safety](../02-guides/qc-automation.md#skill-sourcing--upgrade-safety).
94
+
95
+ ## QC automation stack (tùy chọn)
96
+
97
+ Bộ QC suite chính thức (`/qc-*`) là **native** trong framework. Hai lệnh cuối — `/qc-run-test` và `/qc-report` — dùng stack module **`qc-playwright`**, **độc lập với dev module**. Cài riêng:
98
+
99
+ ```bash
100
+ # 1. Python 3 + pytest-playwright
101
+ pip install pytest-playwright
102
+
103
+ # 2. Cài browsers
104
+ python3 -m playwright install
105
+ ```
106
+
107
+ `qc-playwright` = Python + pytest-playwright + Page Object (output: Playwright Trace + pytest-html). Chi tiết pipeline: [../02-guides/qc-automation.md](../02-guides/qc-automation.md).
108
+
109
+ ## VS Code extension (khuyến nghị)
110
+
111
+ **Spec Driven Dev** là VS Code extension với 2 panels. Không bắt buộc nhưng khuyến nghị. VS Code tự cập nhật khi có version mới.
112
+
113
+ ```bash
114
+ code --install-extension edupia-team.spec-driven-dev-team
115
+ ```
116
+
117
+ Hoặc: `Ctrl+Shift+P` → **"Extensions: Install from Marketplace"** → search **Spec Driven Dev**.
118
+
119
+ ### Panel 1 — Review Board
120
+
121
+ Đọc `*-findings.yaml` từ `.agent/review/` — hỗ trợ findings từ mọi review command (`/refine-prd`, `/review-context`, `/review-tech-docs`).
122
+
123
+ - Lens tabs: All / QA / DEV / SA / PO hoặc PRD / BDD / TECH.
124
+ - Mỗi finding có badge `⚡ auto-fix` / `👤 human`.
125
+ - 4 actions: Accept · Modify (có note) · Defer · Reject — kèm progress bar, full-text search.
126
+ - **Smart Apply** spawn terminal chạy đúng lệnh `--resume`.
127
+
128
+ Mở Review Board: sidebar panel (Activity Bar), hoặc right-click file `*-findings.yaml` → "Open Review Board", hoặc Command Palette. Nếu panel trống: file phải có đuôi `-findings.yaml`, nằm trong `.agent/review/`, và đóng hẳn rồi mở lại VS Code.
129
+
130
+ ### Panel 2 — Living Documentation
131
+
132
+ Đọc `.trace/*.tsv` — dashboard traceability health toàn project.
133
+
134
+ - Stat cards: PRDs, Use Cases, Scenarios, Code Cov%, Test Cov%, Drift, Gap.
135
+ - Drill-down: PRD → UC → per-scenario table (Spec ver, Gen ver, Code, Tests, `dev_selftest`, `qc_status`, Waiting on, Status). *Waiting on* = `qc_owner` + `qc_blocked_by` (chờ dev → `BUG-{id}` / chờ PO → `GAP-{id}`).
136
+ - Status badges: ✅ OK · ⚠️ DRIFT · 🔴 GAP · — UNTRACKED. Filter + search + live reload.
137
+
138
+ Mở: `Ctrl+Shift+P` → **"Spec Driven Dev: Open Living Documentation"**. Mở được cả ở umbrella root lẫn trong một service submodule riêng lẻ. Nếu trống, chạy `/generate-bdd` cho ≥1 feature để tạo file `.trace/{UC-ID}.tsv` đầu tiên.
139
+
140
+ > Report canonical sinh vào spec module tại `{spec_source}/.living-docs/` (gitignored); bản mirror cục bộ ở `./.trace`. Chi tiết traceability: [core-concepts.md](core-concepts.md) và [../03-concepts/traceability.md](../03-concepts/traceability.md).
141
+
142
+ ## Uninstall
143
+
144
+ **Mac/Linux:**
145
+ ```bash
146
+ rm -rf .agent/ .claude/commands/
147
+ ```
148
+
149
+ **Windows (PowerShell):**
150
+ ```powershell
151
+ Remove-Item -Recurse -Force .agent, .claude\commands
152
+ ```
153
+
154
+ ---
155
+
156
+ Cài xong? → [quickstart.md](quickstart.md) để chạy feature đầu tiên.
@@ -0,0 +1,85 @@
1
+ [📚 Docs](../README.md) › [Getting Started](README.md) › Quick Start
2
+
3
+ # Quick Start
4
+
5
+ Chạy feature đầu tiên end-to-end theo happy path. Mở Claude Code tại root project và làm theo thứ tự.
6
+
7
+ ## Mục lục
8
+
9
+ - [Bước 0 — Setup project (một lần)](#bước-0--setup-project-một-lần)
10
+ - [Happy-path command sequence](#happy-path-command-sequence)
11
+ - [Bước tiếp theo](#bước-tiếp-theo)
12
+
13
+ ## Bước 0 — Setup project (một lần)
14
+
15
+ ```bash
16
+ # 1. Cài framework (nếu chưa) — xem installation.md
17
+ npx @anhth2/spec-driven-dev-plugin --init
18
+
19
+ # 2. Mở project trong Claude Code, tạo cấu trúc + config files:
20
+ /setup-ai-first
21
+ ```
22
+
23
+ `/setup-ai-first` tạo cấu trúc thư mục (`specs/`, `tech-docs/`, `.trace/`, `.agent/`, `CLAUDE.md`). Sau đó điền thông tin thực tế vào 4 file config:
24
+
25
+ | File | Nội dung |
26
+ |------|----------|
27
+ | `CLAUDE.md` | Architecture layers, coding standards, git conventions |
28
+ | `.agent/project-context.yaml` | Tech stack, services, paths, ticket prefix |
29
+ | `specs/domain-knowledge/business-dictionary.md` | Canonical terms, banned terms |
30
+ | `specs/domain-knowledge/core-entities.md` | Entity glossary (fields, relationships) |
31
+
32
+ > Project đã có sẵn `specs/`, `CLAUDE.md`, `.agent/project-context.yaml`? Bỏ qua bước này, vào thẳng happy path bên dưới. Chi tiết điền config + Figma setup: xem [../02-guides](../02-guides) và [../03-concepts](../03-concepts).
33
+
34
+ ## Happy-path command sequence
35
+
36
+ Discovery → PRD → BDD → Tech Design → Code → Dev self-check:
37
+
38
+ ```
39
+ # PHASE 1 — DISCOVERY
40
+ /define-product
41
+ → specs/product-definition/{slug}.md
42
+
43
+ # PHASE 2 — PRD
44
+ /generate-prd specs/product-definition/{slug}.md
45
+ → specs/prd/{domain}/{slug}.md
46
+ /refine-prd specs/prd/{domain}/{slug}.md # AI suggestions → Review Board
47
+ /refine-prd --resume specs/prd/{domain}/{slug}.md # apply + bump version
48
+ /review-context specs/prd/{domain}/{slug}.md # quality gate (P1–P4)
49
+ /review-context --resume specs/prd/{domain}/{slug}.md
50
+ → ✅ APPROVED → tiếp Phase 3
51
+
52
+ # PHASE 3 — SPEC & DESIGN
53
+ # (FE/App only) /generate-design-spec specs/prd/{domain}/{slug}.md → designer + PO sign-off
54
+ /generate-bdd specs/prd/{domain}/{slug}.md
55
+ → specs/bdd/{domain}/{UC-ID}.feature
56
+ /review-context specs/bdd/{domain}/{UC-ID}.feature
57
+ /review-context --resume specs/bdd/{domain}/{UC-ID}.feature # apply + bump bdd_version
58
+ /generate-tech-docs specs/bdd/{domain}/{UC-ID}.feature
59
+ → tech-docs/{domain}/{UC-ID}-tech-design.md
60
+ /review-tech-docs tech-docs/{domain}/{UC-ID}-tech-design.md
61
+ /review-tech-docs --resume tech-docs/{domain}/{UC-ID}-tech-design.md
62
+
63
+ # PHASE 4 — CODE
64
+ /generate-code specs/bdd/{domain}/{UC-ID}.feature
65
+ → src/... (@trace.implements tags)
66
+ /review-code # fix CRITICAL / MAJOR
67
+
68
+ # PHASE 5 — DEV SELF-CHECK (dev verify code của mình — KHÔNG phải QC suite chính thức)
69
+ /dev-gen-test specs/bdd/{domain}/{UC-ID}.feature
70
+ → src/test/... (@trace.verifies tags)
71
+ /dev-run-test # sets dev_selftest in trace
72
+ /dev-smoke-test # optional — live endpoint check
73
+ /validate-traces {domain} # coverage & drift
74
+ ```
75
+
76
+ Mỗi review command ghi findings vào `.agent/review/*-findings.yaml`. Mở **Review Board** (VS Code panel) → Accept / Modify / Defer / Reject từng finding → chạy `--resume` để apply. Quick-fix không qua Review Board: `/review-context --fix {file}` (chỉ apply auto-fixable).
77
+
78
+ > **FE/App:** `/generate-code --phase=ui` (UI + mock adapter, tester test ngay) rồi `--phase=integration` (wire API thật sau sign-off).
79
+
80
+ ## Bước tiếp theo
81
+
82
+ - Hiểu khái niệm phía sau pipeline → [core-concepts.md](core-concepts.md).
83
+ - QC suite chính thức (`/qc-analyze → /qc-plan → /qc-design-test → /qc-review → /qc-run-test → /qc-report`) → [../02-guides/qc-automation.md](../02-guides/qc-automation.md).
84
+ - Role guides, scenarios thực tế, multi-repo/umbrella → [../02-guides](../02-guides) và [../03-concepts](../03-concepts).
85
+ - Full command reference → [../05-reference](../05-reference).
@@ -0,0 +1,27 @@
1
+ [📚 Docs](../README.md) › Guides
2
+
3
+ # Guides — Role Playbooks
4
+
5
+ Mỗi role trong framework spec-driven-dev có một guide riêng: vai trò, commands, workflow, và các tình huống thực tế. Bắt đầu từ guide khớp với role của bạn.
6
+
7
+ ## Mục Lục
8
+
9
+ | Guide | Dành cho | Nội dung |
10
+ |---|---|---|
11
+ | [Product Owner / BA](product-owner/README.md) | PO, BA | Viết PRD platform-agnostic, generate Design Spec + BDD, handoff cho dev team |
12
+ | [Developer (FE / BE / App)](developer/README.md) | Dev | Đọc PRD + BDD từ spec submodule, generate tech-docs + code, dev self-check, trace system |
13
+ | [Tester / QA](tester/README.md) | QA, Tester | Spec-manifest, đọc spec chain, viết test cases, `/report-bug` + `/propose-scenario` |
14
+ | [QC Automation](qc-automation.md) | QC | Pipeline `/qc-*` 6 bước, `qc_status` chính thức, stack module `qc-playwright` |
15
+ | Designer | Designer, UX | Tham gia giai đoạn Design Spec — sign-off màn hình + component trước khi PO gen BDD. Chưa có guide riêng; xem [Product Owner › Design Spec](product-owner/scenarios.md#tình-huống-3--tạo-design-spec-và-bdd-sau-khi-prd-approved) để biết điểm giao. |
16
+
17
+ ## Phân biệt nhanh hai luồng test
18
+
19
+ - **Dev self-check** — `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test`, ghi `dev_selftest`. Smoke check của riêng dev, KHÔNG phải coverage chính thức.
20
+ - **QC chính thức** — pipeline `/qc-analyze … /qc-report`, ghi `qc_status`. Bộ test authoritative, do QC chạy.
21
+
22
+ Hai tín hiệu này đứng cạnh nhau trong Living Docs và không ghi đè nhau.
23
+
24
+ ## Xem thêm
25
+
26
+ - [Concepts › Traceability](../03-concepts/traceability.md) — trace chain PRD → BDD → Code
27
+ - [Reference › Commands](../05-reference/commands.md) — danh mục đầy đủ mọi command
@@ -0,0 +1,46 @@
1
+ [📚 Docs](../../README.md) › [Guides](../README.md) › Developer
2
+
3
+ # Hướng Dẫn Developer — Spec-Driven Dev
4
+
5
+ Tài liệu dành cho **Developer (FE / BE / App)** — vai trò, commands, trace system, workflow, và các tình huống thực tế. Được chia nhỏ theo chủ đề để dễ đọc:
6
+
7
+ ## Mục Lục
8
+
9
+ | Trang | Nội dung |
10
+ |---|---|
11
+ | [Commands](commands.md) | Bảng lệnh cho dev · project lessons · xử lý feedback tester · khi nào dùng `--phase` |
12
+ | [BDD & Trace System](bdd-and-trace.md) | Tại sao BDD quan trọng với dev · `@trace.*` fields · trace chain · khi nào `/validate-traces` |
13
+ | [Workflow](workflow.md) | Luồng làm việc cơ bản từ nhận PRD đến tạo PR |
14
+ | [Tình huống thực tế](scenarios.md) | 8 scenario: nhận PRD mới, đọc System/Web BDD, PRD đổi, API sign-off, bug từ tester, design spec, brownfield, umbrella, validate-traces |
15
+ | [Checklist trước khi tạo PR](pr-checklist.md) | Checklist verify trước khi mở PR |
16
+
17
+ ## Vai Trò Dev Trong Framework
18
+
19
+ ```
20
+ PO/BA Dev
21
+ ────────────────────── ──────────────────────────────────────
22
+ /define-product /review-context (đọc PRD + BDD)
23
+ /generate-prd → đọc BDD từ spec submodule
24
+ /refine-prd /generate-tech-docs (từ BDD → Tech Docs)
25
+ /review-context /generate-code (từ BDD + Tech Docs → Code)
26
+ /generate-design-spec → /dev-gen-test
27
+ /generate-bdd (web) /review-code
28
+ /generate-bdd (app) /dev-run-test
29
+ /generate-bdd (system) /fix-bug / /debug
30
+ /validate-traces
31
+ ```
32
+
33
+ **Dev chịu trách nhiệm:**
34
+ - Đọc và hiểu PRD + BDD từ spec submodule trước khi bắt đầu
35
+ - **KHÔNG tự generate BDD** — BDD đã được PO generate trong spec repo
36
+ - Đảm bảo code trace về đúng BDD scenario, BDD trace về đúng PRD
37
+ - Báo PO/BA khi PRD hoặc BDD có gì không rõ hoặc mâu thuẫn — không tự suy diễn
38
+
39
+ **Dev KHÔNG làm:**
40
+ - Viết/sửa PRD — đó là việc của PO/BA
41
+ - Viết/sửa Design Spec — đó là việc của PO/BA + Designer
42
+ - Approve PRD — chỉ PO mới có quyền này
43
+
44
+ ---
45
+
46
+ *Xem thêm:* [Product Owner Guide](../product-owner/README.md) · [Tester Guide](../tester/README.md) · [QC Automation Guide](../qc-automation.md) · [Concepts › Traceability](../../03-concepts/traceability.md) · [Reference › Commands](../../05-reference/commands.md)
@@ -0,0 +1,123 @@
1
+ [📚 Docs](../../README.md) › [Guides](../README.md) › [Developer](README.md) › BDD & Trace System
2
+
3
+ # BDD & Trace System
4
+
5
+ - [Tại sao BDD quan trọng với Dev](#tại-sao-bdd-quan-trọng-với-dev)
6
+ - [Hiểu Trace System](#hiểu-trace-system)
7
+
8
+ ## Tại Sao BDD Quan Trọng Với Dev
9
+
10
+ ### BDD không phải "viết test thêm"
11
+
12
+ BDD là **spec thực thi được** — nó định nghĩa CHÍNH XÁC hệ thống phải làm gì trước khi viết một dòng code.
13
+ ```
14
+ PRD (business language) → BDD (technical spec) → Code (implementation)
15
+ "Sai password 5 lần Given 5 failed logins if failCount >= 5:
16
+ → khoá 30 phút" Then account locked lockAccount(30min)
17
+ And locked_until = now+30m
18
+ ```
19
+
20
+ ### BDD định hướng kiến trúc code
21
+
22
+ BDD scenario là unit of work — mỗi scenario ánh xạ thành một test case, một function, một API endpoint. Viết BDD trước buộc dev phải nghĩ về interface trước implementation.
23
+ ```gherkin
24
+ # BDD này buộc dev phải tạo:
25
+ # - POST /auth/login endpoint
26
+ # - lockAccount(duration) service method
27
+ # - AccountLocked exception/response
28
+
29
+ Scenario: Lock account after 5 failed attempts
30
+ Given user "alice@example.com" exists
31
+ When user attempts login with wrong password 5 times
32
+ Then account is locked for 30 minutes
33
+ And login returns 423 Locked with "retry_after" header
34
+ ```
35
+
36
+ ### BDD là tài liệu sống
37
+
38
+ Khi BDD pass → code đang hoạt động đúng spec. Khi BDD fail → code lệch khỏi yêu cầu. Không cần đọc PRD để biết feature có đang hoạt động không — chạy BDD là biết ngay.
39
+
40
+ ### BDD đến từ spec repo — Dev đọc, không tự gen
41
+
42
+ BDD được PO generate trong spec repo, nằm tại `specs/bdd/{domain}/`:
43
+
44
+ | Subfolder | Platform | Dev team đọc |
45
+ |---|---|---|
46
+ | `web/` | FE/Web (clicks, sees, navigates) | FE/Web dev |
47
+ | `app/` | Mobile (taps, sees screen, navigates) | App dev |
48
+ | `system/` | System/BE (request, response, business rules) | BE dev |
49
+
50
+ Cả 3 subfolder đều trace về **cùng 1 PRD**. BE không cần đọc BDD của FE và ngược lại.
51
+
52
+ ## Hiểu Trace System
53
+
54
+ Framework dùng metadata `@trace.*` để liên kết PRD → BDD → Code. (Chi tiết khái niệm: [Concepts › Traceability](../../03-concepts/traceability.md).)
55
+
56
+ ### Các trace fields quan trọng
57
+
58
+ | Field | Vị trí | Ý nghĩa |
59
+ |---|---|---|
60
+ | `@trace.domain` | PRD frontmatter | Domain của feature (auth, payment, ...) — dùng để route vào đúng service submodule |
61
+ | `@trace.module` | BDD / Tech Doc header | Module trong codebase sẽ implement |
62
+ | `@trace.prd` | BDD / Tech Doc header | Link về PRD gốc |
63
+ | `@trace.bdd` | Code comment / test | Link về BDD scenario |
64
+ | `@trace.status` | PRD frontmatter | `draft` / `approved` — chỉ code khi `approved` |
65
+ | `dev_selftest` | Trace TSV | `pass` / `fail` / `not_run` — kết quả dev self-check, set bởi `/dev-run-test`. Surfaced trong Living Docs để QC biết dev đã chạy self-check — **KHÔNG phải coverage chính thức** |
66
+ | `dev_selftest_at` | Trace TSV | Timestamp lần chạy `/dev-run-test` gần nhất |
67
+ | `qc_status` | Trace TSV | `pass` / `fail` / `skip` / `not_run` — kết quả **QC chính thức**, set bởi `/qc-run-test` (do QC chạy, KHÔNG phải dev). Orthogonal với `dev_selftest` và với coverage `status` |
68
+ | `qc_run_at` | Trace TSV | Timestamp lần chạy `/qc-run-test` gần nhất |
69
+
70
+ ### Ví dụ trace chain hoàn chỉnh
71
+
72
+ ```
73
+ specs/prd/auth/FT-001-login.md ← @trace.domain: auth, @trace.status: approved
74
+
75
+ specs/bdd/auth/FT-001-login.feature ← @trace.prd: FT-001, @trace.module: AuthService
76
+
77
+ src/auth/auth.service.ts ← // @trace.bdd: FT-001-UC1-SC1
78
+ ```
79
+
80
+ ### Khi nào chạy /validate-traces?
81
+
82
+ - Sau khi refactor đổi tên file/function
83
+ - Sau khi PRD được PO cập nhật (version mới)
84
+ - Trước khi tạo PR lớn
85
+ - Khi CI báo trace validation fail
86
+ - **Sau mỗi codegen session trong umbrella mode** — để sync Living Docs panel
87
+
88
+ ```
89
+ /validate-traces
90
+ → Sẽ report: broken links, orphan BDD (không có PRD), dead code traces
91
+ ```
92
+
93
+ **Lưu ý khi dùng umbrella (submodule):**
94
+ ```
95
+ Vấn đề: Living Docs panel mở ở umbrella root (hoặc một service submodule đơn lẻ) → nếu không có mirror local → TRỐNG.
96
+ TSV authoritative nằm committed trong từng service submodule: user-service/.trace/, order-service/.trace/
97
+
98
+ Giải pháp: /validate-traces (hoặc /sync) regenerate canonical trace-report.json + TSV mirror
99
+ trong SPEC MODULE tại {spec_source}/.living-docs/ (gitignored), đồng thời ghi
100
+ mirror local tại ./.trace của workspace hiện tại để panel không trống khi dev mở
101
+ một service submodule đơn lẻ.
102
+
103
+ Lệnh chạy sau mỗi session:
104
+ /validate-traces
105
+ → Reads .trace/*.tsv authoritative (committed) trong từng service: user-service/.trace/, order-service/.trace/, ...
106
+ → Writes canonical trace-report.json + TSV mirror → {spec_source}/.living-docs/ (gitignored, regenerated bởi /sync hoặc /validate-traces)
107
+ → Writes panel mirror → ./.trace của workspace hiện tại (non-empty khi mở single service)
108
+ → Living Docs panel cập nhật ngay
109
+ ```
110
+
111
+ > **Authoritative vs mirror:** per-service `.trace/*.tsv` vẫn được **commit** trong từng service (nguồn sự thật). `{spec_source}/.living-docs/` và `./.trace` chỉ là mirror gitignored, regenerated bởi `/sync` hoặc `/validate-traces`.
112
+
113
+ Thêm `.living-docs/` (spec module) và umbrella/workspace `.trace/` mirror vào `.gitignore`:
114
+ ```
115
+ # .gitignore — spec module
116
+ .living-docs/
117
+ # .gitignore — workspace/umbrella root (mirror, không commit)
118
+ .trace/
119
+ ```
120
+
121
+ ---
122
+
123
+ ← [Commands](commands.md) · Tiếp theo: [Workflow](workflow.md)