@anhth2/spec-driven-dev-plugin 0.11.0 → 0.14.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 (173) hide show
  1. package/commands/debug.md +47 -7
  2. package/commands/define-product.md +47 -7
  3. package/commands/dev-gen-test.md +65 -17
  4. package/commands/dev-run-test.md +66 -18
  5. package/commands/dev-run-test.tmpl +1 -1
  6. package/commands/dev-smoke-test.md +47 -7
  7. package/commands/fix-bug.md +83 -13
  8. package/commands/fix-bug.tmpl +36 -6
  9. package/commands/generate-bdd.md +74 -21
  10. package/commands/generate-bdd.tmpl +9 -4
  11. package/commands/generate-code.md +118 -35
  12. package/commands/generate-code.tmpl +53 -18
  13. package/commands/generate-design-spec.md +47 -7
  14. package/commands/generate-prd.md +47 -7
  15. package/commands/generate-spec-manifest.md +47 -7
  16. package/commands/generate-tech-docs.md +234 -20
  17. package/commands/generate-tech-docs.tmpl +187 -13
  18. package/commands/learn.md +47 -7
  19. package/commands/map-testids.md +564 -0
  20. package/commands/map-testids.tmpl +81 -0
  21. package/commands/propose-scenario.md +78 -18
  22. package/commands/propose-scenario.tmpl +31 -11
  23. package/commands/qc-analyze.md +67 -12
  24. package/commands/qc-analyze.tmpl +20 -5
  25. package/commands/qc-design-test.md +51 -10
  26. package/commands/qc-design-test.tmpl +4 -3
  27. package/commands/qc-plan.md +50 -10
  28. package/commands/qc-plan.tmpl +3 -3
  29. package/commands/qc-report.md +60 -8
  30. package/commands/qc-report.tmpl +13 -1
  31. package/commands/qc-review.md +49 -9
  32. package/commands/qc-review.tmpl +2 -2
  33. package/commands/qc-run-test.md +75 -20
  34. package/commands/qc-run-test.tmpl +10 -3
  35. package/commands/refine-prd.md +47 -7
  36. package/commands/report-bug.md +63 -9
  37. package/commands/report-bug.tmpl +16 -2
  38. package/commands/review-code.md +47 -7
  39. package/commands/review-context.md +47 -7
  40. package/commands/review-tech-docs.md +50 -9
  41. package/commands/review-tech-docs.tmpl +3 -2
  42. package/commands/setup-ai-first.md +37 -4
  43. package/commands/setup-ai-first.tmpl +2 -2
  44. package/commands/sync.md +47 -11
  45. package/commands/sync.tmpl +12 -9
  46. package/commands/update-framework.md +35 -2
  47. package/commands/validate-traces.md +98 -40
  48. package/commands/validate-traces.tmpl +51 -33
  49. package/core/FRAMEWORK_VERSION +1 -1
  50. package/core/commands/debug.md +47 -7
  51. package/core/commands/define-product.md +47 -7
  52. package/core/commands/dev-gen-test.md +65 -17
  53. package/core/commands/dev-run-test.md +66 -18
  54. package/core/commands/dev-smoke-test.md +47 -7
  55. package/core/commands/fix-bug.md +83 -13
  56. package/core/commands/generate-bdd.md +74 -21
  57. package/core/commands/generate-code.md +118 -35
  58. package/core/commands/generate-design-spec.md +47 -7
  59. package/core/commands/generate-prd.md +47 -7
  60. package/core/commands/generate-spec-manifest.md +47 -7
  61. package/core/commands/generate-tech-docs.md +234 -20
  62. package/core/commands/learn.md +47 -7
  63. package/core/commands/map-testids.md +564 -0
  64. package/core/commands/propose-scenario.md +78 -18
  65. package/core/commands/qc-analyze.md +67 -12
  66. package/core/commands/qc-design-test.md +51 -10
  67. package/core/commands/qc-plan.md +50 -10
  68. package/core/commands/qc-report.md +60 -8
  69. package/core/commands/qc-review.md +49 -9
  70. package/core/commands/qc-run-test.md +75 -20
  71. package/core/commands/refine-prd.md +47 -7
  72. package/core/commands/report-bug.md +63 -9
  73. package/core/commands/review-code.md +47 -7
  74. package/core/commands/review-context.md +47 -7
  75. package/core/commands/review-tech-docs.md +50 -9
  76. package/core/commands/setup-ai-first.md +37 -4
  77. package/core/commands/sync.md +47 -11
  78. package/core/commands/update-framework.md +35 -2
  79. package/core/commands/validate-traces.md +98 -40
  80. package/core/modules/qc-playwright/stack-profile.yaml +4 -3
  81. package/core/skills/code/SKILL.md +82 -9
  82. package/core/skills/debug/SKILL.md +117 -11
  83. package/core/skills/design-spec/SKILL.md +47 -7
  84. package/core/skills/discovery/SKILL.md +47 -7
  85. package/core/skills/prd/SKILL.md +70 -4
  86. package/core/skills/qc/qa-analyst/acceptance-criteria.md +5 -1
  87. package/core/skills/qc/qa-analyst/business-rules.md +6 -2
  88. package/core/skills/qc/qa-analyst/data-flow.md +6 -2
  89. package/core/skills/qc/qa-analyst/spec-breakdown.md +7 -3
  90. package/core/skills/qc/qa-designer/e2e/journey.md +1 -1
  91. package/core/skills/qc/qa-designer/exploratory/charter.md +2 -2
  92. package/core/skills/qc/qa-designer/exploratory/explore-to-functional.md +1 -1
  93. package/core/skills/qc/qa-designer/functional/api.md +1 -1
  94. package/core/skills/qc/qa-designer/functional/gui-feature.md +1 -1
  95. package/core/skills/qc/qa-designer/functional/gui-screen.md +1 -1
  96. package/core/skills/qc/qa-designer/integration/api.md +1 -1
  97. package/core/skills/qc/qa-designer/integration/db.md +1 -1
  98. package/core/skills/qc/qa-designer/integration/gui.md +1 -1
  99. package/core/skills/qc/qa-designer/integration/kafka.md +1 -1
  100. package/core/skills/qc/qa-designer/non-functional.md +1 -1
  101. package/core/skills/qc/qa-planner/test-plan.md +4 -4
  102. package/core/skills/qc/qa-runner/exploratory/session.md +2 -2
  103. package/core/skills/setup-ai-first/SKILL.md +35 -2
  104. package/core/skills/spec/SKILL.md +70 -4
  105. package/core/skills/test/SKILL.md +129 -16
  106. package/core/steps/context-loader.md +12 -5
  107. package/core/steps/report-footer.md +35 -2
  108. package/core/steps/trace-mirror.md +18 -10
  109. package/core/templates/project-context.yaml +27 -6
  110. package/docs/01-getting-started/core-concepts.md +7 -7
  111. package/docs/01-getting-started/installation.md +4 -2
  112. package/docs/01-getting-started/quickstart.md +1 -1
  113. package/docs/02-guides/README.md +1 -2
  114. package/docs/02-guides/developer/README.md +1 -1
  115. package/docs/02-guides/developer/bdd-and-trace.md +10 -8
  116. package/docs/02-guides/developer/commands.md +4 -4
  117. package/docs/02-guides/developer/scenarios.md +26 -14
  118. package/docs/02-guides/developer/workflow.md +81 -19
  119. package/docs/02-guides/product-owner/README.md +6 -4
  120. package/docs/02-guides/product-owner/commands.md +1 -1
  121. package/docs/02-guides/product-owner/scenarios.md +80 -1
  122. package/docs/02-guides/tester/README.md +13 -10
  123. package/docs/02-guides/tester/bug-reporting.md +2 -2
  124. package/docs/02-guides/tester/qc-automation.md +165 -0
  125. package/docs/02-guides/tester/reading-specs.md +4 -4
  126. package/docs/02-guides/tester/scenarios.md +5 -5
  127. package/docs/02-guides/tester/spec-manifest.md +17 -12
  128. package/docs/02-guides/tester/test-checklist.md +3 -3
  129. package/docs/02-guides/tester/workflow.md +12 -14
  130. package/docs/03-concepts/architecture.md +7 -4
  131. package/docs/03-concepts/pipeline.md +37 -12
  132. package/docs/03-concepts/traceability.md +19 -18
  133. package/docs/04-operations/README.md +1 -1
  134. package/docs/04-operations/bug-flow.md +46 -5
  135. package/docs/04-operations/sync-and-update.md +186 -24
  136. package/docs/05-reference/README.md +3 -0
  137. package/docs/05-reference/command-cheatsheet.md +147 -0
  138. package/docs/05-reference/commands.md +73 -70
  139. package/docs/05-reference/modules.md +4 -4
  140. package/docs/05-reference/trace-schema.md +23 -16
  141. package/docs/README.md +3 -5
  142. package/modules/qc-playwright/stack-profile.yaml +4 -3
  143. package/package.json +1 -1
  144. package/skills/code/SKILL.md +82 -9
  145. package/skills/debug/SKILL.md +117 -11
  146. package/skills/design-spec/SKILL.md +47 -7
  147. package/skills/discovery/SKILL.md +47 -7
  148. package/skills/prd/SKILL.md +70 -4
  149. package/skills/qc/qa-analyst/acceptance-criteria.md +5 -1
  150. package/skills/qc/qa-analyst/business-rules.md +6 -2
  151. package/skills/qc/qa-analyst/data-flow.md +6 -2
  152. package/skills/qc/qa-analyst/spec-breakdown.md +7 -3
  153. package/skills/qc/qa-designer/e2e/journey.md +1 -1
  154. package/skills/qc/qa-designer/exploratory/charter.md +2 -2
  155. package/skills/qc/qa-designer/exploratory/explore-to-functional.md +1 -1
  156. package/skills/qc/qa-designer/functional/api.md +1 -1
  157. package/skills/qc/qa-designer/functional/gui-feature.md +1 -1
  158. package/skills/qc/qa-designer/functional/gui-screen.md +1 -1
  159. package/skills/qc/qa-designer/integration/api.md +1 -1
  160. package/skills/qc/qa-designer/integration/db.md +1 -1
  161. package/skills/qc/qa-designer/integration/gui.md +1 -1
  162. package/skills/qc/qa-designer/integration/kafka.md +1 -1
  163. package/skills/qc/qa-designer/non-functional.md +1 -1
  164. package/skills/qc/qa-planner/test-plan.md +4 -4
  165. package/skills/qc/qa-runner/exploratory/session.md +2 -2
  166. package/skills/setup-ai-first/SKILL.md +35 -2
  167. package/skills/spec/SKILL.md +70 -4
  168. package/skills/test/SKILL.md +129 -16
  169. package/steps/context-loader.md +12 -5
  170. package/steps/report-footer.md +35 -2
  171. package/steps/trace-mirror.md +18 -10
  172. package/templates/project-context.yaml +27 -6
  173. package/docs/02-guides/qc-automation.md +0 -92
