@educa-corp/sdd-framework 0.5.0 → 0.7.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 (243) hide show
  1. package/bin/build.js +113 -19
  2. package/bin/gate-trace.js +487 -0
  3. package/bin/index.js +445 -146
  4. package/bin/lint-trace.js +643 -0
  5. package/bin/self-check.js +804 -2
  6. package/bin/trace-schema.json +621 -10
  7. package/core/FRAMEWORK_VERSION +1 -1
  8. package/core/README.md +20 -0
  9. package/core/commands/amend-prd.md +518 -0
  10. package/core/commands/debug.md +123 -511
  11. package/core/commands/define-product.md +86 -510
  12. package/core/commands/dev-gen-test.md +86 -510
  13. package/core/commands/dev-run-test.md +133 -519
  14. package/core/commands/dev-smoke-test.md +86 -510
  15. package/core/commands/extend-prd.md +128 -522
  16. package/core/commands/fix-bug.md +118 -509
  17. package/core/commands/generate-architecture.md +94 -515
  18. package/core/commands/generate-bdd.md +128 -513
  19. package/core/commands/generate-code.md +119 -510
  20. package/core/commands/generate-design-spec.md +86 -510
  21. package/core/commands/generate-prd.md +89 -510
  22. package/core/commands/generate-spec-manifest.md +86 -510
  23. package/core/commands/generate-tech-docs.md +120 -512
  24. package/core/commands/learn.md +172 -496
  25. package/core/commands/map-testids.md +86 -510
  26. package/core/commands/propose-scenario.md +86 -510
  27. package/core/commands/qc-analyze.md +86 -510
  28. package/core/commands/qc-design-test.md +86 -510
  29. package/core/commands/qc-plan.md +86 -510
  30. package/core/commands/qc-report.md +86 -510
  31. package/core/commands/qc-review.md +86 -510
  32. package/core/commands/qc-run-test.md +115 -513
  33. package/core/commands/refine-prd.md +112 -522
  34. package/core/commands/report-bug.md +86 -510
  35. package/core/commands/review-code.md +123 -511
  36. package/core/commands/review-context.md +136 -522
  37. package/core/commands/review-tech-docs.md +90 -511
  38. package/core/commands/setup-ai-first.md +166 -138
  39. package/core/commands/sync.md +155 -107
  40. package/core/commands/update-framework.md +16 -103
  41. package/core/commands/validate-traces.md +426 -511
  42. package/core/hooks/data-guard.js +174 -83
  43. package/core/hooks/settings.json +2 -1
  44. package/core/rules/workflow.md +64 -4
  45. package/core/steps/capture-lesson.md +34 -1
  46. package/core/steps/context-loader.md +50 -8
  47. package/core/steps/gate.md +92 -35
  48. package/core/steps/report-footer.md +23 -0
  49. package/core/templates/README.md +24 -1
  50. package/core/templates/ci/trace-gate.yml +146 -0
  51. package/core/templates/feature.template +1 -1
  52. package/core/templates/hooks/pre-push +61 -0
  53. package/docs/02-concepts/architecture.md +61 -6
  54. package/docs/02-concepts/traceability.md +57 -0
  55. package/docs/03-guides/architect.md +63 -0
  56. package/docs/04-reference/commands.md +148 -134
  57. package/docs/04-reference/model-selection.md +32 -19
  58. package/docs/04-reference/trace-schema.md +39 -0
  59. package/docs/explain/02b-extend-prd.md +1 -1
  60. package/docs/explain/02c-amend-prd.md +152 -0
  61. package/docs/explain/21-validate-traces.md +2 -1
  62. package/docs/explain/27-learn.md +5 -3
  63. package/docs/explain/28-sync.md +25 -0
  64. package/docs/explain/README.md +136 -135
  65. package/package.json +5 -9
  66. package/commands/debug.md +0 -917
  67. package/commands/debug.tmpl +0 -257
  68. package/commands/define-product.md +0 -862
  69. package/commands/define-product.tmpl +0 -225
  70. package/commands/dev-gen-test.md +0 -1124
  71. package/commands/dev-gen-test.tmpl +0 -490
  72. package/commands/dev-run-test.md +0 -859
  73. package/commands/dev-run-test.tmpl +0 -225
  74. package/commands/dev-smoke-test.md +0 -798
  75. package/commands/dev-smoke-test.tmpl +0 -217
  76. package/commands/extend-prd.md +0 -907
  77. package/commands/extend-prd.tmpl +0 -270
  78. package/commands/fix-bug.md +0 -910
  79. package/commands/fix-bug.tmpl +0 -197
  80. package/commands/generate-architecture.md +0 -775
  81. package/commands/generate-architecture.tmpl +0 -194
  82. package/commands/generate-bdd.md +0 -1347
  83. package/commands/generate-bdd.tmpl +0 -590
  84. package/commands/generate-code.md +0 -1283
  85. package/commands/generate-code.tmpl +0 -649
  86. package/commands/generate-design-spec.md +0 -1161
  87. package/commands/generate-design-spec.tmpl +0 -524
  88. package/commands/generate-prd.md +0 -1143
  89. package/commands/generate-prd.tmpl +0 -223
  90. package/commands/generate-spec-manifest.md +0 -745
  91. package/commands/generate-spec-manifest.tmpl +0 -164
  92. package/commands/generate-tech-docs.md +0 -1344
  93. package/commands/generate-tech-docs.tmpl +0 -273
  94. package/commands/learn.md +0 -723
  95. package/commands/learn.tmpl +0 -63
  96. package/commands/map-testids.md +0 -662
  97. package/commands/map-testids.tmpl +0 -81
  98. package/commands/propose-scenario.md +0 -783
  99. package/commands/propose-scenario.tmpl +0 -202
  100. package/commands/qc-analyze.md +0 -693
  101. package/commands/qc-analyze.tmpl +0 -112
  102. package/commands/qc-design-test.md +0 -650
  103. package/commands/qc-design-test.tmpl +0 -69
  104. package/commands/qc-plan.md +0 -630
  105. package/commands/qc-plan.tmpl +0 -49
  106. package/commands/qc-report.md +0 -641
  107. package/commands/qc-report.tmpl +0 -60
  108. package/commands/qc-review.md +0 -634
  109. package/commands/qc-review.tmpl +0 -53
  110. package/commands/qc-run-test.md +0 -750
  111. package/commands/qc-run-test.tmpl +0 -116
  112. package/commands/refine-prd.md +0 -1074
  113. package/commands/refine-prd.tmpl +0 -278
  114. package/commands/report-bug.md +0 -729
  115. package/commands/report-bug.tmpl +0 -148
  116. package/commands/review-code.md +0 -803
  117. package/commands/review-code.tmpl +0 -143
  118. package/commands/review-context.md +0 -1323
  119. package/commands/review-context.tmpl +0 -527
  120. package/commands/review-tech-docs.md +0 -982
  121. package/commands/review-tech-docs.tmpl +0 -401
  122. package/commands/setup-ai-first.md +0 -574
  123. package/commands/setup-ai-first.tmpl +0 -378
  124. package/commands/sync.md +0 -486
  125. package/commands/sync.tmpl +0 -384
  126. package/commands/update-framework.md +0 -290
  127. package/commands/update-framework.tmpl +0 -188
  128. package/commands/validate-traces.md +0 -1435
  129. package/commands/validate-traces.tmpl +0 -854
  130. package/hooks/data-guard.js +0 -141
  131. package/hooks/settings.json +0 -18
  132. package/modules/android-compose/module.yaml +0 -13
  133. package/modules/android-compose/stack-profile.yaml +0 -57
  134. package/modules/angular/architecture-snippets/component-patterns.md +0 -187
  135. package/modules/angular/module.yaml +0 -6
  136. package/modules/angular/stack-profile.yaml +0 -38
  137. package/modules/context-engineering/architecture-snippets/context-design.md +0 -119
  138. package/modules/context-engineering/module.yaml +0 -9
  139. package/modules/context-engineering/stack-profile.yaml +0 -61
  140. package/modules/dotnet/architecture-snippets/clean-arch.md +0 -160
  141. package/modules/dotnet/module.yaml +0 -6
  142. package/modules/dotnet/stack-profile.yaml +0 -50
  143. package/modules/flutter/module.yaml +0 -14
  144. package/modules/flutter/stack-profile.yaml +0 -59
  145. package/modules/golang/architecture-snippets/domain-layout.md +0 -283
  146. package/modules/golang/module.yaml +0 -6
  147. package/modules/golang/stack-profile.yaml +0 -40
  148. package/modules/ios-swiftui/module.yaml +0 -13
  149. package/modules/ios-swiftui/stack-profile.yaml +0 -55
  150. package/modules/java-spring/architecture-snippets/layered-arch.md +0 -201
  151. package/modules/java-spring/module.yaml +0 -15
  152. package/modules/java-spring/stack-profile.yaml +0 -28
  153. package/modules/nextjs/architecture-snippets/app-router-patterns.md +0 -269
  154. package/modules/nextjs/module.yaml +0 -14
  155. package/modules/nextjs/stack-profile.yaml +0 -74
  156. package/modules/nuxt/module.yaml +0 -14
  157. package/modules/nuxt/stack-profile.yaml +0 -58
  158. package/modules/phaser-game/architecture-snippets/phaser-scene-patterns.md +0 -646
  159. package/modules/phaser-game/module.yaml +0 -15
  160. package/modules/phaser-game/stack-profile.yaml +0 -90
  161. package/modules/php-laravel/architecture-snippets/service-repository.md +0 -302
  162. package/modules/php-laravel/module.yaml +0 -15
  163. package/modules/php-laravel/stack-profile.yaml +0 -56
  164. package/modules/qc-playwright/stack-profile.yaml +0 -66
  165. package/modules/react/architecture-snippets/hooks-query-patterns.md +0 -254
  166. package/modules/react/module.yaml +0 -14
  167. package/modules/react/stack-profile.yaml +0 -63
  168. package/modules/react-native/module.yaml +0 -14
  169. package/modules/react-native/stack-profile.yaml +0 -56
  170. package/modules/vue/module.yaml +0 -14
  171. package/modules/vue/stack-profile.yaml +0 -65
  172. package/rules/data-protection.md +0 -80
  173. package/rules/workflow.md +0 -73
  174. package/scripts/init.sh +0 -49
  175. package/scripts/upgrade.sh +0 -94
  176. package/skills/code/SKILL.md +0 -19
  177. package/skills/code/SKILL.tmpl +0 -19
  178. package/skills/debug/SKILL.md +0 -19
  179. package/skills/debug/SKILL.tmpl +0 -19
  180. package/skills/design-spec/SKILL.md +0 -11
  181. package/skills/design-spec/SKILL.tmpl +0 -11
  182. package/skills/discovery/SKILL.md +0 -14
  183. package/skills/discovery/SKILL.tmpl +0 -14
  184. package/skills/prd/SKILL.md +0 -19
  185. package/skills/prd/SKILL.tmpl +0 -19
  186. package/skills/qc/qa-analyst/DOC_GAPS.template.md +0 -63
  187. package/skills/qc/qa-analyst/acceptance-criteria.md +0 -60
  188. package/skills/qc/qa-analyst/business-rules.md +0 -59
  189. package/skills/qc/qa-analyst/data-flow.md +0 -64
  190. package/skills/qc/qa-analyst/spec-breakdown.md +0 -61
  191. package/skills/qc/qa-designer/e2e/journey.md +0 -41
  192. package/skills/qc/qa-designer/exploratory/charter.md +0 -68
  193. package/skills/qc/qa-designer/exploratory/explore-to-functional.md +0 -43
  194. package/skills/qc/qa-designer/functional/api.md +0 -45
  195. package/skills/qc/qa-designer/functional/gui-feature.md +0 -46
  196. package/skills/qc/qa-designer/functional/gui-screen.md +0 -52
  197. package/skills/qc/qa-designer/integration/api.md +0 -42
  198. package/skills/qc/qa-designer/integration/db.md +0 -39
  199. package/skills/qc/qa-designer/integration/gui.md +0 -40
  200. package/skills/qc/qa-designer/integration/kafka.md +0 -40
  201. package/skills/qc/qa-designer/non-functional.md +0 -40
  202. package/skills/qc/qa-planner/test-plan.md +0 -120
  203. package/skills/qc/qa-reviewer/script/e2e.md +0 -87
  204. package/skills/qc/qa-reviewer/script/exploratory.md +0 -45
  205. package/skills/qc/qa-reviewer/script/functional.md +0 -101
  206. package/skills/qc/qa-reviewer/script/integration.md +0 -91
  207. package/skills/qc/qa-reviewer/script/non-functional.md +0 -126
  208. package/skills/qc/qa-reviewer/test-case/e2e.md +0 -73
  209. package/skills/qc/qa-reviewer/test-case/exploratory.md +0 -43
  210. package/skills/qc/qa-reviewer/test-case/functional.md +0 -76
  211. package/skills/qc/qa-reviewer/test-case/integration.md +0 -69
  212. package/skills/qc/qa-reviewer/test-case/non-functional.md +0 -73
  213. package/skills/qc/qa-runner/e2e.md +0 -49
  214. package/skills/qc/qa-runner/exploratory/session.md +0 -36
  215. package/skills/qc/qa-runner/functional/api.md +0 -35
  216. package/skills/qc/qa-runner/functional/gui-feature.md +0 -51
  217. package/skills/qc/qa-runner/functional/gui-screen.md +0 -55
  218. package/skills/qc/qa-runner/integration.md +0 -47
  219. package/skills/qc/qa-runner/non-functional.md +0 -49
  220. package/skills/qc/qa-runner/report/report.md +0 -37
  221. package/skills/setup-ai-first/SKILL.md +0 -19
  222. package/skills/setup-ai-first/SKILL.tmpl +0 -19
  223. package/skills/spec/SKILL.md +0 -19
  224. package/skills/spec/SKILL.tmpl +0 -19
  225. package/skills/test/SKILL.md +0 -18
  226. package/skills/test/SKILL.tmpl +0 -18
  227. package/steps/business-language.md +0 -56
  228. package/steps/capture-lesson.md +0 -79
  229. package/steps/context-loader.md +0 -385
  230. package/steps/gate.md +0 -94
  231. package/steps/report-footer.md +0 -102
  232. package/steps/review-fanout.md +0 -159
  233. package/steps/spawn-agent.md +0 -129
  234. package/steps/trace-mirror.md +0 -53
  235. package/templates/README.md +0 -47
  236. package/templates/architecture.template.md +0 -394
  237. package/templates/design-spec.template.md +0 -217
  238. package/templates/feature.template +0 -123
  239. package/templates/platform-guide.template.md +0 -145
  240. package/templates/prd.template.md +0 -283
  241. package/templates/product-definition.template.md +0 -188
  242. package/templates/project-context.yaml +0 -212
  243. package/templates/tech-design.template.md +0 -490
