@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
@@ -0,0 +1,124 @@
1
+ [📚 Docs](../../README.md) › [Guides](../README.md) › [Tester](README.md) › Spec Manifest & Setup
2
+
3
+ # Spec Manifest & Setup
4
+
5
+ ## Spec-Manifest Là Gì Và Tại Sao Cần
6
+
7
+ Trong umbrella repo, spec files nằm rải rác ở nhiều submodule:
8
+
9
+ ```
10
+ free-trial-spec/
11
+ ├── specs/prd/auth/FT-001-login.md ← PRD (spec submodule)
12
+ ├── specs/product-definition/auth/... ← PDD
13
+ ├── free-trial-be/specs/bdd/... ← BDD của BE
14
+ ├── free-trial-web/specs/bdd/... ← BDD của Web
15
+ └── free-trial-app/specs/bdd/... ← BDD của App
16
+ ```
17
+
18
+ Tester's agent không biết layout này → cần một **index file** để tra cứu.
19
+
20
+ `spec-manifest.yaml` là file được gen tự động, ánh xạ TICKET-ID → tất cả file liên quan:
21
+
22
+ ```yaml
23
+ features:
24
+ FT-001:
25
+ domain: auth
26
+ status: approved
27
+ prd: "specs/prd/auth/FT-001-login.md"
28
+ pdd: "specs/product-definition/auth/FT-001-def.md"
29
+ tech_docs:
30
+ be: "free-trial-specs/specs/tech-docs/auth/FT-001-UC1-auth-api.md"
31
+ web: "free-trial-specs/specs/tech-docs/auth/FT-001-UC1-login-web.md"
32
+ bdd:
33
+ be: "free-trial-be/specs/bdd/auth/system/FT-001-UC1-login-system.feature"
34
+ web: "free-trial-web/specs/bdd/auth/web/FT-001-UC1-login-web.feature"
35
+ ```
36
+
37
+ **Quan trọng:**
38
+ - File này **không commit vào git** (gitignored) — gen local mỗi khi cần
39
+ - Luôn `git pull` trước khi gen để có submodule mới nhất
40
+ - Chỉ test các feature có `status: approved` — draft PRD chưa được approve
41
+ - Nếu nhiều người gen cùng lúc → kết quả **giống nhau** (deterministic) — không conflict
42
+ - Khi PO cập nhật PRD hoặc BDD → re-run `/generate-spec-manifest` để manifest phản ánh nội dung mới
43
+
44
+ ## Setup Tester Agent
45
+
46
+ ### Lần đầu tiên
47
+
48
+ ```bash
49
+ # 1. Clone umbrella repo (nếu chưa có)
50
+ git clone {umbrella-repo-url} free-trial-spec
51
+ cd free-trial-spec
52
+
53
+ # 2. Init tất cả submodules
54
+ git submodule update --init --recursive
55
+
56
+ # 3. Mở Claude Code tại umbrella root
57
+ # QUAN TRỌNG: mở tại free-trial-spec/, không phải free-trial-tests/
58
+ ```
59
+
60
+ ### Trước mỗi test sprint
61
+
62
+ ```bash
63
+ # Cập nhật tất cả submodules về commit mới nhất
64
+ git pull
65
+ git submodule update --remote --recursive
66
+
67
+ # Gen manifest
68
+ /generate-spec-manifest
69
+ # → viết spec-manifest.yaml tại free-trial-spec/ root
70
+ ```
71
+
72
+ ### Cấu hình tester agent đọc manifest
73
+
74
+ Trong tester's agent config (hoặc system prompt), thêm:
75
+
76
+ ```
77
+ Trước khi test bất kỳ feature nào:
78
+ 1. Đọc spec-manifest.yaml tại project root
79
+ 2. Lookup TICKET-ID → lấy paths của prd, bdd, tech_docs
80
+ 3. Chỉ test features có status: approved
81
+ 4. Đọc PRD trước để hiểu business context
82
+ 5. Đọc BDD để biết scenarios cần cover
83
+ ```
84
+
85
+ ## Living Docs Panel (umbrella mode)
86
+
87
+ Khi làm việc với umbrella repo, VS Code Living Docs panel cần được đồng bộ trước khi xem (chạy `/sync` hoặc `/validate-traces`).
88
+
89
+ **Report canonical (Living Docs):** `{spec_source}/.living-docs/trace-report.json` + bản mirror TSV — nằm trong **spec module** (gitignored, regenerate mỗi lần `/sync` hoặc `/validate-traces`).
90
+
91
+ **Panel mirror:** `./.trace` của workspace hiện tại — giữ panel **không bị trống** kể cả khi mở Claude Code bên trong một service submodule đơn lẻ.
92
+
93
+ ```bash
94
+ # Chạy sau mỗi codegen session — hoặc khi cần refresh trạng thái coverage
95
+ /sync # hoặc /validate-traces
96
+
97
+ # → Đọc TSVs từ: user-service/.trace/, order-service/.trace/, ...
98
+ # → Ghi canonical: {spec_source}/.living-docs/trace-report.json (+ TSV mirror)
99
+ # → Ghi panel mirror: ./.trace (workspace hiện tại — panel luôn có data)
100
+ # → Panel cập nhật ngay sau khi lệnh hoàn tất
101
+ ```
102
+
103
+ Panel hiển thị trạng thái cross-service:
104
+
105
+ | Cột | Ý nghĩa |
106
+ |-----|---------|
107
+ | PRDs | Số PRD đã approve / tổng |
108
+ | UCs | Số Use Cases đã implement |
109
+ | Code Cov. | % scenarios có code |
110
+ | Test Cov. | % scenarios có test |
111
+ | DRIFT | Spec thay đổi sau khi gen code |
112
+ | GAP | Code có nhưng chưa có test |
113
+ | dev_selftest | Dev đã chạy self-check: `pass` / `fail` / `not_run` |
114
+ | qc_status | Kết quả QC chính thức: `pass` / `fail` / `skip` / `not_run` |
115
+
116
+ > **`dev_selftest`:** tín hiệu cho QC thấy dev đã tự chạy self-check. **Không phải** coverage chính thức — đó là `qc_status`.
117
+ >
118
+ > **`qc_status`:** kết quả pipeline QC chính thức (`/qc-run-test`). Dashboard hiển thị hai cột cạnh nhau để phân biệt rõ hai luồng.
119
+
120
+ > **Prerequisite:** Mỗi service submodule cần `.agent/project-context.yaml` với `paths.trace_dir`. Nếu thiếu → panel trống → báo Dev team.
121
+
122
+ ---
123
+
124
+ ← [Tester Guide](README.md) · Tiếp theo: [Workflow](workflow.md)
@@ -0,0 +1,31 @@
1
+ [📚 Docs](../../README.md) › [Guides](../README.md) › [Tester](README.md) › Checklist Test Pass
2
+
3
+ # Checklist Trước Khi Báo "test pass"
4
+
5
+ **Spec & coverage:**
6
+ - [ ] Tất cả BDD scenarios đã được cover (happy path + edge + error)
7
+ - [ ] Mọi AC trong PRD đã được verify
8
+ - [ ] Manifest version khớp với PRD version đang deploy
9
+ - [ ] Không có scenarios bị skip mà không có lý do ghi chú
10
+
11
+ **Môi trường:**
12
+ - [ ] Test đã chạy trên đúng môi trường (staging, không phải local dev)
13
+ - [ ] Cross-service flows đã được verify (nếu feature span nhiều service)
14
+
15
+ **TSV & Living Docs:**
16
+ - [ ] `/qc-run-test` đã chạy → `qc_status` đã ghi vào `{service}/.trace/{UC-ID}.tsv`
17
+ - [ ] TSV đã được commit vào service submodule + umbrella pointer đã update + push
18
+ - [ ] `/validate-traces` (hoặc `/sync`) đã chạy → Living Docs panel hiển thị `qc_status: pass`
19
+ - [ ] Không còn scenario nào `qc_status: not_run` trong UC đang test
20
+ - [ ] Nếu có `qc_status: fail` → đã `/report-bug` kèm path evidence (`reports/<feature>/report.html`)
21
+
22
+ ## Xem Thêm
23
+
24
+ - [Guide › QC Automation](../qc-automation.md) — pipeline `/qc-*` chi tiết, `qc_status`, stack `qc-playwright`
25
+ - [Operations › Bug Flow](../../04-operations/bug-flow.md) — flow phối hợp Tester ↔ Dev ↔ PO
26
+ - [Concepts › Traceability](../../03-concepts/traceability.md) — trace TSV, dev_selftest vs qc_status
27
+ - [Reference › Commands](../../05-reference/commands.md) — danh mục đầy đủ mọi command
28
+
29
+ ---
30
+
31
+ ← [Báo cáo bug](bug-reporting.md)
@@ -0,0 +1,80 @@
1
+ [📚 Docs](../../README.md) › [Guides](../README.md) › [Tester](README.md) › Workflow
2
+
3
+ # Workflow Cơ Bản
4
+
5
+ ```
6
+ Nhận task: "Test FT-042 — Checkout flow"
7
+
8
+
9
+ git pull && git submodule update --remote --recursive
10
+
11
+
12
+ /generate-spec-manifest
13
+ → spec-manifest.yaml được refresh
14
+
15
+
16
+ Lookup FT-042 trong spec-manifest.yaml
17
+ → status: approved? ✅ (nếu draft → dừng, báo PO)
18
+ → ghi lại paths (tất cả đều nằm trong submodule):
19
+ prd: {spec_source}/specs/prd/{domain}/FT-042-*.md
20
+ bdd.be: {service-be}/specs/bdd/{domain}/FT-042-*.feature
21
+ bdd.web: {service-web}/specs/bdd/{domain}/FT-042-*.feature
22
+ tech_docs.be: {spec_source}/specs/tech-docs/{domain}/FT-042-*.md
23
+
24
+
25
+ Đọc PRD tại path manifest.prd
26
+ → file nằm trong SPEC submodule (shared — PO viết)
27
+ → hiểu AC, UC, BR — đây là "ground truth"
28
+
29
+
30
+ Đọc BDD tại path manifest.bdd.be / bdd.web
31
+ → file nằm trong SERVICE submodule (be/web/app — PO gen từ PRD)
32
+ → mỗi Scenario = 1 test case cần cover
33
+ → BE có BDD riêng (system/), Web có BDD riêng (web/), App có BDD riêng (app/)
34
+
35
+
36
+ Đọc Tech Docs tại path manifest.tech_docs.be / tech_docs.web
37
+ → file nằm trong SPEC submodule (shared — Dev gen, SA sign-off)
38
+ → BE: API endpoints, request/response schema, error codes
39
+ → Web: screen flow, component states
40
+
41
+
42
+ Chạy QC automation pipeline (6 bước — ghi kết quả chính thức vào TSV)
43
+
44
+ ├─ /qc-analyze {UC-ID} → 2 file: REQUIREMENT_ANALYSIS.md + DOC_GAPS.md
45
+ ├─ /qc-plan {UC-ID} → TEST_PLAN.md (risk + plan + questions-for-dev)
46
+ ├─ /qc-design-test {UC-ID} → test-cases/*.Test.md
47
+ │ ⌙ artifact phân tích/thiết kế → {qc_dir}/{UC-ID}/ (mặc định docs/, VISIBLE)
48
+ ├─ /qc-review {UC-ID} → review test design trước khi chạy
49
+ ├─ /qc-run-test {UC-ID} → sinh + chạy pytest-playwright
50
+ │ → ghi qc_status (pass/fail/skip) per scenario
51
+ │ → vào {service}/.trace/{UC-ID}.tsv ← AUTHORITATIVE
52
+ └─ /qc-report {UC-ID} → report pytest-html + Playwright trace evidence
53
+ → reports/<feature>/report.html ← LOCAL, gitignored
54
+
55
+
56
+ Commit TSV vào service submodule + update umbrella pointer
57
+ cd {service}
58
+ git add .trace/{UC-ID}.tsv
59
+ git commit -m "qc: record qc_status for {UC-ID} — pass/fail"
60
+ git push
61
+ cd .. ← umbrella root
62
+ git add {service}
63
+ git commit -m "chore: update {service} submodule pointer — {UC-ID} qc_status"
64
+ git push
65
+
66
+
67
+ /validate-traces (hoặc /sync)
68
+ → tổng hợp TSVs từ tất cả services → Living Docs cập nhật cột qc_status
69
+
70
+
71
+ Kết quả:
72
+ qc_status: pass → done, Living Docs phản ánh coverage chính thức
73
+ qc_status: fail → /report-bug với BDD scenario + AC bị vi phạm
74
+ đính kèm path evidence: reports/<feature>/report.html
75
+ (evidence local — share file hoặc upload riêng nếu cần)
76
+ ```
77
+
78
+ ---
79
+
80
+ ← [Spec Manifest & Setup](spec-manifest.md) · Tiếp theo: [Đọc Spec Chain](reading-specs.md)
@@ -0,0 +1,19 @@
1
+ [📚 Docs](../README.md) › Concepts
2
+
3
+ # Concepts
4
+
5
+ Hiểu **cách framework được xây dựng và vận hành** — kiến trúc nhiều lớp, pipeline các phase, và hệ thống traceability. Đọc section này khi bạn muốn biết *vì sao* mọi thứ hoạt động như vậy, không chỉ *cách dùng* lệnh.
6
+
7
+ ## Mục lục (this section)
8
+
9
+ - [architecture.md](architecture.md) — 6 lớp (Protection → Output), module plug-in system, build pipeline (`*.tmpl` → `*.md` → `core/`), directory map, sub-agent orchestration, hook data-protection.
10
+ - [pipeline.md](pipeline.md) — các phase Discovery → PRD → Design-Spec → BDD → Tech-Docs → Code → Dev self-check → QC automation → Tester feedback; review gates; và step-architecture model (gate / context-loader / spawn-agent / report-footer) đằng sau mỗi command.
11
+ - [traceability.md](traceability.md) — `@trace.*` tags, trace TSV, hai tín hiệu `dev_selftest` vs `qc_status`, Living Docs (canonical trong spec-module + panel mirror), và `/validate-traces`.
12
+
13
+ ## Đọc gì trước?
14
+
15
+ 1. Muốn cái nhìn tổng thể? → [architecture.md](architecture.md) — file "đọc trước khi đọc bất kỳ file chi tiết nào".
16
+ 2. Muốn hiểu luồng làm việc end-to-end? → [pipeline.md](pipeline.md).
17
+ 3. Muốn hiểu coverage / drift / Living Docs? → [traceability.md](traceability.md).
18
+
19
+ > Tra cứu chi tiết schema và module thì sang [05 · Reference](../05-reference/) — [trace-schema.md](../05-reference/trace-schema.md) và [modules.md](../05-reference/modules.md).
@@ -0,0 +1,245 @@
1
+ [📚 Docs](../README.md) › [Concepts](README.md) › Architecture
2
+
3
+ # Architecture
4
+
5
+ > **Nguyên tắc**: Đọc file này để hiểu toàn bộ framework trước khi đọc bất kỳ file chi tiết nào.
6
+
7
+ Cách framework được xây dựng: 6 lớp runtime, build pipeline `*.tmpl → *.md → core/`, module plug-in system, hook data-protection, và sub-agent orchestration.
8
+
9
+ ## Mục lục
10
+
11
+ - [Layer diagram (L0 → L5)](#layer-diagram-l0--l5)
12
+ - [Data flow — một command chạy như thế nào](#data-flow--một-command-chạy-như-thế-nào)
13
+ - [Build system](#build-system)
14
+ - [Module plug-in system](#module-plug-in-system)
15
+ - [Hook system — data protection](#hook-system--data-protection)
16
+ - [Sub-agent orchestration](#sub-agent-orchestration)
17
+ - [Directory map](#directory-map)
18
+ - [Maintenance guide](#maintenance-guide)
19
+
20
+ ---
21
+
22
+ ## Layer diagram (L0 → L5)
23
+
24
+ Mỗi command chạy qua 6 lớp, từ bảo vệ dữ liệu đến sinh artifact:
25
+
26
+ ```
27
+ LAYER 0 — PROTECTION (luôn chạy trước)
28
+ hooks/data-guard.js → PreToolUse hook: chặn đọc file nhạy cảm
29
+ rules/data-protection.md → quy tắc declarative cho AI agent
30
+ │ safe ↓ blocked → ✋ STOP
31
+ LAYER 1 — ENTRY POINT (user trigger)
32
+ commands/*.tmpl (slash commands: /generate-bdd, /generate-code, …)
33
+ skills/*/SKILL.tmpl (auto-trigger theo description match)
34
+ │ cả hai build bởi bin/build.js
35
+ LAYER 2 — SHARED STEPS (DRY, injected)
36
+ steps/gate.md → resolve target file + CHECKPOINT
37
+ steps/context-loader.md → load project config + rules
38
+ steps/report-footer.md → standard output format
39
+ Injected ở build time qua {{include:steps/X.md}} (*.tmpl → *.md, gitignored)
40
+ │ context loaded
41
+ LAYER 3 — PROJECT CONTEXT (đọc từ consumer project)
42
+ .agent/project-context.yaml → paths, tech_stack, domains
43
+ CLAUDE.md (root) → umbrella-wide shared rules (base layer)
44
+ {service_root}/CLAUDE.md → service architecture + coding standards (overlay, wins)
45
+ rules/data-protection.md → AI không được đọc gì
46
+ .agent/modules/{stack}/ → stack rules (plug-in, optional)
47
+ │ context-aware
48
+ LAYER 4 — EXECUTION (command logic)
49
+ Discovery /define-product
50
+ PRD / BDD /generate-prd · /refine-prd · /generate-bdd · /generate-tech-docs
51
+ Code /generate-code · /review-code
52
+ Dev check /dev-gen-test · /dev-run-test · /dev-smoke-test → set dev_selftest
53
+ QC suite /qc-analyze → /qc-plan → /qc-design-test → /qc-review →
54
+ /qc-run-test → /qc-report → set qc_status
55
+ Trace/Debug /validate-traces · /fix-bug · /debug
56
+
57
+ LAYER 5 — OUTPUT (artifacts in consumer proj)
58
+ Spec module (cross-team, via {spec_source}):
59
+ specs/product-definition/ · specs/prd/ · specs/bdd/
60
+ specs/tech-docs/ (API contract) · .living-docs/ (gitignored)
61
+ Service submodule (per-service):
62
+ src/ · .trace/*.tsv (authoritative, committed) · .agent/review/
63
+ QC automation outputs:
64
+ QC test cases / scripts (Python pytest-playwright, Page Object)
65
+ → QC analysis / test-cases ghi vào {qc_dir}/{UC-ID}/ (mặc định docs/,
66
+ visible — KHÔNG nằm trong .agent/)
67
+ → guides per-layer ở skills/qc/<stage>/ · qc_status trong .trace/*.tsv
68
+ ```
69
+
70
+ > **Dev self-check vs QC chính thức:** `/dev-*` set `dev_selftest` (smoke, dev tự kiểm code của mình); 6 lệnh `/qc-*` là QC automation pipeline CHÍNH THỨC (port từ agent của team QC; QC repo nay chỉ còn reference) → set `qc_status`. Hai tín hiệu **orthogonal**, cả hai surface trong Living Docs. Chi tiết: [traceability.md](traceability.md).
71
+
72
+ ---
73
+
74
+ ## Data flow — một command chạy như thế nào
75
+
76
+ Ví dụ `/generate-bdd specs/prd/payment/PAY-01.md`:
77
+
78
+ ```
79
+ User types: /generate-bdd specs/prd/payment/PAY-01.md
80
+
81
+ [L0] data-guard.js check tool calls real-time → đọc .env/*.key → BLOCK + warn
82
+
83
+ [L1] commands/generate-bdd.md (assembled từ .tmpl + injected steps) được Claude đọc
84
+
85
+ [L2] gate.md → resolve file path từ $ARGUMENTS
86
+ context-loader.md → đọc project-context.yaml, CLAUDE.md,
87
+ rules/data-protection.md, modules/{stack}/stack-profile.yaml
88
+
89
+ [L3] Claude biết: tech_stack, domains, architecture rules, sensitive files, stack patterns
90
+
91
+ [L4] generate-bdd logic: đọc PRD → extract UC/BR/AC → apply BDD rules R1–R10
92
+
93
+ [L5] Output: specs/bdd/payment/PAY-01-UC1.feature
94
+ ```
95
+
96
+ Chi tiết về step-architecture (gate / context-loader / report-footer) và sub-agent model: xem [pipeline.md](pipeline.md#command-internals--step-architecture).
97
+
98
+ ---
99
+
100
+ ## Build system
101
+
102
+ `*.tmpl` (committed) được assemble thành `*.md` (gitignored) bởi `bin/build.js`:
103
+
104
+ ```
105
+ Source (committed) Build output (gitignored)
106
+ commands/*.tmpl ──┐
107
+ skills/**/SKILL.tmpl ──┤ node bin/build.js → commands/*.md · skills/**/SKILL.md
108
+ steps/*.md (shared) ──┘
109
+
110
+ Trigger:
111
+ npm run build ← manual
112
+ prepublishOnly hook ← auto trước npm publish
113
+ bin/index.js install ← auto khi user chạy npx
114
+ ```
115
+
116
+ > Build output cũng bao gồm `core/` — bản distributable được copy vào `.agent/` của consumer khi `--init`.
117
+
118
+ ---
119
+
120
+ ## Module plug-in system
121
+
122
+ Stack module là plug-in tùy chọn: cài qua `--module`, đọc ở runtime bởi `context-loader.md`.
123
+
124
+ ```
125
+ Available modules (modules/):
126
+ java-spring, angular, react, nextjs, vue, nuxt, dotnet, golang,
127
+ php-laravel, flutter, react-native, ios-swiftui, android-compose,
128
+ context-engineering, qc-playwright
129
+
130
+ Usage:
131
+ npx @anhth2/spec-driven-dev-plugin --module java-spring
132
+ └─ copies modules/java-spring/ → consumer/.agent/modules/java-spring/
133
+
134
+ Runtime, context-loader.md đọc:
135
+ .agent/modules/{tech_stack.module}/stack-profile.yaml
136
+ .agent/modules/{tech_stack.module}/architecture-snippets/
137
+ ```
138
+
139
+ > **`qc-playwright`** là stack module cho native QC pipeline (`/qc-run-test`, `/qc-report`) — Python + pytest-playwright + Page Object — **ĐỘC LẬP** với dev implementation module (java-spring / react / flutter / …). Per-layer guides ở `skills/qc/<stage>/`. Danh sách module đầy đủ: [../05-reference/modules.md](../05-reference/modules.md).
140
+
141
+ ---
142
+
143
+ ## Hook system — data protection
144
+
145
+ ```
146
+ Consumer project setup:
147
+ .claude/settings.json ← registers hook (template)
148
+ hooks/data-guard.js ← copied khi install
149
+
150
+ Runtime — mỗi tool use (Read, Write, Edit, Bash):
151
+ data-guard.js checks:
152
+ .env* · *.key · *.pem · *secret* · *password* · *credential*
153
+ application-prod.* · appsettings.Production.*
154
+
155
+ safe → allow blocked → exit(2) + warn user
156
+ ```
157
+
158
+ ---
159
+
160
+ ## Sub-agent orchestration
161
+
162
+ Khi một command quá nặng cho single context window, orchestrator spawn các sub-agent độc lập (mỗi agent có context window riêng):
163
+
164
+ ```
165
+ Main session (orchestrator — lightweight, chỉ coordinate)
166
+ ├─ spawn spec-agent ──→ /refine-prd analysis → returns findings.yaml
167
+ ├─ spawn codegen-agent ──→ /generate-code UC1 → returns src/ changes
168
+ └─ spawn test-agent ──→ /dev-gen-test UC1 → returns self-check test files
169
+ ```
170
+
171
+ **Lợi ích:** main session không bị bloat bởi large file reads · mỗi agent focus 1 task, ít hallucination · parallel cho nhiều UC.
172
+
173
+ Pattern này được hiện thực hóa qua `steps/spawn-agent.md` và tự kích hoạt cho `/generate-bdd`, `/generate-code`, `/dev-gen-test` khi PRD vượt ngưỡng phức tạp (> 3 UC hoặc > 300 dòng). Chi tiết flow + tiết kiệm context: [pipeline.md](pipeline.md#spawn-agentmd--sub-agent-orchestration).
174
+
175
+ ---
176
+
177
+ ## Directory map
178
+
179
+ ```
180
+ spec-driven-dev/
181
+ ├── docs/ ← Toàn bộ tài liệu (bắt đầu ở docs/README.md) ◀◀◀
182
+ │ ├── 01-getting-started/
183
+ │ ├── 02-guides/
184
+ │ ├── 03-concepts/ ← file này (architecture.md)
185
+ │ ├── 04-operations/
186
+ │ └── 05-reference/
187
+ ├── bin/
188
+ │ ├── build.js ← assembles *.tmpl → *.md
189
+ │ └── index.js ← npm installer + hook installer
190
+ ├── commands/
191
+ │ └── *.tmpl ← slash commands
192
+ ├── hooks/
193
+ │ ├── data-guard.js ← PreToolUse sensitive file protection
194
+ │ └── settings.json ← hook registration template
195
+ ├── modules/
196
+ │ └── {stack}/ ← java-spring, react, …, qc-playwright
197
+ │ ├── module.yaml
198
+ │ ├── stack-profile.yaml
199
+ │ └── architecture-snippets/
200
+ ├── rules/
201
+ │ ├── data-protection.md ← what AI must NEVER read/write
202
+ │ └── workflow.md ← general AI behavior rules
203
+ ├── skills/
204
+ │ ├── {name}/SKILL.tmpl ← Claude plugin skills
205
+ │ └── qc/<stage>/ ← per-layer QC automation guides
206
+ ├── steps/
207
+ │ ├── gate.md ← shared: file resolve + checkpoint
208
+ │ ├── context-loader.md ← shared: load all project context
209
+ │ ├── spawn-agent.md ← shared: sub-agent orchestration
210
+ │ ├── capture-lesson.md ← shared: record a guardrail (/learn etc.)
211
+ │ └── report-footer.md ← shared: standard output format
212
+ └── templates/
213
+ ├── project-context.yaml ← consumer project config template
214
+ ├── architecture.template.md
215
+ └── platform-guide.template.md
216
+ ```
217
+
218
+ > **Build output (gitignored):** `commands/*.md`, `skills/**/SKILL.md`, và `core/`. Consumer-side tester artifacts nằm trong shared spec repo tại `feedback/bug-reports/` và `feedback/bdd-proposals/`.
219
+
220
+ > **Umbrella mode — API contract (tech-docs) là cross-team artifact:** khi `setup.spec_source` được set, tech-docs LUÔN route về `{spec_source}/specs/tech-docs/` (giống PRD / design-spec / domain-knowledge), KHÔNG per-service — để FE/App đọc contract qua spec submodule ở `/generate-code --phase=integration`. Chỉ khi không có `spec_source` thì tech-docs mới nằm per-service.
221
+
222
+ > **Living Docs / trace data location:** `.trace/*.tsv` của mỗi service là **authoritative** và commit trong chính service submodule. Canonical report (`trace-report.json` + TSV mirror namespaced) sinh vào spec module tại `{spec_source}/.living-docs/` (gitignored), cộng một panel mirror cục bộ tại `./.trace`. Chi tiết: [traceability.md](traceability.md#living-docs--canonical-trong-spec-module--panel-mirror).
223
+
224
+ ---
225
+
226
+ ## Maintenance guide
227
+
228
+ | Muốn thay đổi gì | Sửa file nào |
229
+ |------------------|-------------|
230
+ | Logic của 1 command cụ thể | `commands/{name}.tmpl` |
231
+ | Logic của 1 skill cụ thể | `skills/{name}/SKILL.tmpl` |
232
+ | Gate / checkpoint pattern | `steps/gate.md` |
233
+ | Context loading | `steps/context-loader.md` |
234
+ | Report format | `steps/report-footer.md` |
235
+ | Sensitive file patterns | `hooks/data-guard.js` + `rules/data-protection.md` |
236
+ | Stack-specific rules | `modules/{stack}/stack-profile.yaml` |
237
+ | QC automation rules (per-layer) | `skills/qc/<stage>/` + `modules/qc-playwright/` |
238
+ | Project setup template | `templates/project-context.yaml` |
239
+ | Build system | `bin/build.js` |
240
+ | Installer | `bin/index.js` |
241
+
242
+ Sau khi sửa bất kỳ `.tmpl` hoặc `steps/*.md`:
243
+ ```bash
244
+ npm run build # regenerate tất cả *.md
245
+ ```