@anhth2/spec-driven-dev-plugin 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/commands/debug.md +38 -8
  2. package/commands/define-product.md +38 -8
  3. package/commands/dev-gen-test.md +39 -9
  4. package/commands/dev-gen-test.tmpl +1 -1
  5. package/commands/dev-run-test.md +43 -10
  6. package/commands/dev-run-test.tmpl +5 -2
  7. package/commands/dev-smoke-test.md +38 -8
  8. package/commands/fix-bug.md +38 -8
  9. package/commands/generate-bdd.md +42 -10
  10. package/commands/generate-bdd.tmpl +4 -2
  11. package/commands/generate-code.md +39 -9
  12. package/commands/generate-code.tmpl +1 -1
  13. package/commands/generate-design-spec.md +38 -8
  14. package/commands/generate-prd.md +38 -8
  15. package/commands/generate-spec-manifest.md +38 -8
  16. package/commands/generate-tech-docs.md +38 -8
  17. package/commands/learn.md +38 -8
  18. package/commands/propose-scenario.md +38 -8
  19. package/commands/qc-analyze.md +514 -0
  20. package/commands/qc-analyze.tmpl +71 -0
  21. package/commands/qc-design-test.md +510 -0
  22. package/commands/qc-design-test.tmpl +67 -0
  23. package/commands/qc-plan.md +492 -0
  24. package/commands/qc-plan.tmpl +49 -0
  25. package/commands/qc-report.md +491 -0
  26. package/commands/qc-report.tmpl +48 -0
  27. package/commands/qc-review.md +496 -0
  28. package/commands/qc-review.tmpl +53 -0
  29. package/commands/qc-run-test.md +538 -0
  30. package/commands/qc-run-test.tmpl +77 -0
  31. package/commands/refine-prd.md +38 -8
  32. package/commands/report-bug.md +38 -8
  33. package/commands/review-code.md +38 -8
  34. package/commands/review-context.md +38 -8
  35. package/commands/review-tech-docs.md +38 -8
  36. package/commands/setup-ai-first.md +7 -0
  37. package/commands/sync.md +7 -0
  38. package/commands/update-framework.md +7 -0
  39. package/commands/validate-traces.md +54 -12
  40. package/commands/validate-traces.tmpl +16 -4
  41. package/core/FRAMEWORK_VERSION +1 -1
  42. package/core/commands/debug.md +38 -8
  43. package/core/commands/define-product.md +38 -8
  44. package/core/commands/dev-gen-test.md +39 -9
  45. package/core/commands/dev-run-test.md +43 -10
  46. package/core/commands/dev-smoke-test.md +38 -8
  47. package/core/commands/fix-bug.md +38 -8
  48. package/core/commands/generate-bdd.md +42 -10
  49. package/core/commands/generate-code.md +39 -9
  50. package/core/commands/generate-design-spec.md +38 -8
  51. package/core/commands/generate-prd.md +38 -8
  52. package/core/commands/generate-spec-manifest.md +38 -8
  53. package/core/commands/generate-tech-docs.md +38 -8
  54. package/core/commands/learn.md +38 -8
  55. package/core/commands/propose-scenario.md +38 -8
  56. package/core/commands/qc-analyze.md +514 -0
  57. package/core/commands/qc-design-test.md +510 -0
  58. package/core/commands/qc-plan.md +492 -0
  59. package/core/commands/qc-report.md +491 -0
  60. package/core/commands/qc-review.md +496 -0
  61. package/core/commands/qc-run-test.md +538 -0
  62. package/core/commands/refine-prd.md +38 -8
  63. package/core/commands/report-bug.md +38 -8
  64. package/core/commands/review-code.md +38 -8
  65. package/core/commands/review-context.md +38 -8
  66. package/core/commands/review-tech-docs.md +38 -8
  67. package/core/commands/setup-ai-first.md +7 -0
  68. package/core/commands/sync.md +7 -0
  69. package/core/commands/update-framework.md +7 -0
  70. package/core/commands/validate-traces.md +54 -12
  71. package/core/modules/qc-playwright/stack-profile.yaml +65 -0
  72. package/core/skills/code/SKILL.md +45 -8
  73. package/core/skills/debug/SKILL.md +52 -8
  74. package/core/skills/design-spec/SKILL.md +38 -8
  75. package/core/skills/discovery/SKILL.md +38 -8
  76. package/core/skills/prd/SKILL.md +14 -0
  77. package/core/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  78. package/core/skills/qc/qa-analyst/acceptance-criteria.md +56 -0
  79. package/core/skills/qc/qa-analyst/business-rules.md +55 -0
  80. package/core/skills/qc/qa-analyst/data-flow.md +60 -0
  81. package/core/skills/qc/qa-analyst/spec-breakdown.md +57 -0
  82. package/core/skills/qc/qa-designer/e2e/journey.md +41 -0
  83. package/core/skills/qc/qa-designer/exploratory/charter.md +68 -0
  84. package/core/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  85. package/core/skills/qc/qa-designer/functional/api.md +45 -0
  86. package/core/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  87. package/core/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  88. package/core/skills/qc/qa-designer/integration/api.md +42 -0
  89. package/core/skills/qc/qa-designer/integration/db.md +39 -0
  90. package/core/skills/qc/qa-designer/integration/gui.md +40 -0
  91. package/core/skills/qc/qa-designer/integration/kafka.md +40 -0
  92. package/core/skills/qc/qa-designer/non-functional.md +40 -0
  93. package/core/skills/qc/qa-planner/test-plan.md +120 -0
  94. package/core/skills/qc/qa-reviewer/script/e2e.md +87 -0
  95. package/core/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  96. package/core/skills/qc/qa-reviewer/script/functional.md +101 -0
  97. package/core/skills/qc/qa-reviewer/script/integration.md +91 -0
  98. package/core/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  99. package/core/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  100. package/core/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  101. package/core/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  102. package/core/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  103. package/core/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  104. package/core/skills/qc/qa-runner/e2e.md +49 -0
  105. package/core/skills/qc/qa-runner/exploratory/session.md +36 -0
  106. package/core/skills/qc/qa-runner/functional/api.md +35 -0
  107. package/core/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  108. package/core/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  109. package/core/skills/qc/qa-runner/integration.md +47 -0
  110. package/core/skills/qc/qa-runner/non-functional.md +49 -0
  111. package/core/skills/qc/qa-runner/report/report.md +37 -0
  112. package/core/skills/setup-ai-first/SKILL.md +7 -0
  113. package/core/skills/spec/SKILL.md +14 -0
  114. package/core/skills/test/SKILL.md +83 -16
  115. package/core/steps/context-loader.md +31 -8
  116. package/core/steps/report-footer.md +7 -0
  117. package/core/templates/project-context.yaml +8 -0
  118. package/docs/01-getting-started/README.md +19 -0
  119. package/docs/01-getting-started/core-concepts.md +102 -0
  120. package/docs/01-getting-started/installation.md +154 -0
  121. package/docs/01-getting-started/quickstart.md +85 -0
  122. package/docs/02-guides/README.md +27 -0
  123. package/docs/02-guides/developer/README.md +46 -0
  124. package/docs/02-guides/developer/bdd-and-trace.md +123 -0
  125. package/docs/02-guides/developer/commands.md +76 -0
  126. package/docs/02-guides/developer/pr-checklist.md +15 -0
  127. package/docs/02-guides/developer/scenarios.md +448 -0
  128. package/docs/02-guides/developer/workflow.md +59 -0
  129. package/docs/02-guides/product-owner/README.md +77 -0
  130. package/docs/02-guides/product-owner/commands.md +30 -0
  131. package/docs/02-guides/product-owner/handoff-checklist.md +42 -0
  132. package/docs/02-guides/product-owner/prd-writing-rules.md +45 -0
  133. package/docs/02-guides/product-owner/scenarios.md +357 -0
  134. package/docs/02-guides/qc-automation.md +92 -0
  135. package/docs/02-guides/tester/README.md +72 -0
  136. package/docs/02-guides/tester/bug-reporting.md +117 -0
  137. package/docs/02-guides/tester/reading-specs.md +79 -0
  138. package/docs/02-guides/tester/scenarios.md +186 -0
  139. package/docs/02-guides/tester/spec-manifest.md +124 -0
  140. package/docs/02-guides/tester/test-checklist.md +31 -0
  141. package/docs/02-guides/tester/workflow.md +79 -0
  142. package/docs/03-concepts/README.md +19 -0
  143. package/docs/03-concepts/architecture.md +243 -0
  144. package/docs/03-concepts/pipeline.md +249 -0
  145. package/docs/03-concepts/traceability.md +148 -0
  146. package/docs/04-operations/README.md +33 -0
  147. package/docs/04-operations/bug-flow.md +321 -0
  148. package/docs/04-operations/publishing.md +137 -0
  149. package/docs/04-operations/sync-and-update.md +328 -0
  150. package/docs/05-reference/README.md +29 -0
  151. package/docs/05-reference/commands.md +229 -0
  152. package/docs/05-reference/modules.md +110 -0
  153. package/docs/05-reference/trace-schema.md +146 -0
  154. package/docs/README.md +51 -0
  155. package/modules/qc-playwright/stack-profile.yaml +65 -0
  156. package/package.json +2 -2
  157. package/skills/code/SKILL.md +45 -8
  158. package/skills/debug/SKILL.md +52 -8
  159. package/skills/design-spec/SKILL.md +38 -8
  160. package/skills/discovery/SKILL.md +38 -8
  161. package/skills/prd/SKILL.md +14 -0
  162. package/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  163. package/skills/qc/qa-analyst/acceptance-criteria.md +56 -0
  164. package/skills/qc/qa-analyst/business-rules.md +55 -0
  165. package/skills/qc/qa-analyst/data-flow.md +60 -0
  166. package/skills/qc/qa-analyst/spec-breakdown.md +57 -0
  167. package/skills/qc/qa-designer/e2e/journey.md +41 -0
  168. package/skills/qc/qa-designer/exploratory/charter.md +68 -0
  169. package/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  170. package/skills/qc/qa-designer/functional/api.md +45 -0
  171. package/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  172. package/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  173. package/skills/qc/qa-designer/integration/api.md +42 -0
  174. package/skills/qc/qa-designer/integration/db.md +39 -0
  175. package/skills/qc/qa-designer/integration/gui.md +40 -0
  176. package/skills/qc/qa-designer/integration/kafka.md +40 -0
  177. package/skills/qc/qa-designer/non-functional.md +40 -0
  178. package/skills/qc/qa-planner/test-plan.md +120 -0
  179. package/skills/qc/qa-reviewer/script/e2e.md +87 -0
  180. package/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  181. package/skills/qc/qa-reviewer/script/functional.md +101 -0
  182. package/skills/qc/qa-reviewer/script/integration.md +91 -0
  183. package/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  184. package/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  185. package/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  186. package/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  187. package/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  188. package/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  189. package/skills/qc/qa-runner/e2e.md +49 -0
  190. package/skills/qc/qa-runner/exploratory/session.md +36 -0
  191. package/skills/qc/qa-runner/functional/api.md +35 -0
  192. package/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  193. package/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  194. package/skills/qc/qa-runner/integration.md +47 -0
  195. package/skills/qc/qa-runner/non-functional.md +49 -0
  196. package/skills/qc/qa-runner/report/report.md +37 -0
  197. package/skills/setup-ai-first/SKILL.md +7 -0
  198. package/skills/spec/SKILL.md +14 -0
  199. package/skills/test/SKILL.md +83 -16
  200. package/steps/context-loader.md +31 -8
  201. package/steps/report-footer.md +7 -0
  202. package/templates/project-context.yaml +8 -0
  203. package/ARCHITECTURE.md +0 -258