@@ -1,378 +0,0 @@
1
- # /setup-ai-first — Khởi tạo SDD Framework trong một dự án
2
-
3
- Dẫn người dùng qua một setup một-lần tạo mọi thư mục cần thiết, cài CLAUDE.md, và verify môi trường.
4
-
5
- ## Gate
6
- {{include:steps/gate.md}}
7
-
8
- *Lưu ý: Với lệnh này — **bỏ qua Gate Step 1, 2, và 3** (chưa có file input và chưa có project context). Chỉ chạy Step 0-B (model check). Project root là **thư mục làm việc hiện tại**. Đi thẳng tới Precondition Check bên dưới.*
9
-
10
- ---
11
-
12
- ## Precondition Check
13
-
14
- Kiểm tra đã setup chưa:
15
- - Nếu cả `CLAUDE.md` **và** `.agent/project-context.yaml` đều tồn tại → hỏi: "Dự án này đã được khởi tạo. Chạy lại setup để regenerate file config? (Y/N)"
16
- - N → dừng
17
- - Y → tiếp tục (file có sẵn được giữ — mỗi bước sẽ đề nghị merge/skip)
18
- - Nếu chỉ có `specs/` hoặc phát hiện setup một phần → tiếp tục bình thường (an toàn chạy lại)
19
-
20
- ## Step 0.5 — Loại dự án
21
-
22
- Hỏi người dùng:
23
-
24
- ```
25
- Dự án này thuộc loại nào?
26
- 1. Single-service — một codebase, một platform (setup chuẩn)
27
- 2. Umbrella repo — repo này chứa nhiều service submodule (microservices / multi-app)
28
- 3. PO Spec repo — chỉ docs, không có code chạy được (chỉ PRD + design-spec)
29
- ```
30
-
31
- Lưu câu trả lời thành `project_type`. Mặc định `1` nếu user không trả lời.
32
-
33
- Dựa trên câu trả lời:
34
-
35
- **project_type = 1 (Single-service):** Tiếp tục setup chuẩn bên dưới.
36
-
37
- **project_type = 2 (Umbrella):** Hỏi các câu follow-up:
38
- - "Path tới spec submodule (vd `free-trial-spec`)? Nhấn Enter để skip."
39
- - "Một business-domain được triển khai trên NHIỀU platform (BE + Web + App) không? (Y/N)"
40
- - **N → dạng phẳng (FORM A):** "Liệt kê service dạng cặp `domain:module`, ngăn cách bởi dấu phẩy
41
- (vd `user:java-spring,order:java-spring`). Nhấn Enter để skip."
42
- - **Y → dạng map-theo-platform (FORM B):** "Liệt kê dạng bộ ba `domain:platform:module`
43
- (platform ∈ system|web|app), ngăn cách bởi dấu phẩy — lặp lại domain cho từng platform
44
- (vd `onboarding:system:java-spring,onboarding:web:nextjs,onboarding:app:flutter`). Nhấn Enter để skip."
45
- context-loader route theo `@trace.platform` của target `.feature` → chọn đúng submodule.
46
- **Giữ `@trace.domain` là business-domain** (KHÔNG bịa `onboarding-web`).
47
- - "Có ô định tuyến nào ứng với NHIỀU repo không — tức cùng một domain (và cùng platform,
48
- nếu có) nhưng mỗi feature nằm ở một repo riêng? (vd mỗi mini-game webview một repo) (Y/N)"
49
- - **Y → dạng map-theo-prd_slug (FORM C):** "Liệt kê dạng `domain:platform:prd-slug:module`
50
- — bỏ trống đoạn platform nếu domain không chia platform (`domain::prd-slug:module`) —
51
- ngăn cách bởi dấu phẩy (vd
52
- `learning:webview:dap-chuot:phaser-game,learning:webview:ban-cung:phaser-game`).
53
- Nhấn Enter để skip."
54
- `prd-slug` là **tên thư mục feature-package** dưới `specs/{domain}/`, phải khớp chính xác.
55
- context-loader tra `@trace.platform` rồi tra tiếp `prd_slug` → chọn đúng repo.
56
- Không khớp slug nào thì lệnh DỪNG (`unresolved`) chứ không đoán repo gần giống.
57
-
58
- Rồi:
59
- - Skip tạo bất kỳ artifact `specs/` nào (mọi spec — PRD, BDD, tech-docs, design-spec — sống trong spec submodule theo bố cục feature-package `specs/{domain}/{prd-slug}/`)
60
- - Chỉ tạo: `.trace/`, `.agent/review/` ở cấp umbrella
61
- *(Trừ khi user yêu cầu rõ tạo cấu trúc đầy đủ)*
62
- - Sinh `.agent/project-context.yaml` ở umbrella mode với services (FORM A, B hoặc C — trộn được trong cùng một file) và spec_source đã cung cấp.
63
- **Sau khi sinh, MỞ file kiểm tra:** mỗi `services.{domain}.path` (hoặc `.{platform}.path`, hoặc `.by_prd_slug.{slug}.path`) phải trỏ **đúng tên thư mục submodule thật** — generator để placeholder `TODO-…` vì tên dir thường khác tên domain. Sửa cho khớp trước khi chạy lệnh generate.
64
- - Skip tạo `CLAUDE.md` root (umbrella không có một tech stack đơn) — nhưng nhắc mỗi submodule code cần overlay `{path}/CLAUDE.md` riêng (thiếu thì code-gen fallback về default + cờ ⚠️, có thể sai coding-standards).
65
- - Sau setup, nhắc: "Mở từng service submodule riêng trong Claude Code để cài framework/overlay ở đó nếu cần."
66
-
67
- **project_type = 3 (PO Spec repo):**
68
- - Tạo base dir: `specs/product-definition/`, `specs/domain-knowledge/`, `feedback/`, `.agent/review/`
69
- - Artifact theo từng feature (`specs/{domain}/{prd-slug}/{ {TICKET-ID}-{prd-slug}.md, bdd/, tech-docs/, design-spec/}`) được tạo on demand bởi các lệnh generate — ĐỪNG tạo trước
70
- - Skip: `.trace/` (theo service, sống cạnh code trong mỗi service submodule)
71
- - Sinh `CLAUDE.md` tối thiểu chỉ với §1 (project overview) và §7 (git conventions)
72
- - Hỏi người dùng: **"Liệt kê các business domain của bạn (vd auth, payment, loyalty):"** — lưu thành domain list cho `project-context.yaml` và nhắc PO các tên này phải được dùng nhất quán ở row `| **Domain** |` của bảng Metadata trong mọi PRD
73
- - Thông báo:
74
- - Lệnh cho PO repo: `/define-product`, `/generate-prd`, `/review-context`, `/generate-design-spec`
75
- - **Quan trọng cho handoff team dev:** Mọi PRD phải có row `| **Domain** | {domain} |` trong **bảng Metadata**. Team dev dùng nó để route BDD/code sinh ra tới đúng service submodule. Tên domain không nhất quán sẽ phá routing.
76
- - Bảng Metadata PRD (do `/generate-prd` điền sẵn theo template):
77
- ```
78
- | **Domain** | {domain} | ← phải khớp một key trong services config của team dev
79
- | **Ticket** | {TICKET-ID} |
80
- | **Status** | draft | approved |
81
- ```
82
-
83
- ## Step 1 — Tạo cấu trúc thư mục
84
-
85
- Tạo các thư mục này (skip nếu đã tồn tại):
86
-
87
- ```
88
- {project-root}/
89
- ├── specs/
90
- │ ├── product-definition/ ← Output của /define-product
91
- │ └── domain-knowledge/ ← business dictionary & domain context
92
- ├── .trace/ ← .trace/{domain}/{prd-slug}/{UC-ID}-{platform}.tsv
93
- └── .agent/
94
- └── review/
95
- ```
96
-
97
- **Bố cục feature-package** — artifact spec theo từng feature KHÔNG được tạo trước. Mỗi lệnh generate
98
- tự tạo folder của nó on demand dưới `specs/{domain}/{prd-slug}/`:
99
-
100
- ```
101
- specs/{domain}/{prd-slug}/
102
- ├── {TICKET-ID}-{prd-slug}.md ← /generate-prd (vd SEG01-segment-scoring-service.md)
103
- ├── bdd/ ← /generate-bdd (file .feature)
104
- ├── tech-docs/ ← /generate-tech-docs
105
- └── design-spec/ ← /generate-design-spec (chỉ platform FE/App)
106
- ```
107
-
108
- *Tạo base dir nào tuỳ theo `project_type` set ở Step 0.5:*
109
-
110
- | project_type | Tạo | Skip |
111
- |---|---|---|
112
- | **1 — Single-service** | Cấu trúc base ở trên (`specs/product-definition/`, `specs/domain-knowledge/`, `.trace/`, `.agent/review/`) | folder theo feature (tạo on demand) |
113
- | **2 — Umbrella** | Chỉ `.trace/` + `.agent/review/` (ở umbrella root) | Mọi thứ khác — **toàn bộ spec sống trong spec submodule (`spec_source`)** dưới `specs/{domain}/{prd-slug}/`; service submodule chỉ chứa **code + `.trace/`** |
114
- | **3 — PO Spec repo** | `specs/product-definition/`, `specs/domain-knowledge/`, **`feedback/`**, `.agent/review/` (folder `specs/{domain}/{prd-slug}/` theo feature tạo on demand) | `.trace/` (theo service, sống cạnh code trong mỗi service submodule) |
115
-
116
- ## Step 2 — Tạo CLAUDE.md
117
-
118
- *Bỏ qua hoàn toàn step này nếu `project_type = 2` (Umbrella) — umbrella không có một tech stack đơn.*
119
- *Với `project_type = 3` (PO Spec repo) — tạo CLAUDE.md tối thiểu chỉ với §1 (project overview) và §7 (git conventions). Skip §2–§6.*
120
-
121
- Kiểm tra `CLAUDE.md` tồn tại chưa:
122
- - Có → hỏi "Merge template hay skip?"
123
- - Không → tạo từ template bên dưới
124
-
125
- Sau khi tạo, hướng dẫn: "Mở CLAUDE.md và điền các giá trị `{{PLACEHOLDER}}` bằng thông tin dự án của bạn."
126
-
127
- ### CLAUDE.md Template
128
-
129
- ```
130
- # §1. Project Overview
131
- Project: {{PROJECT_NAME}}
132
- Language: {{LANGUAGE}}
133
- Framework: {{FRAMEWORK}}
134
- Build: {{BUILD_COMMAND}}
135
- Test: {{TEST_COMMAND}}
136
- Domains: {{COMMA_SEPARATED_DOMAINS}}
137
-
138
- # §2. Architecture
139
- layers: "{{LAYER_STACK}}"
140
- # Example: Controller → Facade → Service → Repository
141
- rules:
142
- - "Controllers must not contain business logic"
143
- - "Services own transaction boundaries"
144
-
145
- # §3. Coding Standards
146
- naming:
147
- classes: "{{NAMING_CONVENTION}}"
148
- methods: "{{METHOD_CONVENTION}}"
149
- response_wrapper: "{{WRAPPER}}"
150
- forbidden:
151
- - "Magic numbers"
152
- - "Debug print statements"
153
-
154
- # §4. Traceability
155
- # Every entry-point method must carry the FULL block (repeat it per UC in a
156
- # multi-UC file — the version tags are per-UC scalars, never merge them):
157
- # @trace.implements={UC-ID}-SC{N}
158
- # @trace.prd_version={PRD version} / @trace.bdd_version={BDD version} / @trace.tech_doc_revision={n}
159
- # @trace.source=specs/{domain}/{prd-slug}/bdd/{platform}/{UC-ID}-{slug}.feature
160
- # ({platform} = web|app|system · adjust the root if specs_dir differs in .agent/project-context.yaml)
161
- # Tests must be tagged:
162
- # @trace.verifies={UC-ID}-SC{N}
163
-
164
- # §5. Error Handling
165
- not_found: "{{NOT_FOUND_EXCEPTION}}"
166
- http_codes: { get: 200, create: 201, not_found: 404, validation: 400 }
167
-
168
- # §6. Build & Test
169
- build_command: "{{BUILD_COMMAND}}"
170
- test_command: "{{TEST_COMMAND}}"
171
- run_command: "{{RUN_COMMAND}}"
172
-
173
- # §7. Git Conventions
174
- branch_feature: "feature/{{TICKET_PREFIX}}-{N}-{slug}"
175
- commit_feature: "feat({{TICKET_PREFIX}}-{N}): {description}"
176
- ```
177
-
178
- ## Step 3 — Tạo project-context.yaml
179
-
180
- *Với `project_type = 2` (Umbrella):*
181
- - *Nếu `.agent/project-context.yaml` đã được sinh bởi `--init --umbrella` → mở nó và verify/sửa section `services` (domain key, path, module). Skip copy template bên dưới.*
182
- - *Nếu chưa sinh → hỏi: "Path spec submodule?" và "Services (cặp domain:module)?" rồi sinh config umbrella (xem Step 0.5 cho format).*
183
-
184
- Tạo `.agent/project-context.yaml` dùng `.agent/templates/project-context.yaml` làm template nguồn.
185
-
186
- Copy template và hướng dẫn: "Mở `.agent/project-context.yaml` và điền mọi giá trị `{{PLACEHOLDER}}`. Section `paths` đã được cấu hình sẵn với default hợp lý — chỉnh nếu dự án dùng tên thư mục khác."
187
-
188
- ## Step 4 — Tạo business-dictionary.md
189
-
190
- *Skip Step 4 và 5 nếu `project_type = 2` (Umbrella) — business dictionary và core entities sống trong spec submodule và do team PO quản lý. Team dev đọc chúng từ `{spec_source}/specs/domain-knowledge/`.*
191
-
192
-
193
- Tạo `specs/domain-knowledge/business-dictionary.md` nếu chưa tồn tại:
194
-
195
- ```markdown
196
- # Business Dictionary — {{PROJECT_NAME}}
197
-
198
- > Thuật ngữ chuẩn cho dự án này. Mọi PRD, BDD spec, và code phải theo các thuật ngữ này.
199
- > Managed by: PO / SA team.
200
-
201
- ## Canonical Terms
202
-
203
- | Canonical Term | Description / Context |
204
- |----------------|----------------------|
205
- | {Term} | {Short description, usage scope} |
206
-
207
- ## Banned Terms
208
-
209
- | ❌ Do NOT use | ✅ Use instead | Reason |
210
- |---------------|-------------------|--------|
211
- | {banned} | {canonical} | {why} |
212
-
213
- ## Status / Enum Registry
214
-
215
- | Entity | Field | Allowed Values |
216
- |--------|---------|--------------------|
217
- | {Entity} | status | {value1, value2} |
218
- ```
219
-
220
- Hướng dẫn: "Mở `specs/domain-knowledge/business-dictionary.md` và thêm thuật ngữ dự án của bạn. File này sẽ được mọi lệnh đọc để enforce naming nhất quán."
221
-
222
- ## Step 5 — Tạo core-entities.md
223
-
224
- Tạo `specs/domain-knowledge/core-entities.md` nếu chưa tồn tại:
225
-
226
- ```markdown
227
- # Core Entities — {{PROJECT_NAME}}
228
-
229
- > Glossary entity máy-đọc-được cho phát triển có AI hỗ trợ.
230
- > Được mọi lệnh nạp để AI biết domain model của bạn mà không cần đọc source code.
231
- > Managed by: Tech Lead / Architect.
232
- >
233
- > HOW TO USE:
234
- > - Add one `## Entity: {Name}` section per domain entity (aggregate root, value object, etc.)
235
- > - Keep field descriptions concise — this is a REFERENCE, not API docs
236
- > - Update this file whenever you add/rename fields or change business invariants
237
-
238
- ---
239
-
240
- ## Entity: {EntityName}
241
-
242
- **Purpose**: {1-2 sentences — what this entity represents and why it exists in the domain}
243
- **Domain**: {domain}
244
- **Storage**: {e.g., `orders` table in PostgreSQL | `orders` collection in MongoDB}
245
- **Owner service**: {service/module that owns this entity}
246
-
247
- | Field | Type | Nullable | Description |
248
- |--------------|---------|----------|-------------------------------------|
249
- | id | UUID | No | Primary key |
250
- | {field_name} | {type} | Yes/No | {short description} |
251
- | status | Enum | No | See Status Registry in business-dictionary.md |
252
-
253
- **Business invariants:**
254
- - {Rule 1: e.g., "status can only transition: PENDING → ACTIVE → CLOSED"}
255
- - {Rule 2: e.g., "total must equal sum of line items"}
256
-
257
- **Relationships:**
258
- - `{EntityA}` 1:N `{EntityB}` — {one sentence description}
259
- - `{EntityA}` N:N `{EntityC}` via `{junction_table}` — {description}
260
-
261
- ---
262
-
263
- ## Entity: {AnotherEntity}
264
-
265
- *(Add more entities following the same pattern above)*
266
- ```
267
-
268
- Hướng dẫn: "Mở `specs/domain-knowledge/core-entities.md` và định nghĩa các domain entity chính. Bắt đầu với aggregate root. File này được mọi lệnh AI nạp — định nghĩa tốt ở đây tiết kiệm đáng kể qua-lại khi sinh code."
269
-
270
- ## Step 6 — Cài VS Code Extension (Khuyến nghị)
271
-
272
- Khuyến nghị user cài extension VS Code **Spec Driven Docs Tools** — nó cung cấp panel Review Board + Living Documentation tích hợp với workflow này.
273
-
274
- ```bash
275
- code --install-extension SpecDrivenDocsTools.spec-driven-docs-tool
276
- ```
277
-
278
- Hoặc: VS Code → `Ctrl+Shift+P` → **"Extensions: Install from Marketplace"** → tìm **Spec Driven Docs Tools**.
279
-
280
- **Nó làm gì:**
281
- - 📋 **Review Board** — UI trực quan để review findings từ `/refine-prd`, `/review-context`, `/review-tech-docs`
282
- - 📊 **Living Documentation** — dashboard traceability dựa trên `.trace/*.tsv`
283
-
284
- ## Step 7 — Verify
285
-
286
- Checklist tuỳ theo `project_type`:
287
-
288
- **project_type = 1 (Single-service):**
289
- - [ ] `specs/` tồn tại
290
- - [ ] `specs/product-definition/` tồn tại
291
- - [ ] `specs/domain-knowledge/` tồn tại
292
- - [ ] `.trace/` tồn tại
293
- *(folder `specs/{domain}/{prd-slug}/` theo feature tạo on demand — không check ở đây)*
294
- - [ ] `.agent/project-context.yaml` tồn tại
295
- - [ ] `CLAUDE.md` tồn tại
296
- - [ ] `specs/domain-knowledge/business-dictionary.md` tồn tại
297
- - [ ] `specs/domain-knowledge/core-entities.md` tồn tại
298
-
299
- **project_type = 2 (Umbrella):**
300
- - [ ] `.agent/project-context.yaml` tồn tại với `setup.mode: umbrella`
301
- - [ ] Section `services` có ít nhất một entry với đúng domain key
302
- - [ ] Path `spec_source` tồn tại (vd thư mục `my-project-specs/` có mặt)
303
- - [ ] `.agent/review/` tồn tại
304
- - [ ] Spec submodule đã init: `git submodule status` không hiện prefix `-`
305
-
306
- **project_type = 3 (PO Spec repo):**
307
- - [ ] `specs/product-definition/` tồn tại
308
- - [ ] `specs/domain-knowledge/` tồn tại
309
- - [ ] `feedback/` tồn tại
310
- *(folder `specs/{domain}/{prd-slug}/` theo feature tạo on demand — không check ở đây)*
311
- - [ ] `.agent/review/` tồn tại
312
- - [ ] `.agent/project-context.yaml` tồn tại
313
- - [ ] `CLAUDE.md` tồn tại (tối thiểu)
314
- - [ ] `specs/domain-knowledge/business-dictionary.md` tồn tại
315
- - [ ] `specs/domain-knowledge/core-entities.md` tồn tại
316
-
317
- ## Output
318
-
319
- {{include:steps/report-footer.md}}
320
-
321
- ```
322
- /setup-ai-first Hoàn tất ✅
323
- ```
324
-
325
- Output tuỳ theo `project_type`:
326
-
327
- **Single-service:**
328
- ```
329
- Next:
330
- 1. Điền CLAUDE.md (thay các giá trị {{PLACEHOLDER}})
331
- 2. Điền .agent/project-context.yaml
332
- 3. Điền specs/domain-knowledge/business-dictionary.md
333
- 4. Điền specs/domain-knowledge/core-entities.md
334
- 5. git add và commit 4 file đó
335
- 6. Cài VS Code extension:
336
- code --install-extension SpecDrivenDocsTools.spec-driven-docs-tool
337
- 7. /define-product để bắt đầu feature đầu tiên
338
- ```
339
-
340
- **Umbrella:**
341
- ```
342
- Next:
343
- 1. Review .agent/project-context.yaml:
344
- - Cập nhật services[].path khớp tên thư mục submodule thực tế
345
- - Cập nhật domain key của services khớp row `Domain` (bảng Metadata) trong các file PRD
346
- - Xác nhận path spec_source đúng
347
-
348
- 2. Chạy /sync — một lệnh lo mọi thứ còn lại:
349
- /sync
350
- → git pull + submodule init + spec submodule update
351
- → Tự tạo .agent/project-context.yaml cho mỗi service submodule
352
- (phát hiện module từ pom.xml / go.mod / package.json / pubspec.yaml v.v.)
353
- → Sync Living Docs panel
354
- → Refresh spec-manifest.yaml
355
-
356
- 3. Bắt đầu sinh:
357
- /generate-bdd {spec_source}/specs/{domain}/{prd-slug}/{TICKET-ID}-{prd-slug}.md
358
- ```
359
-
360
- **PO Spec repo:**
361
- ```
362
- Next:
363
- 1. Điền .agent/project-context.yaml:
364
- - domains: [liệt kê mọi business domain — chúng thành row `Domain` (bảng Metadata) trong PRD]
365
- - project.name, project.description
366
- 2. Điền specs/domain-knowledge/business-dictionary.md ← canonical terms
367
- 3. Điền specs/domain-knowledge/core-entities.md ← entity glossary
368
- 4. git add và commit các file đó
369
- 5. Cài VS Code extension:
370
- code --install-extension SpecDrivenDocsTools.spec-driven-docs-tool
371
- 6. /define-product để bắt đầu feature đầu tiên
372
-
373
- ⚠️ Nhắc handoff team dev:
374
- - Mỗi PRD phải có row `Domain` (bảng Metadata) khớp một trong domains list của bạn
375
- - Khi team dev setup umbrella repo của họ, họ map các tên domain này
376
- tới path service submodule trong section services của project-context.yaml
377
- - Chia sẻ tên domain với team dev trước khi họ cấu hình umbrella
378
- ```