@@ -2,12 +2,46 @@
2
2
 
3
3
  # Workflow Cơ Bản
4
4
 
5
+ > Sơ đồ render thành flowchart trên GitHub (Mermaid). Bản text ASCII (mở mục bên dưới) là fallback cho viewer không hỗ trợ Mermaid.
6
+
7
+ ```mermaid
8
+ flowchart TD
9
+ A([Nhận PRD + BDD mới từ PO]) --> B["/sync<br/>kéo specs + services · refresh Living Docs"]
10
+ B --> C["/review-context {prd}<br/>kiểm tra domain · status=approved<br/>đọc AC / UC / BR + BDD"]
11
+ C --> D["Đọc BDD web/app/system từ spec repo<br/>(dev KHÔNG tự generate BDD)"]
12
+ D --> TD
13
+
14
+ subgraph TD["TECH DESIGN + CODE — BE và FE làm SONG SONG"]
15
+ direction LR
16
+ subgraph BE["BE track (system) — làm trước để có contract"]
17
+ direction TB
18
+ BE1["/generate-tech-docs {system}<br/>API contract ← System BDD<br/>endpoint · data model · DB"] --> BE2["/review-tech-docs → approved<br/>chốt = BE contract<br/>(FE chờ cái này)"] --> BE3["/generate-code {system}<br/>code BE ← System BDD + contract"]
19
+ end
20
+ subgraph FE["FE/App track (web · app) — không chờ BE deploy"]
21
+ direction TB
22
+ FE1["① /generate-code {bdd} --phase=ui<br/>UI ← Web/App BDD + Design Spec<br/>mock ← BE contract (nếu có) · else System BDD<br/>emit test-id · Tester test ngay"] --> GATE{{"GATE — chỉ làm tiếp khi ĐÃ CÓ:<br/>System BDD + BE contract (approved)"}}
23
+ GATE --> FE2["② /generate-tech-docs {web|app}<br/>FE design ← Web/App BDD + BE contract<br/>§4 map API · §2b test-id"] --> FE2b["/review-tech-docs → approved<br/>(bump revision)"] --> FE3["③ /generate-code --phase=integration<br/>thay mock bằng API thật theo §4"]
24
+ end
25
+ BE2 -. "cấp BE contract" .-> GATE
26
+ end
27
+
28
+ TD --> E["/dev-gen-test → /dev-run-test<br/>dev tự kiểm (dev_selftest)<br/>ghi vào spec .trace"]
29
+ E --> F["/validate-traces<br/>cập nhật Living Docs (.living-docs)"]
30
+ F --> G["/review-code — 4 lens:<br/>Security · Performance · Architecture · Test"]
31
+ G --> H([Tạo PR → notify PO/SA review])
32
+ ```
33
+
34
+ > **Full-stack / không tách mock:** chỉ cần BE track — chạy `/generate-code {bdd}` một lần (bỏ qua FE 2-phase).
35
+
36
+ <details>
37
+ <summary>Bản text (ASCII fallback — cho viewer không render Mermaid)</summary>
38
+
5
39
  ```
6
40
  Nhận thông báo PRD + BDD mới từ PO
7
41
 
8
42
 
9
- git submodule update --remote my-project-specs
10
- (lấy spec mới nhất, bao gồm cả BDD đã được PO gen)
43
+ /sync # pull specs + services + refresh Living Docs (1 lệnh, preferred)
44
+ (tương đương raw: git submodule update --remote my-project-specs — lấy spec mới nhất, gồm BDD PO đã gen)
11
45
 
12
46
 
13
47
  /review-context {prd-file}
@@ -23,27 +57,44 @@ App: my-project-specs/specs/bdd/{domain}/app/{TICKET-ID}-UC*.feature
23
57
  BE: my-project-specs/specs/bdd/{domain}/system/{TICKET-ID}-UC*.feature
24
58
 
25
59
 
26
- /generate-tech-docs {prd-file}
27
- Gen API spec, DB schema, sequence diagram dựa trên BDD
28
- → /review-tech-docs để verify chất lượng
29
-
30
-
31
- # BE (hoặc full-stack không cần mock split):
32
- /generate-code {bdd-file}
33
- Gen code skeleton theo BDD + tech docs
34
- → Đảm bảo @trace.bdd comment trong code
35
-
36
- # FE/App (2 phases không cần chờ BE):
37
- /generate-code {bdd-file} --phase=ui # Phase 1: UI + mock adapter
38
- Tester test FE ngay (không cần BE ready)
39
- /generate-code {bdd-file} --phase=integration # Phase 2: sau khi sign-off done
40
- Wire real API thay thế mock
60
+ ══════════ TECH DESIGN + CODE — BE track & FE track CHẠY SONG SONG ══════════
61
+ (/generate-tech-docs là platform-aware: đọc @trace.platform BE = API contract · FE/App = client design)
62
+
63
+ BE track (system) ── làm trước, sinh ra "BE contract" ──
64
+ /generate-tech-docs {system} → API contract: endpoints · data model · DB · caching
65
+ /review-tech-docs APPROVED → đây CHÍNH "BE contract" mà FE chờ
66
+ /generate-code {system} → code theo BDD (@trace.bdd)
67
+ (full-stack / không tách mock: chỉ cần track này — /generate-code {bdd} một lần)
68
+
69
+
70
+ FE/App track (web|app) ── KHÔNG chặn chờ BE ──
71
+
72
+ BẮT ĐẦU NGAY (song song với BE):
73
+ /generate-code {bdd} --phase=ui → UI + mock adapter
74
+ UI Web/App BDD + Design Spec
75
+ • mock shape = BE contract nếu có, else System BDD (+warn)
76
+ • fixture values: LUÔN từ System BDD
77
+ • emit test-id (convention {uc}-{screen}-{element}-{type})
78
+ • Tester test FE NGAY (không cần BE deploy API)
79
+
80
+ ╔═══════════════════▼═══════════ GATE ═══════════════════
81
+ ║ Chỉ mở khi CÓ: System BDD + BE contract (approved, từ track BE)
82
+ ╚═══════════════════╤════════════════════════════════════
83
+
84
+ ② /generate-tech-docs {web|app} → FE client design (GATED)
85
+ • components · state
86
+ • §4 API-integration map THEO BE contract
87
+ • §2b Test Selectors (test-id cho element có action)
88
+ /review-tech-docs → approved (bump revision)
89
+
90
+ ③ /generate-code {bdd} --phase=integration
91
+ → wire real API theo §4 FE tech-design (thay mock)
41
92
 
42
93
 
43
94
  /dev-gen-test {bdd-file}
44
95
  → Gen unit test (dev self-check, không phải coverage chính thức)
45
- → /dev-run-test để verify → ghi dev_selftest (pass/fail) + dev_selftest_at vào trace TSV
46
- → /validate-traces (hoặc /sync) để push trace lên spec-module Living Docs ({spec_source}/.living-docs/)
96
+ → /dev-run-test để verify → ghi dev_selftest (pass/fail) + dev_selftest_at vào TSV authoritative {spec_source}/.trace (commit 1 tầng ở spec repo)
97
+ → /validate-traces (hoặc /sync) regenerate report Living Docs {spec_source}/.living-docs/ (gitignored)
47
98
 
48
99
 
49
100
  /review-code {files}
@@ -54,6 +105,17 @@ BE: my-project-specs/specs/bdd/{domain}/system/{TICKET-ID}-UC*.feature
54
105
  Tạo PR → notify PO/SA review
55
106
  ```