@@ -0,0 +1,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)
@@ -0,0 +1,76 @@
1
+ [📚 Docs](../../README.md) › [Guides](../README.md) › [Developer](README.md) › Commands
2
+
3
+ # Commands Dành Cho Dev
4
+
5
+ | Command | Mục đích | Khi nào dùng |
6
+ |---|---|---|
7
+ | `/sync` `[spec-branch]` | **One-command setup hoặc update** — git pull + submodule sync + Living Docs refresh. Truyền branch để override branch spec submodule (vd `/sync develop`) | **Mỗi sáng trước khi bắt đầu work** |
8
+ | `/update-framework` | Nâng cấp **bản thân framework** (`.agent/commands/`, steps/, modules/) từ npm | Khi có version framework mới — không đụng project-context/CLAUDE.md |
9
+ | `/review-context {prd-file}` | Đọc + xác nhận PRD + BDD đủ rõ trước khi code — fan-out review dimension thành sub-agent song song + completeness-critic loop, findings file đầy đủ ngay trong 1 lần chạy | **Bước đầu tiên** khi nhận PRD mới |
10
+ | `/generate-tech-docs {prd-file}` | Sinh Tech Docs (API, DB schema, sequence diagram) | Sau khi đọc BDD từ spec submodule |
11
+ | `/generate-code {bdd-file}` | Sinh code — BE hoặc FE khi API đã sẵn sàng | Sau khi tech docs `approved` |
12
+ | `/generate-code {bdd-file} --phase=ui` | FE: gen UI + mock adapter (BE chưa ready) | Ngay sau khi đọc BDD |
13
+ | `/generate-code {bdd-file} --phase=integration` | FE: wire API thật thay mock | Sau khi sign-off gate `approved` |
14
+ | `/dev-gen-test {bdd-file}` | **Dev self-check** — sinh test cases từ BDD để dev tự verify code mình vừa gen (KHÔNG phải bộ test chính thức của QC/dev-team) | Song song hoặc sau generate-code |
15
+ | `/review-code {file}` | Review code theo 4 lens (Security/Perf/Arch/Test) | Trước khi tạo PR |
16
+ | `/review-tech-docs {tech-doc-file}` | Review chất lượng Tech Docs | Sau generate-tech-docs |
17
+ | `/dev-run-test` | **Dev self-check** — chạy test do dev tự gen để xác nhận code mình hoạt động (smoke/self-verify, KHÔNG phải coverage chính thức) — *umbrella mode: tự `cd` vào service_root, dùng service's `test_command`*. Ghi `dev_selftest` (pass/fail) vào trace TSV | Sau khi code + tests sẵn sàng |
18
+ | `/fix-bug {issue}` | Phân tích + fix bug có trace | Khi có bug report |
19
+ | `/debug {symptom}` | Debug vấn đề chưa rõ nguyên nhân | Khi cần trace root cause |
20
+ | `/dev-smoke-test` | **Dev self-check** — kiểm tra nhanh các luồng chính của code mình vừa làm (smoke, không thay thế bộ test chính thức) | Sau deploy hoặc merge lớn |
21
+ | `/validate-traces` | Kiểm tra toàn bộ trace chain còn hợp lệ | Sau refactor hoặc khi PRD update |
22
+ | `/learn {text}` | Ghi lại lỗi AI hay lặp thành guardrail | Khi AI lặp lại lỗi mà bạn không muốn nó tái diễn |
23
+
24
+ > **Dev self-check vs QC chính thức:** `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` (ghi `dev_selftest`) chỉ là **smoke self-check của riêng dev**. Bộ QC chính thức giờ là native pipeline `/qc-analyze → /qc-plan → /qc-design-test → /qc-review → /qc-run-test → /qc-report` — **do QC chạy, không phải việc của dev** — và ghi `qc_status` riêng. Chi tiết: [QC Automation Guide](../qc-automation.md).
25
+
26
+ > Danh mục đầy đủ mọi command: [Reference › Commands](../../05-reference/commands.md).
27
+
28
+ ## Project Lessons — dạy framework không lặp lỗi
29
+
30
+ AI đôi khi lặp đi lặp lại một lỗi trong dự án (vd: gọi repository thẳng từ controller, quên null-check). Thay vì sửa thủ công mỗi lần, **ghi lại thành "lesson"** — context-loader sẽ nạp nó vào đầu **mọi** lệnh như một ràng buộc cứng.
31
+
32
+ **2 cách ghi nhận:**
33
+ ```bash
34
+ # Cách 1 — chủ động
35
+ /learn AI hay gọi repository thẳng từ controller, phải đi qua service layer
36
+
37
+ # Cách 2 — tự động: khi /review-code, /fix-bug, /debug phát hiện lỗi lặp lại
38
+ # → nó hỏi "Record as a project lesson? (Y/N)" → Y
39
+ ```
40
+
41
+ **Lưu ở đâu:** `paths.lessons_file` (mặc định `specs/domain-knowledge/lessons-learned.md`; umbrella: `.agent/project-lessons.md` mỗi service). **Commit file này** để cả team cùng được bảo vệ.
42
+
43
+ > Đây là **bộ nhớ dự án**, không phải fine-tune model — lesson được nạp vào context mỗi lần chạy, nên AI "nhớ" và không lặp lại. Xem `[CTX LOADED]` có dòng `Lessons: loaded — N guardrails`.
44
+
45
+ ## Xử lý feedback từ tester
46
+
47
+ Tester gửi bug report (`/report-bug`) và đề xuất scenario (`/propose-scenario`) vào `feedback/` của **spec repo**. Khi dev chạy `/sync`, nó liệt kê:
48
+ ```
49
+ 📥 New tester feedback (pulled this sync):
50
+ Bug reports: BUG-20260608-01 FT-001 — ... [layer: Code]
51
+ Scenario proposals: FT-001-trailing-spaces → AC2 (pending review)
52
+ ```
53
+
54
+ Dev hành động theo phân loại:
55
+ - **Bug report** → `/fix-bug {BUG-ID}` (report đã có sẵn spec-context + AC bị vi phạm + layer)
56
+ - **Scenario proposal map vào AC sẵn có** → thêm scenario vào `.feature` (hoặc `/generate-bdd` lại), rồi `/generate-code` + `/dev-gen-test`
57
+ - **Proposal là yêu cầu mới (PRD change request)** → chuyển PO sửa PRD trước
58
+
59
+ > Bug reports có thể đến từ hai nguồn: Tester dùng `/report-bug` trực tiếp, **hoặc** từ kết quả QC automation (`qc_status: fail` trong `.trace/*.tsv` → tester chạy `/report-bug` → `/sync` → dev thấy tại đây). Cả hai đều dùng cùng luồng `/fix-bug`.
60
+
61
+ > Tester chỉ *đề xuất* trong `feedback/` — dev/PO mới đưa vào BDD chính thức. Giữ đúng ownership.
62
+
63
+ ## Khi nào dùng `--phase` cho FE/App?
64
+
65
+ | Tình huống | Command |
66
+ |---|---|
67
+ | API **đã có sẵn** và đang hoạt động | `/generate-code {file}` — không flag, gen real API ngay |
68
+ | BE **chưa ready**, FE muốn bắt đầu ngay | `/generate-code {file} --phase=ui` — UI + mock adapter |
69
+ | Sign-off gate xong, cần wire API thật | `/generate-code {file} --phase=integration` |
70
+ | BE implement (system BDD) | `/generate-code {file}` — không flag |
71
+
72
+ > `--phase` chỉ có giá trị khi BE chưa sẵn sàng. Nếu API đã live → bỏ qua `--phase`, chạy thẳng default.
73
+
74
+ ---
75
+
76
+ ← [Developer Guide](README.md) · Tiếp theo: [BDD & Trace System](bdd-and-trace.md)
@@ -0,0 +1,15 @@
1
+ [📚 Docs](../../README.md) › [Guides](../README.md) › [Developer](README.md) › PR Checklist
2
+
3
+ # Checklist Trước Khi Tạo PR
4
+
5
+ - [ ] `/validate-traces` → all green (không broken trace)
6
+ - [ ] `/dev-run-test` → all pass *(umbrella: đảm bảo service có `.agent/project-context.yaml` với `test_command` trước khi chạy)*
7
+ - [ ] `/review-code` → không có issue Critical hoặc Major chưa xử lý
8
+ - [ ] Code trace về đúng BDD scenarios trong `my-project-specs/specs/bdd/`
9
+ - [ ] Code có `@trace.bdd` comment cho các function implement BDD scenario
10
+ - [ ] Tech Docs đã được update nếu có thay đổi API/DB schema
11
+ - [ ] **Không tự sửa BDD** — BDD là của PO, nếu cần update thì báo PO rồi pull lại
12
+
13
+ ---
14
+
15
+ ← [Tình huống thực tế](scenarios.md)