56
107
 
108
+ </details>
109
+
110
+ > **Vì sao đúng thứ tự này? — Chuỗi outside-in.** Toàn bộ pipeline đi từ ngoài (client) vào trong (hệ thống):
111
+ > 1. **PO gen BDD: web → app → System** — System BDD (BE) được **tổng hợp từ web+app BDD** (hành vi client định nghĩa trước, BE/system suy ra để phục vụ các flow đó). *(Project chỉ-BE: System BDD gen thẳng từ PRD.)*
112
+ > 2. **BE tech-docs trước** — API contract dẫn xuất từ **System BDD**.
113
+ > 3. **FE/App tech-docs sau (GATED)** — cần **System BDD + BE contract approved**; §4 map theo BE contract.
114
+ >
115
+ > FE **không** bị chặn chờ BE nhờ `--phase=ui` (mock shape: BE contract nếu có, else System BDD), rồi `--phase=integration` wire API thật khi contract đã có. Chi tiết flow: [Concepts › Pipeline](../../03-concepts/pipeline.md).
116
+
117
+ > **Commit ở đâu, push mấy tầng?** Code nằm trong service submodule → **commit 2 tầng** (service rồi umbrella pointer). Tech-docs + `.trace/` (dev_selftest/qc_status) đẩy lên **spec repo** (1 tầng, cross-repo). Sơ đồ git đầy đủ theo từng role: [Sync & Update — Git flow theo role](../../04-operations/sync-and-update.md#ai-commit-vào-repo-nào-git-flow-theo-role).
118
+
57
119
  ---
58
120
 
59
121
  ← [BDD & Trace System](bdd-and-trace.md) · Tiếp theo: [Tình huống thực tế](scenarios.md)
@@ -9,7 +9,7 @@ Tài liệu dành cho **Product Owner (PO)** và **Business Analyst (BA)** — v
9
9
  | Trang | Nội dung |
10
10
  |---|---|
11
11
  | [Commands](commands.md) | Bảng lệnh cho PO/BA · project lessons · xử lý feedback tester |
12
- | [Tình huống thực tế](scenarios.md) | 11 scenario: tính năng mới, design spec, BDD, PRD thay đổi, conflict, brownfield, ... |
12
+ | [Tình huống thực tế](scenarios.md) | 12 scenario: tính năng mới, design spec, BDD, PRD thay đổi, brownfield, **System BDD synthesis & cross-platform conflict**, ... |
13
13
  | [Quy tắc viết PRD](prd-writing-rules.md) | Platform-agnostic · testable AC · negative path · BR numbering |
14
14
  | [Checklist handoff](handoff-checklist.md) | Checklist verify trước khi thông báo dev team bắt đầu |
15
15
 
@@ -34,7 +34,7 @@ PO/BA Dev team
34
34
  - Đảm bảo PRD platform-agnostic (không chứa UI details hay API specs)
35
35
  - Đặt `@trace.domain` đúng để dev team routing hoạt động
36
36
  - Cập nhật `@trace.status: approved` trước khi handoff
37
- - **Generate BDD cho tất cả platforms** (web, app, system) trong spec repo
37
+ - **Generate BDD cho tất cả platforms** theo thứ tự **outside-in: web app system** — System BDD được **tổng hợp từ web+app BDD** (project chỉ-BE thì system gen thẳng từ PRD). Xem [scenarios](scenarios.md).
38
38
  - Thông báo dev team khi có PRD hoặc BDD mới/update
39
39
 
40
40
  **PO/BA KHÔNG cần quan tâm:**
@@ -51,7 +51,7 @@ PRD (WHAT + WHY) → BDD (HOW verified) → Code (HOW built)
51
51
  spec repo spec repo dev repo
52
52
  ```
53
53
 
54
- > **Sau khi BDD approved → QC chạy pipeline tự động:** Khi BDD của một UC được approve, QC team chạy bộ lệnh native `/qc-analyze → /qc-plan → /qc-design-test → /qc-review → /qc-run-test → /qc-report` — đọc official `.feature`, generate + run Playwright/pytest, rồi ghi `qc_status` (official QC coverage) vào Living Docs. PO không chạy QC, nhưng nên biết bước này tồn tại ở downstream. Chi tiết: [QC Automation Guide](../qc-automation.md).
54
+ > **Sau khi BDD approved → QC chạy pipeline tự động:** Khi BDD của một UC được approve, QC team chạy bộ lệnh native `/qc-analyze → /qc-plan → /qc-design-test → /qc-review → /qc-run-test → /qc-report` — đọc official `.feature`, generate + run Playwright/pytest, rồi ghi `qc_status` (official QC coverage) vào Living Docs. PO không chạy QC, nhưng nên biết bước này tồn tại ở downstream. Chi tiết: [chương QC Automation](../tester/qc-automation.md).
55
55
 
56
56
  **3 lý do chính BDD thuộc PO:**
57
57
 
@@ -70,8 +70,10 @@ PRD (WHAT + WHY) → BDD (HOW verified) → Code (HOW built)
70
70
  - App BDD: "App expects user profile sau khi đăng nhập"
71
71
  - System BDD: "BE phải trả `{ token, user_profile }` để thỏa mãn cả 2 platform"
72
72
 
73
+ > Khi web & app **kỳ vọng response khác nhau**, `/generate-bdd → system` dừng tại **CHECKPOINT** để PO chốt cách giải quyết (union / platform-hint / separate-endpoints) — quyết định ghi vào `@system.resolution:`. Quy trình + ví dụ đầy đủ: [scenarios › Tình huống 12](scenarios.md#tình-huống-12--system-bdd-synthesis-outside-in--xử-lý-cross-platform-conflict).
74
+
73
75
  > Xem [Concepts › Traceability](../../03-concepts/traceability.md) để hiểu trace chain PRD → BDD → Code.
74
76
 
75
77
  ---
76
78
 
77
- *Xem thêm:* [Developer Guide](../developer/README.md) · [Tester Guide](../tester/README.md) · [QC Automation Guide](../qc-automation.md) · [Reference › Commands](../../05-reference/commands.md)
79
+ *Xem thêm:* [Developer Guide](../developer/README.md) · [Tester Guide](../tester/README.md) · [chương QC Automation](../tester/qc-automation.md) · [Reference › Commands](../../05-reference/commands.md)
@@ -12,7 +12,7 @@
12
12
  | `/review-context --fix` | Auto-fix các lỗi nhỏ trong PRD | Khi có nhiều lỗi minor tự sửa được |
13
13
  | `/review-context --resume` | Apply các fix sau Review Board | Sau khi review findings |
14
14
  | `/generate-design-spec` | Tạo Design Spec cho FE/App (cần Figma link node-level `?node-id=` cho từng screen) | Sau khi PRD approved, trước khi generate BDD |
15
- | `/generate-bdd` | Tạo BDD cho web / app / system | Sau khi PRD + Design Spec approved |
15
+ | `/generate-bdd` | Tạo BDD theo thứ tự **outside-in: web app system** (System BDD tổng hợp từ web+app; chỉ-BE → system gen thẳng từ PRD) | Sau khi PRD + Design Spec approved |
16
16
  | `/learn {text}` | Ghi lại lỗi AI hay lặp khi gen PRD/BDD thành guardrail | Khi AI lặp lại cùng kiểu sai trong PRD/BDD |
17
17
 
18
18
  > Danh mục đầy đủ mọi command: [Reference › Commands](../../05-reference/commands.md).
@@ -29,6 +29,9 @@ Output: `specs/prd/auth/FEAT-01-login-prd.md`
29
29
  Agent fan-out 4 lens (QA/DEV/SA/PO) chạy song song, rồi chạy completeness-critic loop cho đến khi một vòng không tìm ra finding mới, cuối cùng dedup + resolve conflict. Findings đầy đủ trong 1 lần chạy.
30
30
 
31
31
  Mở findings file, xem xét từng finding: `accepted` → apply · `modified` → viết note · `rejected` → bỏ qua.
32
+
33
+ > **Finding khó hiểu? Bấm 💬 Giải thích.** Nếu một finding mô tả nặng tính kỹ thuật, dùng nút **💬 Giải thích** trên Review Board (extension Spec Driven Dev). Claude sẽ giải thích lại bằng ngôn ngữ no-tech + đề xuất phương án cụ thể (cover cả edge case) ngay trong terminal, và **chờ bạn confirm trước khi apply** vào PRD — tránh refine nhiều vòng. Prompt sửa được qua setting `reviewBoard.clarifyPrompt` (không cần cài lại extension).
34
+
32
35
  ```
33
36
  /review-context --resume specs/prd/auth/FEAT-01-login-prd.md
34
37
  ```
@@ -63,7 +66,7 @@ Agent hỏi: **"Platform? (1) web (2) app (3) system"**
63
66
  - Chạy lại, chọn `app` → `specs/bdd/auth/app/FEAT-01-UC1-login-app.feature`
64
67
  - Chạy lại, chọn `system` → Agent tổng hợp từ web+app BDDs → `specs/bdd/auth/system/FEAT-01-UC1-login-system.feature`
65
68
 
66
- > Nếu project chỉ có web → chỉ cần gen `web` rồi `system`.
69
+ > Nếu project chỉ có web → chỉ cần gen `web` rồi `system`. Nếu web & app kỳ vọng response khác nhau → agent dừng tại CHECKPOINT để PO chốt resolution (xem [Tình huống 12](#tình-huống-12--system-bdd-synthesis-outside-in--xử-lý-cross-platform-conflict)).
67
70
 
68
71
  **Bước 8 — Push và thông báo:**
69
72
  ```bash
@@ -354,4 +357,80 @@ Chạy ở mode **Reverse-document**: mô tả lại API đã tồn tại, ghi c
354
357
 
355
358
  ---
356
359
 
360
+ ## Tình huống 12 — System BDD synthesis: outside-in & xử lý cross-platform conflict
361
+
362
+ **Bối cảnh:** Đã có Web BDD + App BDD cho FEAT-01. Khi gen System BDD, `/generate-bdd → system` **không viết mới từ PRD** mà **tổng hợp ngược** từ Web + App BDD (outside-in) — vì BE/system tồn tại để phục vụ các flow client.
363
+
364
+ **4 mode tự nhận diện** (theo BDD client đang có):
365
+
366
+ | Có sẵn | Mode | System BDD lấy từ |
367
+ |---|---|---|
368
+ | web + app | **Multi-platform** | tổng hợp cả hai (+ conflict check) |
369
+ | chỉ web | **Web-only** | chỉ web |
370
+ | chỉ app | **App-only** | chỉ app |
371
+ | không có web/app | **Backend-only** | gen thẳng từ PRD (business-event language) |
372
+ | PRD có `API Source: existing` | **Brownfield** | dùng contract có sẵn trong PRD (xem [Tình huống 11](#tình-huống-11--brownfield-api-đã-tồn-tại-trên-hệ-thống-cũ)) |
373
+
374
+ ### Ví dụ multi-platform CÓ conflict
375
+
376
+ Web và App kỳ vọng response **khác nhau**:
377
+ ```gherkin
378
+ # web/FEAT-01-UC1-login-web.feature
379
+ Then user sees dashboard # → cần { token, redirect_url }
380
+
381
+ # app/FEAT-01-UC1-login-app.feature
382
+ Then app navigates to HomeScreen # → cần { token, user_profile }
383
+ ```
384
+
385
+ Chạy `/generate-bdd → system` → agent phát hiện **response shape mismatch** → dừng tại CHECKPOINT (bắt buộc, không skip được):
386
+
387
+ ```
388
+ ⚠️ CROSS-PLATFORM CONTRACT CONFLICT
389
+ Conflict 1: Response shape mismatch
390
+ Web (Then sees dashboard) → { token, redirect_url }
391
+ App (Then navigates HomeScreen) → { token, user_profile }
392
+
393
+ Resolution:
394
+ A — Union: BE trả { token, redirect_url, user_profile }; client bỏ field không dùng (đơn giản, hơi thừa)
395
+ B — Platform hint: client gửi header X-Platform: web|app, BE tailor response (gọn, BE phức tạp hơn)
396
+ C — Separate endpoints: POST /auth/login/web · /auth/login/app (linh hoạt nhất, nhiều endpoint)
397
+ D — Custom: tự mô tả
398
+ ```
399
+
400
+ **4 loại conflict agent bắt:**
401
+
402
+ | Loại | Ví dụ |
403
+ |---|---|
404
+ | Response shape mismatch | web `{ token, redirect_url }` vs app `{ token, user_profile }` |
405
+ | Error semantics mismatch | web HTTP 423 vs app error code `ACC_LOCKED` |
406
+ | Business rule contradiction | web "khoá sau 5 lần" vs app "khoá sau 3 lần" |
407
+ | Data field conflict | web `expires_in: seconds` vs app `expires_at: ISO timestamp` |
408
+
409
+ ### PO chọn resolution → ghi vào System BDD
410
+
411
+ Chọn **A (Union)** → System BDD được gen kèm annotation:
412
+ ```gherkin
413
+ # system/FEAT-01-UC1-login-system.feature
414
+ # @trace.platform: system
415
+ # @system.resolution: union — clients receive all fields
416
+ Scenario: Successful login returns token, redirect and profile
417
+ When the system receives a login request
418
+ Then the system returns { token, redirect_url, user_profile }
419
+ And the session is valid for 3600 seconds
420
+ ```
421
+ - **B (platform-hint)** → `Scenario Outline` + Examples cho web/app variant; annotation `platform-hint`.
422
+ - **C (separate endpoints)** → Scenario riêng mỗi endpoint; annotation ghi rõ split.
423
+
424
+ Mỗi quyết định được lưu thành `# @system.resolution:` trong file system BDD — để BE dev build contract đúng kiểu đã chốt.
425
+
426
+ ### Bàn giao xuống BE & xử lý thay đổi
427
+
428
+ - BE dev đọc `@system.resolution:` → build API contract theo đúng kiểu (union / platform-hint / separate-endpoints) trong `/generate-tech-docs`. **Không tự đổi** — nếu thấy bất hợp lý → phản hồi PO (đây là quyết định contract, không phải implementation).
429
+ - **Web/App BDD đổi về sau** → re-gen System BDD (`/generate-bdd → system`) để tổng hợp lại; phát sinh conflict mới → CHECKPOINT lại.
430
+ - **FE cần field mà BE contract chưa có** → là **contract gap**: QC/Dev `/report-bug` hoặc `/propose-scenario` → PO bổ sung vào Web/App BDD → re-synthesize System BDD → BE cập nhật contract. Vòng feedback: [Bug Flow](../../04-operations/bug-flow.md).
431
+
432
+ > **Tóm tắt outside-in:** Web/App BDD (client trước) → System BDD (tổng hợp, chốt conflict) → BE tech-docs (contract) → FE/App tech-docs (GATED: cần System BDD + BE contract). Chuỗi đầy đủ: [Developer › Workflow](../developer/workflow.md) · [Concepts › Pipeline](../../03-concepts/pipeline.md).
433
+
434
+ ---
435
+
357
436
  ← [Commands](commands.md) · Tiếp theo: [Quy tắc viết PRD](prd-writing-rules.md)
@@ -14,18 +14,19 @@ Tài liệu dành cho **QA / Tester** — cách kết nối với spec framework
14
14
  | [Tình huống thực tế](scenarios.md) | 6 scenario: feature mới, PRD thay đổi, multi-service, regression, ... |
15
15
  | [Báo cáo bug](bug-reporting.md) | `/report-bug` · `/propose-scenario` · template báo cáo |
16
16
  | [Checklist test pass](test-checklist.md) | Checklist trước khi báo "test pass" |
17
+ | [QC Automation](qc-automation.md) | Deep-dive pipeline `/qc-*` 6 bước · stack `qc-playwright` · `qc_status` → Living Docs |
17
18
 
18
19
  ## Vai Trò Tester Trong Framework
19
20
 
20
21
  ```
21
- PO/BA Dev Tester
22
- ────────── ────────────────── ──────────────────────────
23
- PRD BDD (từ PRD) /sync + /generate-spec-manifest
24
- Tech Docs Đọc PRD + BDD + Tech Docs
25
- Code Viết test cases · Chạy test
26
- /report-bug (bug spec-traced)
27
- /propose-scenario (edge case → BDD draft)
28
- └──────────────┴───── feedback/ trong spec repo ◄────┘
22
+ PO/BA Dev Tester / QA
23
+ ───────────────── ─────────────────── ──────────────────────────
24
+ PRD (đọc BDD KHÔNG gen) /sync + /generate-spec-manifest
25
+ BDD web→app→system Tech Docs Đọc PRD + BDD + Tech Docs
26
+ Design Spec Code Viết test cases · chạy /qc-*
27
+ /report-bug · /propose-scenario
28
+ (bug / edge case → spec repo)
29
+ └─────────────────────┴──── feedback/ trong spec repo ◄────┘
29
30
  PO/Dev thấy qua /sync (📥) → fix / promote / update PRD
30
31
  ```
31
32
 
@@ -63,10 +64,12 @@ PRD BDD (từ PRD) /sync + /generate-spec-manifest
63
64
  | `/qc-run-test` | Chạy automation test → ghi `qc_status` per scenario vào trace TSV | Bước 5 |
64
65
  | `/qc-report` | Tổng hợp kết quả thành QC report | Bước 6 |
65
66
 
66
- Đây là **bộ test chính thức (authoritative) của QC**, chạy ngay trong framework. Pipeline dùng stack module `qc-playwright` (Python + pytest-playwright + Page Object). Xem chi tiết flow tại **[QC Automation guide](../qc-automation.md)**.
67
+ Đây là **bộ test chính thức (authoritative) của QC**, chạy ngay trong framework. Pipeline dùng stack module `qc-playwright` (Python + pytest-playwright + Page Object). Xem chi tiết flow tại **chương [QC Automation](qc-automation.md)** (một phần của guide Tester / QA này).
68
+
69
+ > **Artifact ra đâu:** `/qc-analyze` ghi **2 file** (`REQUIREMENT_ANALYSIS.md` + `DOC_GAPS.md`), `/qc-plan` → `TEST_PLAN.md`, `/qc-design-test` → `test-cases/*.Test.md` — tất cả trong `{qc_dir}/{UC-ID}/` (mặc định `docs/`, **visible**, không phải `.agent/` ẩn). Skill QC nạp từ `paths.qc_skills_dir` — trỏ được tới repo QC để skill **không bị `/update-framework` ghi đè**. Chi tiết: [QC Automation guide](qc-automation.md#skill-sourcing--upgrade-safety).
67
70
 
68
71
  > **Phân biệt với test commands của Dev:** `/dev-gen-test`, `/dev-run-test`, `/dev-smoke-test` là **dev tự kiểm tra code của mình** — phát tín hiệu `dev_selftest`, KHÔNG phải bộ test chính thức. Bộ test authoritative của QC là pipeline `/qc-*` (sinh ra `qc_status`). Hai luồng tách biệt.
69
72
 
70
73
  ---
71
74
 
72
- *Xem thêm:* [Developer Guide](../developer/README.md) · [QC Automation Guide](../qc-automation.md) · [Operations › Bug Flow](../../04-operations/bug-flow.md) · [Reference › Commands](../../05-reference/commands.md)
75
+ *Xem thêm:* [Developer Guide](../developer/README.md) · [Chương QC Automation](qc-automation.md) · [Operations › Bug Flow](../../04-operations/bug-flow.md) · [Reference › Commands](../../05-reference/commands.md)
@@ -30,7 +30,7 @@ Nếu `/report-bug` báo *coverage gap* (behavior đúng nhưng chưa có scenar
30
30
  ```
31
31
 
32
32
  - Nếu behavior **đã nằm trong một AC của PRD** → lệnh draft Gherkin (tag `@proposed @from-test`), ghi vào `{spec_source}/feedback/bdd-proposals/` → commit + push. PO/Dev review rồi đưa vào `.feature`.
33
- - Nếu behavior **chưa có trong PRD** → lệnh dừng xuất *PRD change request* cho PO.
33
+ - Nếu behavior **chưa có trong PRD** → lệnh **ghi** một *PRD change request* (`State: Open`) vào `{spec_source}/feedback/prd-change-requests/{UC-ID}-{slug}.md` → commit + push (KHÔNG chỉ in ra). PO thấy nó khi `/sync`, thêm/sửa AC rồi `/generate-bdd` lại.
34
34
 
35
35
  > Tester không tự ghi vào BDD — chỉ đề xuất. Giữ đúng ownership.
36
36
 
@@ -78,7 +78,7 @@ Severity : Major
78
78
 
79
79
  Spec context:
80
80
  PRD : specs/prd/auth/FT-001-login.md (v1.0)
81
- BDD : free-trial-be/specs/bdd/auth/FT-001-login.feature
81
+ BDD : free-trial-specs/specs/bdd/auth/system/FT-001-login.feature
82
82
  → Scenario: "Lock account after 5 failed attempts"
83
83
  Tech Doc : free-trial-specs/specs/tech-docs/auth/FT-001-auth-api.md
84
84
 
@@ -0,0 +1,165 @@
1
+ [📚 Docs](../../README.md) › [Guides](../README.md) › [Tester](README.md) › QC Automation
2
+
3
+ # Hướng Dẫn QC Automation — Spec-Driven Dev
4
+
5
+ > Đây là **một chương của [guide Tester / QA](README.md)** — QC và Tester là **cùng một role**. Chương này đi sâu vào pipeline QC tự động (`/qc-*`); phần vai trò chung, spec-manifest, `/report-bug`, `/propose-scenario`… ở [README của guide](README.md).
6
+
7
+ Pipeline QC automation **chính thức** của framework — được port từ agent của team QC (reference repo `ai-automation-qc-base`) vào ngay trong framework. Nó sinh và chạy automation **Playwright/pytest** từ BDD `.feature` chính thức, rồi ghi tín hiệu **`qc_status`** (authoritative) vào trace TSV → Living Docs.
8
+
9
+ ## Mục Lục
10
+
11
+ - [Hai luồng test: dev self-check vs QC chính thức](#hai-luồng-test-dev-self-check-vs-qc-chính-thức)
12
+ - [Pipeline 6 bước](#pipeline-6-bước)
13
+ - [Stack — module qc-playwright](#stack--module-qc-playwright)
14
+ - [Trace join: qc_status đến Living Docs như thế nào](#trace-join-qc_status-đến-living-docs-như-thế-nào)
15
+ - [Entry point](#entry-point)
16
+ - [Skills theo layer](#skills-theo-layer)
17
+
18
+ ## Hai Luồng Test: Dev Self-Check vs QC Chính Thức
19
+
20
+ Pipeline QC này **khác** với developer **self-check** (`/dev-gen-test`, `/dev-run-test`, `/dev-smoke-test`):
21
+
22
+ | Signal | Owner | Command | Ý nghĩa |
23
+ |--------|-------|---------|---------|
24
+ | `dev_selftest` | Dev | `/dev-run-test` | smoke check của riêng dev (KHÔNG authoritative) |
25
+ | `qc_status` | QC | `/qc-run-test` | kết quả QC automation **chính thức** |
26
+
27
+ Cả hai hiển thị **cạnh nhau** trong Living Docs; không cái nào ghi đè cái nào. `dev_selftest: pass` chỉ nghĩa "dev đã tự smoke qua"; coverage chính thức nằm ở `qc_status`.
28
+
29
+ ## Pipeline 6 Bước
30
+
31
+ ```
32
+ /qc-analyze → /qc-plan → /qc-design-test → /qc-review → /qc-run-test → /qc-report
33
+ (requirement (risk/plan (test-case (review (gen+run (report +
34
+ breakdown) + Q-for-dev) .Test.md) gate) Python → evidence)
35
+ qc_status)
36
+ ```
37
+
38
+ | Command | Vai trò | Output |
39
+ |---------|---------|--------|
40
+ | `/qc-analyze` | bóc tách spec chính thức thành **1 file phân tích gộp** (requirement + BR/AC + data-flow) + `DOC_GAPS` | `{qc_dir}/{UC-ID}/` → `REQUIREMENT_ANALYSIS.md` + `DOC_GAPS.md` (**2 file**) |
41
+ | `/qc-plan` | risk / what-if / questions-for-dev + test plan | `TEST_PLAN.md` |
42
+ | `/qc-design-test` | thiết kế test case (Markdown `.Test.md`), tag `@trace.verifies={UC-ID}-SC{N}` | `test-cases/` |
43
+ | `/qc-review` | cổng review hai chiều: review test case (sau design) và script (sau run) | findings |
44
+ | `/qc-run-test` | sinh + chạy Python pytest-playwright; **ghi `qc_status`** per scenario | `{trace_dir}/{UC-ID}.tsv` |
45
+ | `/qc-report` | report pytest-html + Playwright trace + evidence | `reports/<feature>/report.html` |
46
+
47
+ > **Nơi lưu artifact (`qc_dir`):** mọi output của pipeline (trừ report) nằm trong thư mục QC
48
+ > **lộ ra ngoài** `{qc_dir}/{UC-ID}/` — mặc định `docs/{UC-ID}/`, cấu hình qua `paths.qc_dir`
49
+ > trong `project-context.yaml`. Đây là **working-doc riêng của QC** trong repo QC, **không ẩn**
50
+ > (KHÔNG nằm trong `.agent/`). Spec gốc (PRD/`.feature`/design-spec) KHÔNG nằm đây — chúng đến
51
+ > từ **submodule spec của PO** (`spec_source`). `/qc-analyze` chỉ ghi **đúng 2 file**:
52
+ > `REQUIREMENT_ANALYSIS.md` (phân tích gộp) + `DOC_GAPS.md`.
53
+
54
+ ## Stack — Module qc-playwright
55
+
56
+ `/qc-run-test` và `/qc-report` dùng stack module `qc-playwright`
57
+ (`.agent/modules/qc-playwright/stack-profile.yaml`): **Python + pytest-playwright + Page
58
+ Object** (slim `BasePage`, 3-layer), **Playwright Trace + pytest-html** (KHÔNG Allure). Stack
59
+ này độc lập với module implementation của dev (java-spring, react, flutter, …).
60
+
61
+ Per-layer guides chi tiết nằm trong `skills/qc/<stage>/` (port từ skills của agent QC):
62
+ functional / integration / e2e / non-functional / exploratory.
63
+
64
+ ### Test-ID contract — locate element không cần scan
65
+
66
+ Để QC **không** phải dò/giả lập vị trí element lúc runtime (chậm), FE tech-design có section **§2b Test Selectors**: mỗi element **có action** được gán test-id ổn định (`{uc}-{screen}-{element}-{type}`, vd `ft001-login-submit-btn`). `/generate-code` emit đúng id đó theo attribute platform (web `data-testid` · RN `testID` · Flutter `Key`/`Semantics` · iOS `accessibilityIdentifier`); `/qc-design-test` cite test-id trong step; `/qc-run-test` build Page Object locator **thẳng từ map** (ưu tiên trong locator priority `data-testid → role → …`). Element có action mà chưa có test-id trong §2b → QC **fallback** role/text (chậm hơn) và nên bổ sung vào tech-design. Xem [Trace Schema](../../05-reference/trace-schema.md) và FE tech-design (`/generate-tech-docs`).
67
+
68
+ > **Component reuse / code có sẵn:** `/generate-tech-docs` + `/generate-code` chỉ gán id cho code **mới**. Với component dùng chung (id ở usage site, component phải *forward* test-id) hoặc màn hình **brownfield** đã viết tay → chạy **`/map-testids {UC-ID}`**: reverse-document id đang có, gán id còn thiếu, patch forwarding + ghi vào `figma-components/{module}.md` (section *Test-ID Forwarding*), điền §2b. Nhờ vậy QC vẫn locate-by-id không cần scan.
69
+
70
+ ## Trace Join: qc_status Đến Living Docs Như Thế Nào
71
+
72
+ 1. `.feature` chính thức định nghĩa scenario là `@trace.scenario={UC-ID}-SC{N}`.
73
+ 2. `/qc-design-test` ghi SC mà test case thuộc về; `/qc-run-test` tag mỗi pytest test
74
+ `# @trace.verifies={UC-ID}-SC{N}`.
75
+ 3. `/qc-run-test` ghi `qc_status` (`pass|fail|skip|not_run`) + `qc_run_at` vào trace TSV của
76
+ service (authoritative), rồi refresh panel mirror local.
77
+ 4. `/validate-traces` (hoặc `/sync`) tổng hợp các TSV thành report Living Docs tại
78
+ `{spec_source}/.living-docs/` — dashboard hiển thị `qc_status` cạnh `dev_selftest`.
79
+
80
+ ## Entry Point
81
+
82
+ Pipeline QC bắt đầu ngay khi BDD của một UC được approved (`/review-context (BDD)` APPROVED):
83
+
84
+ ```
85
+ /qc-analyze {UC-ID} → … → /qc-report {UC-ID} → /validate-traces {UC-ID}
86
+ ```
87
+
88
+ ## Skills Theo Layer
89
+
90
+ Các skill chi tiết theo từng giai đoạn QC nằm trong `skills/qc/`:
91
+
92
+ | Stage skill | Vai trò |
93
+ |---|---|
94
+ | `qa-analyst` | phân tích requirement, sinh `DOC_GAPS` |
95
+ | `qa-planner` | test plan, risk, questions-for-dev |
96
+ | `qa-designer` | thiết kế test case `.Test.md` theo layer (functional / integration / e2e / non-functional / exploratory) |
97
+ | `qa-reviewer` | cổng review test case và script |
98
+ | `qa-runner` | sinh + chạy Python pytest-playwright, sinh report (Playwright Trace + pytest-html) |
99
+
100
+ Mỗi skill **tự chứa** (self-contained) và có version frontmatter để theo dõi khi nâng cấp.
101
+
102
+ ## Khi QC Tìm Thấy Bug / Spec Gap — Đẩy Lên Specs
103
+
104
+ QC chạy pipeline nhưng **không tự sửa spec/code**. Khi phát hiện vấn đề, đẩy lên spec repo của PO
105
+ qua flow feedback có sẵn (`/report-bug` · `/propose-scenario` — PO/Dev nhận khi `/sync`):
106
+
107
+ | QC phát hiện ở | Loại | Hành động |
108
+ |---|---|---|
109
+ | `/qc-run-test` FAIL = **product-gap** (impl ≠ spec, lỗi thật) | bug | `/report-bug {UC-ID} {expected vs actual}` |
110
+ | `/qc-run-test` FAIL = **script-bug** (sai selector/logic script) | — | QC tự sửa script + chạy lại (**KHÔNG** file bug) |
111
+ | `/qc-analyze` `DOC_GAPS` blocker = **spec sai / mơ hồ / mâu thuẫn** (PRD·BDD) | spec defect | `/report-bug {UC-ID}` (BUG_FLOW phân loại PRD/BDD) |
112
+ | `/qc-analyze` `DOC_GAPS` = **thiếu coverage** (behavior trong AC nhưng chưa có scenario) | coverage gap | `/propose-scenario {UC-ID}` |
113
+ | `DOC_GAPS` = `ASSUMPTION` / `OPEN QUESTION` | câu hỏi | qc-plan → questions-for-dev (xác nhận với PO/Dev, không file bug) |
114
+
115
+ `/report-bug` ghi `feedback/bug-reports/BUG-xxx.md` + commit/push lên spec repo; `/propose-scenario`
116
+ ghi `feedback/bdd-proposals/`. PO/Dev thấy khi `/sync`, rồi BUG_FLOW định tuyến root cause:
117
+
118
+ ```
119
+ • Code bug → Dev /fix-bug (KHÔNG đổi spec)
120
+ • BDD sai / thiếu → sửa .feature / promote proposal → /generate-bdd
121
+ • PRD mơ hồ / sai → PO sửa PRD → /refine-prd → /review-context → /generate-bdd
122
+ ↓ (nếu spec đổi → regenerate)
123
+ /generate-code lại → QC /qc-run-test lại → qc_status: fail → pass
124
+ ```
125
+
126
+ > QC chỉ **đọc** spec (từ submodule PO) — mọi thay đổi PRD/BDD là việc của PO/Dev. QC đẩy *tín hiệu*
127
+ > (bug / proposal / gap), không tự sửa canonical spec. `/qc-report` ở cuối pipeline **in sẵn** danh
128
+ > sách lệnh `/report-bug` cho từng product-gap để QC chạy. Chi tiết flow bug: [Operations · Bug Flow](../../04-operations/bug-flow.md).
129
+
130
+ ## Skill Sourcing & Upgrade-Safety
131
+
132
+ Các skill QC (`qa-analyst` / `qa-designer` / `qa-planner` / `qa-reviewer` / `qa-runner` +
133
+ `DOC_GAPS.template.md`) **không bị hardcode** — command nạp chúng từ `paths.qc_skills_dir`:
134
+
135
+ | Tình huống | `qc_skills_dir` | Hệ quả khi `/update-framework` |
136
+ |---|---|---|
137
+ | Mặc định (standalone) | `.agent/skills/qc` (bản framework bundle) | **Bị ghi đè** mỗi lần upgrade → đừng sửa trực tiếp ở đây |
138
+ | QC sở hữu skill (khuyến nghị) | repo QC / submodule, vd `qc-base/.claude/skills` | **Không bao giờ bị đụng** — upgrade chỉ rewrite `.agent/` |
139
+
140
+ > `qc_skills_dir` chỉ cần trỏ tới thư mục **chứa các folder `qa-*`**. Cả 2 layout đều hợp lệ:
141
+ > framework bundle (`.agent/skills/qc/qa-analyst/…`) và repo QC (`.claude/skills/qa-analyst/…`).
142
+
143
+ **Cách QC tách skill ra khỏi vòng đời framework:**
144
+
145
+ ```bash
146
+ # 1. Đưa repo skill của QC vào project (submodule để pin version):
147
+ git submodule add <ai-automation-qc-base-repo-url> qc-base
148
+
149
+ # 2. Trỏ qc_skills_dir trong .agent/project-context.yaml:
150
+ # paths:
151
+ # qc_skills_dir: "qc-base/.claude/skills"
152
+
153
+ # 3. Từ giờ: QC hoàn thiện skill trong repo qc-base, bump submodule khi cần.
154
+ # /update-framework ghi đè .agent/ nhưng KHÔNG chạm qc-base/ → skill an toàn.
155
+ ```
156
+
157
+ Nhờ vậy **vòng đời skill QC** và **vòng đời framework** tách hẳn nhau: nâng cấp framework
158
+ không nuốt mất skill đang hoàn thiện, và QC update skill 1 chỗ (repo của họ) cho mọi project.
159
+
160
+ ## Xem Thêm
161
+
162
+ - [Guide › Tester](README.md) — vai trò tester, spec-manifest, `/report-bug`, `/propose-scenario`
163
+ - [Concepts › Traceability](../../03-concepts/traceability.md) — trace TSV, dev_selftest vs qc_status
164
+ - [Reference › Modules](../../05-reference/modules.md) — chi tiết module `qc-playwright`
165
+ - [Reference › Commands](../../05-reference/commands.md) — danh mục đầy đủ mọi command
@@ -20,8 +20,8 @@ Sau khi chạy `/generate-spec-manifest`, tra manifest để lấy paths:
20
20
  FT-001:
21
21
  prd: "my-project-specs/specs/prd/auth/FT-001-login.md"
22
22
  bdd:
23
- be: "free-trial-be/specs/bdd/auth/system/FT-001-UC1-login-system.feature"
24
- web: "free-trial-web/specs/bdd/auth/web/FT-001-UC1-login-web.feature"
23
+ be: "my-project-specs/specs/bdd/auth/system/FT-001-UC1-login-system.feature"
24
+ web: "my-project-specs/specs/bdd/auth/web/FT-001-UC1-login-web.feature"
25
25
  tech_docs:
26
26
  be: "my-project-specs/specs/tech-docs/auth/FT-001-auth-api.md"
27
27
  ```
@@ -37,8 +37,8 @@ AC3: Sai password 5 lần liên tiếp → khoá tài khoản 30 phút
37
37
  AC4: Tài khoản bị khoá → thông báo thời gian mở khoá
38
38
  ```
39
39
 
40
- **Bước 2: Đọc BDD System (cho BE)** tại `free-trial-be/specs/bdd/auth/system/FT-001-UC1-login-system.feature`
41
- *(nằm trong service submodule của BE — PO gen, chứa contract BE phải đáp ứng)*
40
+ **Bước 2: Đọc BDD System (cho BE)** tại `my-project-specs/specs/bdd/auth/system/FT-001-UC1-login-system.feature`
41
+ *(nằm trong spec submodule — PO gen, chứa contract BE phải đáp ứng; tất cả BDD web/app/system đều ở spec repo)*
42
42
 
43
43
  ```gherkin
44
44
  Scenario: Successful login
@@ -18,8 +18,8 @@ git pull && git submodule update --remote --recursive
18
18
  # status: approved ← ✅ có thể test
19
19
  # prd: "specs/prd/payment/FT-042-checkout.md"
20
20
  # bdd:
21
- # be: "free-trial-be/specs/bdd/payment/system/FT-042-UC1-checkout-system.feature"
22
- # web: "free-trial-web/specs/bdd/payment/web/FT-042-UC1-checkout-web.feature"
21
+ # be: "free-trial-specs/specs/bdd/payment/system/FT-042-UC1-checkout-system.feature"
22
+ # web: "free-trial-specs/specs/bdd/payment/web/FT-042-UC1-checkout-web.feature"
23
23
  ```
24
24
 
25
25
  **Test plan từ BDD BE (7 scenarios):**
@@ -156,9 +156,9 @@ FT-042:
156
156
  domain: payment
157
157
  status: approved
158
158
  bdd:
159
- be: "free-trial-be/specs/bdd/payment/system/FT-042-UC1-checkout-system.feature"
160
- web: "free-trial-web/specs/bdd/payment/web/FT-042-UC1-checkout-web.feature"
161
- app: "free-trial-app/specs/bdd/payment/app/FT-042-UC1-checkout-app.feature"
159
+ be: "free-trial-specs/specs/bdd/payment/system/FT-042-UC1-checkout-system.feature"
160
+ web: "free-trial-specs/specs/bdd/payment/web/FT-042-UC1-checkout-web.feature"
161
+ app: "free-trial-specs/specs/bdd/payment/app/FT-042-UC1-checkout-app.feature"
162
162
  ```
163
163
 
164
164
  **Test strategy:**
@@ -4,18 +4,23 @@
4
4
 
5
5
  ## Spec-Manifest Là Gì Và Tại Sao Cần
6
6
 
7
- Trong umbrella repo, spec files nằm rải rác ở nhiều submodule:
7
+ Trong umbrella repo (có `spec_source`), **mọi spec đều nằm trong spec submodule** — nhưng rải ở nhiều thư mục (`prd/`, `bdd/{platform}/`, `tech-docs/`) và nhiều domain:
8
8
 
9
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
10
+ free-trial-umbrella/ ← umbrella (Claude Code mở ở đây)
11
+ ├── free-trial-specs/ SPEC submodule — TẤT CẢ spec ở đây
12
+ │ └── specs/
13
+ ├── prd/auth/FT-001-login.md PRD
14
+ ├── design-spec/auth/... Design Spec
15
+ │ ├── bdd/auth/system/... ← BDD System (BE)
16
+ │ ├── bdd/auth/web/... ← BDD Web (FE)
17
+ │ ├── bdd/auth/app/... ← BDD App
18
+ │ └── tech-docs/auth/... ← Tech Docs (BE contract + FE design)
19
+ ├── free-trial-be/ (chỉ code) ← SERVICE submodule
20
+ └── free-trial-web/ (chỉ code) ← SERVICE submodule
16
21
  ```
17
22
 
18
- Tester's agent không biết layout này → cần một **index file** để tra cứu.
23
+ Tester's agent không biết domain nào / file nào ứng với TICKET-ID → cần một **index file** để tra cứu. *(Chỉ khi KHÔNG có `spec_source` thì BDD mới rải theo từng service submodule.)*
19
24
 
20
25
  `spec-manifest.yaml` là file được gen tự động, ánh xạ TICKET-ID → tất cả file liên quan:
21
26
 
@@ -30,8 +35,8 @@ features:
30
35
  be: "free-trial-specs/specs/tech-docs/auth/FT-001-UC1-auth-api.md"
31
36
  web: "free-trial-specs/specs/tech-docs/auth/FT-001-UC1-login-web.md"
32
37
  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"
38
+ be: "free-trial-specs/specs/bdd/auth/system/FT-001-UC1-login-system.feature"
39
+ web: "free-trial-specs/specs/bdd/auth/web/FT-001-UC1-login-web.feature"
35
40
  ```
36
41
 
37
42
  **Quan trọng:**
@@ -94,7 +99,7 @@ Khi làm việc với umbrella repo, VS Code Living Docs panel cần được đ
94
99
  # Chạy sau mỗi codegen session — hoặc khi cần refresh trạng thái coverage
95
100
  /sync # hoặc /validate-traces
96
101
 
97
- # → Đọc TSVs từ: user-service/.trace/, order-service/.trace/, ...
102
+ # → Đọc TSVs từ MỘT chỗ: {spec_source}/.trace/ (mỗi scenario mang @trace.service)
98
103
  # → Ghi canonical: {spec_source}/.living-docs/trace-report.json (+ TSV mirror)
99
104
  # → Ghi panel mirror: ./.trace (workspace hiện tại — panel luôn có data)
100
105
  # → Panel cập nhật ngay sau khi lệnh hoàn tất
@@ -117,7 +122,7 @@ Panel hiển thị trạng thái cross-service:
117
122
  >
118
123
  > **`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
124
 
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.
125
+ > **Prerequisite:** umbrella cần `setup.spec_source` trỏ đúng spec submodule → trace TSV authoritative dồn về `{spec_source}/.trace/`. Nếu thiếu → panel trống → báo Dev team. (Chỉ chế độ không có `spec_source` mới cần `paths.trace_dir` per-service.)
121
126
 
122
127
  ---
123
128