@edupia-tutor/spec-driven-docs 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 (339) hide show
  1. package/bin/build.js +230 -0
  2. package/bin/index.js +598 -0
  3. package/commands/debug.md +830 -0
  4. package/commands/debug.tmpl +257 -0
  5. package/commands/define-product.md +652 -0
  6. package/commands/define-product.tmpl +158 -0
  7. package/commands/dev-gen-test.md +1010 -0
  8. package/commands/dev-gen-test.tmpl +490 -0
  9. package/commands/dev-run-test.md +744 -0
  10. package/commands/dev-run-test.tmpl +224 -0
  11. package/commands/dev-smoke-test.md +711 -0
  12. package/commands/dev-smoke-test.tmpl +217 -0
  13. package/commands/fix-bug.md +744 -0
  14. package/commands/fix-bug.tmpl +171 -0
  15. package/commands/generate-bdd.md +1054 -0
  16. package/commands/generate-bdd.tmpl +534 -0
  17. package/commands/generate-code.md +869 -0
  18. package/commands/generate-code.tmpl +349 -0
  19. package/commands/generate-design-spec.md +958 -0
  20. package/commands/generate-design-spec.tmpl +464 -0
  21. package/commands/generate-prd.md +748 -0
  22. package/commands/generate-prd.tmpl +254 -0
  23. package/commands/generate-spec-manifest.md +658 -0
  24. package/commands/generate-spec-manifest.tmpl +164 -0
  25. package/commands/generate-tech-docs.md +849 -0
  26. package/commands/generate-tech-docs.tmpl +355 -0
  27. package/commands/learn.md +636 -0
  28. package/commands/learn.tmpl +63 -0
  29. package/commands/map-testids.md +575 -0
  30. package/commands/map-testids.tmpl +81 -0
  31. package/commands/propose-scenario.md +623 -0
  32. package/commands/propose-scenario.tmpl +129 -0
  33. package/commands/qc-analyze.md +580 -0
  34. package/commands/qc-analyze.tmpl +86 -0
  35. package/commands/qc-design-test.md +562 -0
  36. package/commands/qc-design-test.tmpl +68 -0
  37. package/commands/qc-plan.md +543 -0
  38. package/commands/qc-plan.tmpl +49 -0
  39. package/commands/qc-report.md +554 -0
  40. package/commands/qc-report.tmpl +60 -0
  41. package/commands/qc-review.md +547 -0
  42. package/commands/qc-review.tmpl +53 -0
  43. package/commands/qc-run-test.md +604 -0
  44. package/commands/qc-run-test.tmpl +84 -0
  45. package/commands/refine-prd.md +772 -0
  46. package/commands/refine-prd.tmpl +140 -0
  47. package/commands/report-bug.md +639 -0
  48. package/commands/report-bug.tmpl +145 -0
  49. package/commands/review-code.md +677 -0
  50. package/commands/review-code.tmpl +104 -0
  51. package/commands/review-context.md +1047 -0
  52. package/commands/review-context.tmpl +415 -0
  53. package/commands/review-tech-docs.md +811 -0
  54. package/commands/review-tech-docs.tmpl +317 -0
  55. package/commands/setup-ai-first.md +545 -0
  56. package/commands/setup-ai-first.tmpl +358 -0
  57. package/commands/sync.md +451 -0
  58. package/commands/sync.tmpl +351 -0
  59. package/commands/update-framework.md +251 -0
  60. package/commands/update-framework.tmpl +151 -0
  61. package/commands/validate-traces.md +842 -0
  62. package/commands/validate-traces.tmpl +348 -0
  63. package/core/FRAMEWORK_VERSION +1 -0
  64. package/core/commands/debug.md +830 -0
  65. package/core/commands/define-product.md +652 -0
  66. package/core/commands/dev-gen-test.md +1010 -0
  67. package/core/commands/dev-run-test.md +744 -0
  68. package/core/commands/dev-smoke-test.md +711 -0
  69. package/core/commands/fix-bug.md +744 -0
  70. package/core/commands/generate-bdd.md +1054 -0
  71. package/core/commands/generate-code.md +869 -0
  72. package/core/commands/generate-design-spec.md +958 -0
  73. package/core/commands/generate-prd.md +748 -0
  74. package/core/commands/generate-spec-manifest.md +658 -0
  75. package/core/commands/generate-tech-docs.md +849 -0
  76. package/core/commands/learn.md +636 -0
  77. package/core/commands/map-testids.md +575 -0
  78. package/core/commands/propose-scenario.md +623 -0
  79. package/core/commands/qc-analyze.md +580 -0
  80. package/core/commands/qc-design-test.md +562 -0
  81. package/core/commands/qc-plan.md +543 -0
  82. package/core/commands/qc-report.md +554 -0
  83. package/core/commands/qc-review.md +547 -0
  84. package/core/commands/qc-run-test.md +604 -0
  85. package/core/commands/refine-prd.md +772 -0
  86. package/core/commands/report-bug.md +639 -0
  87. package/core/commands/review-code.md +677 -0
  88. package/core/commands/review-context.md +1047 -0
  89. package/core/commands/review-tech-docs.md +811 -0
  90. package/core/commands/setup-ai-first.md +545 -0
  91. package/core/commands/sync.md +451 -0
  92. package/core/commands/update-framework.md +251 -0
  93. package/core/commands/validate-traces.md +842 -0
  94. package/core/hooks/data-guard.js +141 -0
  95. package/core/hooks/settings.json +18 -0
  96. package/core/modules/android-compose/module.yaml +13 -0
  97. package/core/modules/android-compose/stack-profile.yaml +57 -0
  98. package/core/modules/angular/architecture-snippets/component-patterns.md +187 -0
  99. package/core/modules/angular/module.yaml +6 -0
  100. package/core/modules/angular/stack-profile.yaml +38 -0
  101. package/core/modules/context-engineering/architecture-snippets/context-design.md +119 -0
  102. package/core/modules/context-engineering/module.yaml +9 -0
  103. package/core/modules/context-engineering/stack-profile.yaml +61 -0
  104. package/core/modules/dotnet/architecture-snippets/clean-arch.md +160 -0
  105. package/core/modules/dotnet/module.yaml +6 -0
  106. package/core/modules/dotnet/stack-profile.yaml +50 -0
  107. package/core/modules/flutter/module.yaml +14 -0
  108. package/core/modules/flutter/stack-profile.yaml +59 -0
  109. package/core/modules/golang/architecture-snippets/domain-layout.md +283 -0
  110. package/core/modules/golang/module.yaml +6 -0
  111. package/core/modules/golang/stack-profile.yaml +40 -0
  112. package/core/modules/ios-swiftui/module.yaml +13 -0
  113. package/core/modules/ios-swiftui/stack-profile.yaml +55 -0
  114. package/core/modules/java-spring/architecture-snippets/layered-arch.md +201 -0
  115. package/core/modules/java-spring/module.yaml +15 -0
  116. package/core/modules/java-spring/stack-profile.yaml +28 -0
  117. package/core/modules/nextjs/architecture-snippets/app-router-patterns.md +269 -0
  118. package/core/modules/nextjs/module.yaml +14 -0
  119. package/core/modules/nextjs/stack-profile.yaml +74 -0
  120. package/core/modules/nuxt/module.yaml +14 -0
  121. package/core/modules/nuxt/stack-profile.yaml +58 -0
  122. package/core/modules/php-laravel/architecture-snippets/service-repository.md +302 -0
  123. package/core/modules/php-laravel/module.yaml +15 -0
  124. package/core/modules/php-laravel/stack-profile.yaml +56 -0
  125. package/core/modules/qc-playwright/stack-profile.yaml +66 -0
  126. package/core/modules/react/architecture-snippets/hooks-query-patterns.md +254 -0
  127. package/core/modules/react/module.yaml +14 -0
  128. package/core/modules/react/stack-profile.yaml +63 -0
  129. package/core/modules/react-native/module.yaml +14 -0
  130. package/core/modules/react-native/stack-profile.yaml +56 -0
  131. package/core/modules/vue/module.yaml +14 -0
  132. package/core/modules/vue/stack-profile.yaml +65 -0
  133. package/core/rules/data-protection.md +80 -0
  134. package/core/rules/workflow.md +44 -0
  135. package/core/skills/code/SKILL.md +770 -0
  136. package/core/skills/debug/SKILL.md +869 -0
  137. package/core/skills/design-spec/SKILL.md +589 -0
  138. package/core/skills/discovery/SKILL.md +554 -0
  139. package/core/skills/prd/SKILL.md +562 -0
  140. package/core/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  141. package/core/skills/qc/qa-analyst/acceptance-criteria.md +60 -0
  142. package/core/skills/qc/qa-analyst/business-rules.md +59 -0
  143. package/core/skills/qc/qa-analyst/data-flow.md +64 -0
  144. package/core/skills/qc/qa-analyst/spec-breakdown.md +61 -0
  145. package/core/skills/qc/qa-designer/e2e/journey.md +41 -0
  146. package/core/skills/qc/qa-designer/exploratory/charter.md +68 -0
  147. package/core/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  148. package/core/skills/qc/qa-designer/functional/api.md +45 -0
  149. package/core/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  150. package/core/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  151. package/core/skills/qc/qa-designer/integration/api.md +42 -0
  152. package/core/skills/qc/qa-designer/integration/db.md +39 -0
  153. package/core/skills/qc/qa-designer/integration/gui.md +40 -0
  154. package/core/skills/qc/qa-designer/integration/kafka.md +40 -0
  155. package/core/skills/qc/qa-designer/non-functional.md +40 -0
  156. package/core/skills/qc/qa-planner/test-plan.md +120 -0
  157. package/core/skills/qc/qa-reviewer/script/e2e.md +87 -0
  158. package/core/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  159. package/core/skills/qc/qa-reviewer/script/functional.md +101 -0
  160. package/core/skills/qc/qa-reviewer/script/integration.md +91 -0
  161. package/core/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  162. package/core/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  163. package/core/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  164. package/core/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  165. package/core/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  166. package/core/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  167. package/core/skills/qc/qa-runner/e2e.md +49 -0
  168. package/core/skills/qc/qa-runner/exploratory/session.md +36 -0
  169. package/core/skills/qc/qa-runner/functional/api.md +35 -0
  170. package/core/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  171. package/core/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  172. package/core/skills/qc/qa-runner/integration.md +47 -0
  173. package/core/skills/qc/qa-runner/non-functional.md +49 -0
  174. package/core/skills/qc/qa-runner/report/report.md +37 -0
  175. package/core/skills/setup-ai-first/SKILL.md +216 -0
  176. package/core/skills/spec/SKILL.md +461 -0
  177. package/core/skills/test/SKILL.md +1297 -0
  178. package/core/steps/capture-lesson.md +79 -0
  179. package/core/steps/context-loader.md +307 -0
  180. package/core/steps/gate.md +87 -0
  181. package/core/steps/report-footer.md +100 -0
  182. package/core/steps/review-fanout.md +138 -0
  183. package/core/steps/spawn-agent.md +124 -0
  184. package/core/steps/trace-mirror.md +26 -0
  185. package/core/templates/architecture.template.md +113 -0
  186. package/core/templates/design-spec.template.md +217 -0
  187. package/core/templates/feature.template +259 -0
  188. package/core/templates/platform-guide.template.md +145 -0
  189. package/core/templates/prd.template.md +327 -0
  190. package/core/templates/product-definition.template.md +168 -0
  191. package/core/templates/project-context.yaml +161 -0
  192. package/docs/01-getting-started/README.md +19 -0
  193. package/docs/01-getting-started/core-concepts.md +102 -0
  194. package/docs/01-getting-started/installation.md +156 -0
  195. package/docs/01-getting-started/quickstart.md +85 -0
  196. package/docs/02-guides/README.md +26 -0
  197. package/docs/02-guides/developer/README.md +46 -0
  198. package/docs/02-guides/developer/bdd-and-trace.md +125 -0
  199. package/docs/02-guides/developer/commands.md +76 -0
  200. package/docs/02-guides/developer/pr-checklist.md +15 -0
  201. package/docs/02-guides/developer/scenarios.md +460 -0
  202. package/docs/02-guides/developer/workflow.md +121 -0
  203. package/docs/02-guides/product-owner/README.md +79 -0
  204. package/docs/02-guides/product-owner/commands.md +30 -0
  205. package/docs/02-guides/product-owner/handoff-checklist.md +42 -0
  206. package/docs/02-guides/product-owner/prd-writing-rules.md +45 -0
  207. package/docs/02-guides/product-owner/scenarios.md +436 -0
  208. package/docs/02-guides/tester/README.md +75 -0
  209. package/docs/02-guides/tester/bug-reporting.md +117 -0
  210. package/docs/02-guides/tester/qc-automation.md +165 -0
  211. package/docs/02-guides/tester/reading-specs.md +79 -0
  212. package/docs/02-guides/tester/scenarios.md +186 -0
  213. package/docs/02-guides/tester/spec-manifest.md +130 -0
  214. package/docs/02-guides/tester/test-checklist.md +31 -0
  215. package/docs/02-guides/tester/workflow.md +77 -0
  216. package/docs/03-concepts/README.md +19 -0
  217. package/docs/03-concepts/architecture.md +248 -0
  218. package/docs/03-concepts/pipeline.md +274 -0
  219. package/docs/03-concepts/traceability.md +149 -0
  220. package/docs/04-operations/README.md +33 -0
  221. package/docs/04-operations/bug-flow.md +362 -0
  222. package/docs/04-operations/publishing.md +137 -0
  223. package/docs/04-operations/sync-and-update.md +522 -0
  224. package/docs/05-reference/README.md +32 -0
  225. package/docs/05-reference/command-cheatsheet.md +147 -0
  226. package/docs/05-reference/commands.md +232 -0
  227. package/docs/05-reference/modules.md +110 -0
  228. package/docs/05-reference/trace-schema.md +153 -0
  229. package/docs/README.md +49 -0
  230. package/hooks/data-guard.js +141 -0
  231. package/hooks/settings.json +18 -0
  232. package/modules/android-compose/module.yaml +13 -0
  233. package/modules/android-compose/stack-profile.yaml +57 -0
  234. package/modules/angular/architecture-snippets/component-patterns.md +187 -0
  235. package/modules/angular/module.yaml +6 -0
  236. package/modules/angular/stack-profile.yaml +38 -0
  237. package/modules/context-engineering/architecture-snippets/context-design.md +119 -0
  238. package/modules/context-engineering/module.yaml +9 -0
  239. package/modules/context-engineering/stack-profile.yaml +61 -0
  240. package/modules/dotnet/architecture-snippets/clean-arch.md +160 -0
  241. package/modules/dotnet/module.yaml +6 -0
  242. package/modules/dotnet/stack-profile.yaml +50 -0
  243. package/modules/flutter/module.yaml +14 -0
  244. package/modules/flutter/stack-profile.yaml +59 -0
  245. package/modules/golang/architecture-snippets/domain-layout.md +283 -0
  246. package/modules/golang/module.yaml +6 -0
  247. package/modules/golang/stack-profile.yaml +40 -0
  248. package/modules/ios-swiftui/module.yaml +13 -0
  249. package/modules/ios-swiftui/stack-profile.yaml +55 -0
  250. package/modules/java-spring/architecture-snippets/layered-arch.md +201 -0
  251. package/modules/java-spring/module.yaml +15 -0
  252. package/modules/java-spring/stack-profile.yaml +28 -0
  253. package/modules/nextjs/architecture-snippets/app-router-patterns.md +269 -0
  254. package/modules/nextjs/module.yaml +14 -0
  255. package/modules/nextjs/stack-profile.yaml +74 -0
  256. package/modules/nuxt/module.yaml +14 -0
  257. package/modules/nuxt/stack-profile.yaml +58 -0
  258. package/modules/php-laravel/architecture-snippets/service-repository.md +302 -0
  259. package/modules/php-laravel/module.yaml +15 -0
  260. package/modules/php-laravel/stack-profile.yaml +56 -0
  261. package/modules/qc-playwright/stack-profile.yaml +66 -0
  262. package/modules/react/architecture-snippets/hooks-query-patterns.md +254 -0
  263. package/modules/react/module.yaml +14 -0
  264. package/modules/react/stack-profile.yaml +63 -0
  265. package/modules/react-native/module.yaml +14 -0
  266. package/modules/react-native/stack-profile.yaml +56 -0
  267. package/modules/vue/module.yaml +14 -0
  268. package/modules/vue/stack-profile.yaml +65 -0
  269. package/package.json +49 -0
  270. package/rules/data-protection.md +80 -0
  271. package/rules/workflow.md +44 -0
  272. package/scripts/init.sh +49 -0
  273. package/scripts/migrate-specs.js +256 -0
  274. package/scripts/upgrade.sh +94 -0
  275. package/skills/code/SKILL.md +770 -0
  276. package/skills/code/SKILL.tmpl +176 -0
  277. package/skills/debug/SKILL.md +869 -0
  278. package/skills/debug/SKILL.tmpl +262 -0
  279. package/skills/design-spec/SKILL.md +589 -0
  280. package/skills/design-spec/SKILL.tmpl +95 -0
  281. package/skills/discovery/SKILL.md +554 -0
  282. package/skills/discovery/SKILL.tmpl +147 -0
  283. package/skills/prd/SKILL.md +562 -0
  284. package/skills/prd/SKILL.tmpl +188 -0
  285. package/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  286. package/skills/qc/qa-analyst/acceptance-criteria.md +60 -0
  287. package/skills/qc/qa-analyst/business-rules.md +59 -0
  288. package/skills/qc/qa-analyst/data-flow.md +64 -0
  289. package/skills/qc/qa-analyst/spec-breakdown.md +61 -0
  290. package/skills/qc/qa-designer/e2e/journey.md +41 -0
  291. package/skills/qc/qa-designer/exploratory/charter.md +68 -0
  292. package/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  293. package/skills/qc/qa-designer/functional/api.md +45 -0
  294. package/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  295. package/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  296. package/skills/qc/qa-designer/integration/api.md +42 -0
  297. package/skills/qc/qa-designer/integration/db.md +39 -0
  298. package/skills/qc/qa-designer/integration/gui.md +40 -0
  299. package/skills/qc/qa-designer/integration/kafka.md +40 -0
  300. package/skills/qc/qa-designer/non-functional.md +40 -0
  301. package/skills/qc/qa-planner/test-plan.md +120 -0
  302. package/skills/qc/qa-reviewer/script/e2e.md +87 -0
  303. package/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  304. package/skills/qc/qa-reviewer/script/functional.md +101 -0
  305. package/skills/qc/qa-reviewer/script/integration.md +91 -0
  306. package/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  307. package/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  308. package/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  309. package/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  310. package/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  311. package/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  312. package/skills/qc/qa-runner/e2e.md +49 -0
  313. package/skills/qc/qa-runner/exploratory/session.md +36 -0
  314. package/skills/qc/qa-runner/functional/api.md +35 -0
  315. package/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  316. package/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  317. package/skills/qc/qa-runner/integration.md +47 -0
  318. package/skills/qc/qa-runner/non-functional.md +49 -0
  319. package/skills/qc/qa-runner/report/report.md +37 -0
  320. package/skills/setup-ai-first/SKILL.md +216 -0
  321. package/skills/setup-ai-first/SKILL.tmpl +116 -0
  322. package/skills/spec/SKILL.md +461 -0
  323. package/skills/spec/SKILL.tmpl +174 -0
  324. package/skills/test/SKILL.md +1297 -0
  325. package/skills/test/SKILL.tmpl +296 -0
  326. package/steps/capture-lesson.md +79 -0
  327. package/steps/context-loader.md +307 -0
  328. package/steps/gate.md +87 -0
  329. package/steps/report-footer.md +100 -0
  330. package/steps/review-fanout.md +138 -0
  331. package/steps/spawn-agent.md +124 -0
  332. package/steps/trace-mirror.md +26 -0
  333. package/templates/architecture.template.md +113 -0
  334. package/templates/design-spec.template.md +217 -0
  335. package/templates/feature.template +259 -0
  336. package/templates/platform-guide.template.md +145 -0
  337. package/templates/prd.template.md +327 -0
  338. package/templates/product-definition.template.md +168 -0
  339. package/templates/project-context.yaml +161 -0
@@ -0,0 +1,217 @@
1
+ # {TICKET-ID} {Feature Name} — Design Spec [{Platform}]
2
+
3
+ <!--
4
+ Template này được sử dụng bởi /generate-design-spec.
5
+ Platform = web | app | app-ios | app-android
6
+
7
+ PLATFORM SECTIONS:
8
+ - Section 3A + 4A: chỉ dành cho web (react/nextjs/vue/angular). Xóa C khi dùng cho web.
9
+ - Section 3C + 4B: chỉ dành cho app (flutter/react-native/ios/android). Xóa A+B khi dùng cho app.
10
+
11
+ COMPONENT MAPPING (bắt buộc):
12
+ - Mọi component trong Component Inventory PHẢI được map với figma-components/{module}.md
13
+ - ✅ Matched → dùng Code Component và Import Path từ catalog
14
+ - ⚠️ TODO → đánh dấu [TODO — chưa implement]
15
+ - ❌ Chưa có → đánh dấu [NEW — cần confirm với designer]
16
+
17
+ FIGMA LINKS (bắt buộc mỗi màn):
18
+ - Mỗi screen PHẢI có link Figma node-level (URL chứa ?node-id=...) — lấy bằng
19
+ right-click frame → "Copy link to selection". Đây là link AI đọc được qua Figma MCP.
20
+ - Link file trần (không có node-id) KHÔNG hợp lệ — AI không định vị được frame.
21
+ - Screen chưa có design → đánh dấu ❌ Missing; spec giữ Status "draft", chặn sign-off
22
+ và /generate-bdd cho tới khi đủ link.
23
+
24
+ SCREEN STATES (bắt buộc mỗi màn):
25
+ - Tối thiểu: default, loading, error
26
+ - Thêm "empty" nếu màn có thể hiển thị trạng thái không có dữ liệu
27
+ - Thêm "success" nếu action tạo ra trạng thái xác nhận riêng biệt
28
+ -->
29
+
30
+ ---
31
+
32
+ ## Metadata
33
+
34
+ | Field | Value |
35
+ |--------------------|---------------------------------------------------------------|
36
+ | **Spec ID** | {TICKET-ID}-DS-{platform} |
37
+ | **Version** | 1.0 |
38
+ | **Status** | draft / approved |
39
+ | **Platform** | {web \| app \| app-ios \| app-android} |
40
+ | **Module** | {active_module} |
41
+ | **Service** | {active_service} |
42
+ | **Domain** | {domain} |
43
+ | **Business PRD** | [{TICKET-ID}](./{TICKET-ID}-slug.md) |
44
+ | **Figma** | {feature file link} ({linked}/{N} frames linked) |
45
+ | **Author** | {PO name or "AI-assisted"} |
46
+ | **Created** | {YYYY-MM-DD} |
47
+ | **Updated** | {YYYY-MM-DD} |
48
+
49
+ ---
50
+
51
+ # 1. Screen Inventory
52
+
53
+ | # | Screen Name | Entry Point | Figma Frame (node-level link) | Notes |
54
+ |---|-------------|-------------|-------------------------------|-------|
55
+ | 1 | {Screen 1} | {how user arrives} | [Frame]({node-level url}) | |
56
+ | 2 | {Screen 2} | {entry point} | ❌ Missing — add node-id link | |
57
+
58
+ ---
59
+
60
+ # 2. Screen Specs
61
+
62
+ ## Screen 1: {Screen Name}
63
+
64
+ **Figma**: [{Frame name}]({figma_frame_url})
65
+
66
+ ### Layout
67
+
68
+ {Grid / max-width / padding / spacing — reference design tokens where applicable}
69
+
70
+ ### Component Inventory
71
+
72
+ | Component (Figma) | Code Component | Import Path | States | Notes |
73
+ |------------------------|----------------|------------------------|---------------------------------|---------|
74
+ | {Figma/Button/Primary} | Button | @/components/ui/Button | default, loading, disabled | |
75
+ | {Figma/Input/Text} | TextInput | @/components/ui/Input | default, focus, error, disabled | |
76
+
77
+ ### Screen States
78
+
79
+ | State | Trigger | UI Behavior |
80
+ |-----------|----------------------------------|----------------------------------------------------------|
81
+ | default | Screen loaded, data available | {Describe full rendered appearance} |
82
+ | loading | API call in flight | {Skeleton / spinner position and style} |
83
+ | error | API failure / validation error | {Toast / inline error / error screen + recovery CTA} |
84
+ | empty | No data returned | {Illustration + CTA — e.g., "No items yet. Add one →"} |
85
+ | success | Action completed (if applicable) | {Confirmation toast / navigation / visual change} |
86
+
87
+ ### Actions & Navigation
88
+
89
+ | Action | Trigger | Result |
90
+ |-----------------|---------------------------|---------------------------------------------------|
91
+ | {Action name} | Tap/click {element} | Navigate to {Screen N} / Open {Modal name} |
92
+ | {Back/Cancel} | Back gesture / button | Return to {previous screen} without saving |
93
+
94
+ ---
95
+
96
+ <!-- Repeat ## Screen N for each additional screen -->
97
+
98
+ ---
99
+
100
+ # 3. Interaction Patterns
101
+
102
+ <!-- === WEB ONLY — delete this section for app === -->
103
+
104
+ ## A. Responsive Behavior *(web)*
105
+
106
+ | Breakpoint | Width | Layout Changes |
107
+ |------------|------------|---------------------------------------------|
108
+ | Mobile | < 768px | {Single column, bottom nav, full-width CTA} |
109
+ | Tablet | 768–1279px | {2-col grid, sidebar collapsed} |
110
+ | Desktop | ≥ 1280px | {Full layout, max-width 1440px} |
111
+
112
+ ## B. Hover / Focus / Keyboard *(web)*
113
+
114
+ | Element | Hover | Focus | Keyboard |
115
+ |----------------|-------------------------------|---------------------------------|---------------|
116
+ | Primary button | Background → {color.hover} | Outline 2px {color.focus} | Enter / Space |
117
+ | Text input | Border → {color.border.hover} | Border → {color.primary} | Tab to focus |
118
+
119
+ <!-- === APP ONLY — delete sections A+B for app === -->
120
+
121
+ ## C. Gestures & Navigation *(app)*
122
+
123
+ | Gesture | Screen / Element | Behavior |
124
+ |----------------------|---------------------|---------------------------------------------|
125
+ | Back gesture | All screens | {Return / show "Discard changes?" dialog} |
126
+ | Pull-to-refresh | {Screen names} | Refresh data, spinner at top |
127
+ | Swipe left on row | {List item} | Reveal {Delete / Archive} action |
128
+
129
+ ### Navigation Stack *(app)*
130
+
131
+ ```
132
+ {e.g., BottomTab(Home) → ListPage → DetailPage → EditPage}
133
+ ```
134
+
135
+ ### Platform Conventions *(app)*
136
+
137
+ | Aspect | iOS | Android |
138
+ |------------------|-------------------------------------------|-------------------------------------|
139
+ | Navigation bar | Back button top-left, title centered | Up arrow, title left-aligned |
140
+ | Bottom sheet | UISheetPresentation, grabber visible | BottomSheet, drag handle |
141
+ | Dialog | Actions right-aligned | Actions left-aligned |
142
+
143
+ ---
144
+
145
+ # 4. Platform Considerations
146
+
147
+ <!-- === WEB ONLY === -->
148
+
149
+ ## A. Accessibility *(web)*
150
+
151
+ - [ ] All interactive elements reachable by Tab key — no keyboard traps
152
+ - [ ] Focus trap inside modals
153
+ - [ ] Icon-only buttons have `aria-label`
154
+ - [ ] Dynamic content announces via `aria-live`
155
+ - [ ] WCAG AA contrast: text ≥ 4.5:1, large text ≥ 3:1
156
+ - [ ] Form inputs have visible labels (not placeholder-only)
157
+
158
+ <!-- === APP ONLY === -->
159
+
160
+ ## B. Device & OS *(app)*
161
+
162
+ - [ ] Safe area insets applied (top + bottom) on all screens
163
+ - [ ] Minimum touch target: 44×44pt (iOS) / 48×48dp (Android)
164
+ - [ ] Tested on 375pt (iPhone SE) and 360dp (small Android)
165
+ - [ ] Deep link: `{scheme}://{host}/{path}` → {screen name}
166
+ - [ ] Permissions: {Camera / Location / Notification} — rationale copy TBD
167
+ - [ ] Offline: {screen name} shows cached data + banner; {action} disabled with tooltip
168
+ - [ ] Dark mode tested — no hardcoded colors
169
+
170
+ ---
171
+
172
+ # 5. AC-UI — Design Acceptance Criteria
173
+
174
+ > Reviewed and signed off by **PO + Designer** before BDD generation.
175
+ > Complements business-level AC in [Business PRD](./{TICKET-ID}-slug.md).
176
+
177
+ | ID | Acceptance Criterion | Verified by |
178
+ |--------|--------------------------------------------------------------------------|-----------------|
179
+ | AC-UI1 | All screens match approved Figma frames within design-system tolerances | Designer |
180
+ | AC-UI2 | Loading state appears within 200ms of any API call initiation | QA |
181
+ | AC-UI3 | All error messages are visible, descriptive, and include a recovery CTA | PO |
182
+ | AC-UI4 | Empty states include illustration and call-to-action | PO + Designer |
183
+ | AC-UI5 | {Platform-specific criterion} | QA |
184
+
185
+ ---
186
+
187
+ # Appendix
188
+
189
+ ## Figma Summary
190
+
191
+ | Screen | Figma Frame (node-level) | Link / Fetch Status |
192
+ |------------|--------------------------|--------------------------------|
193
+ | {Screen 1} | [Link]({node-level url}) | ✅ Linked & fetched |
194
+ | {Screen 2} | — | ❌ Missing — no node-id link |
195
+
196
+ ## Design Tokens Referenced
197
+
198
+ | Token | Value | Used in |
199
+ |-------------------|----------|----------------------------|
200
+ | `color.primary` | {#hex} | Buttons, links |
201
+ | `spacing.md` | {16px} | Standard vertical gap |
202
+
203
+ ## References
204
+
205
+ - [{TICKET-ID}](./{TICKET-ID}-slug.md) — Business PRD
206
+
207
+ ## AI Assumptions
208
+
209
+ - {Assumption — [AI DRAFT]}
210
+
211
+ ---
212
+
213
+ ## Changelog
214
+
215
+ | Version | Date | Changes |
216
+ |---------|--------------|-----------------|
217
+ | 1.0 | {YYYY-MM-DD} | Initial version |
@@ -0,0 +1,259 @@
1
+ # ============================================================
2
+ # BDD Feature Template — KVLoyalty AI Native Pipeline (v2)
3
+ # ============================================================
4
+ # Instructions:
5
+ # 1. Copy this file và rename: {TICKET_ID}-UC{N}-feature-name.feature
6
+ # 2. Điền @trace metadata (required)
7
+ # 3. Khai báo Context của UC (1 lần, đầu file)
8
+ # 4. Tạo/cập nhật dataset YAML cùng domain: specs/features/{domain}.testdata.yaml
9
+ # 5. Viết Scenario — mỗi SC PHẢI có dòng `# Side-effects:` ngay trên
10
+ # 6. Đặt file ở: specs/features/{domain}/
11
+ # 7. Chạy: /generate-code
12
+ # ============================================================
13
+ #
14
+ # RULE VIẾT BDD BẮT BUỘC (xem bdd-writing-guide.md PART A + C):
15
+ # R1 Given/When/Then Semantics — Given=state, When=action, Then=outcome (mỗi SC đủ G/W/T)
16
+ # R2 One Behavior Per Scenario — 1 SC = 1 behavior; KHÔNG chain When-Then
17
+ # R3 Ubiquitous Language — KHÔNG dùng UI selector / API name / tech term
18
+ # R4 Outside-in Naming — Tên SC mô tả business outcome, KHÔNG có "click"/"(Case X)"/component name
19
+ # R5 Declarative over Imperative — Mô tả WHAT (intent business), KHÔNG HOW (UI mechanic)
20
+ # R6 Observable Outcomes Only — Then assert outcome quan sát được, KHÔNG UI trung gian/internal state
21
+ # R7 Key Examples / Concrete — Dùng concrete values, KHÔNG "hợp lệ" chung chung
22
+ # R8 Independence — SC chạy độc lập, KHÔNG phụ thuộc state SC khác
23
+ # R9 Test Data Completeness — Data table có đủ field external system để derive expected Then
24
+ # R10 Scope Boundary Explicit — Cross-UC reference dùng wording navigation + Note comment
25
+ # PROJECT COMPLIANCE (must-pass, fail review nếu thiếu):
26
+ # C.1 Wireframe Coverage — Mọi component/action wireframe có ≥1 SC
27
+ # C.2 PRD Traceability — Mọi AC/BR (kèm bullet) map về ≥1 SC
28
+ # C.3 Business Dictionary — Dùng đúng term, đề xuất term mới qua DICTIONARY-SUGGESTION
29
+ # C.4 Banned Terms Compliance — 0 banned term (auto-grep): SKU/Customer/JS SDK/Cửa hàng/...
30
+ # C.5 NHÓM Grouping Convention — Scenarios gom theo CHỦ ĐỀ NGHIỆP VỤ (NHÓM N) — xem §NHÓM GROUPING CONVENTION dưới
31
+ # ============================================================
32
+
33
+ # --- TRACE METADATA (REQUIRED) ---
34
+ # @trace.id: {TICKET_ID}-UC{N}
35
+ # @trace.title: <Tên tính năng bằng tiếng Việt>
36
+ # @trace.revision: 1
37
+ # @trace.domain: <identity|loyalty|membership|messaging|store-management>
38
+ # @trace.service: <KVLoyalty.Identity|KVLoyalty.Loyalty|...>
39
+ # @trace.status: draft|review|approved
40
+ # @trace.author: <tên tác giả>
41
+ # @trace.created_at: <YYYY-MM-DD>
42
+ # @trace.prd: <TICKET-ID hoặc để trống>
43
+ # @trace.prd_version: <version PRD tại thời điểm viết — để drift-detector so sánh>
44
+ # @trace.business_rules: <{TICKET_ID}-UC{N}-BR{M}, ...>
45
+ # @trace.dataset: <{domain}.testdata.yaml — bắt buộc nếu BDD reference dataset>
46
+
47
+ # === CONTEXT (áp dụng cho toàn Feature) ===
48
+ # Actor: <vai trò thực hiện hành động, vd: Consumer, Staff, System>
49
+ # Screens: <các màn liên quan, vd: Cart → Confirm Order → Order Detail>
50
+ # Entities: <entity nghiệp vụ, vd: Order, OrderItem, Consumer, Branch>
51
+ # Pre-state: <state chung trước khi vào các scenario>
52
+
53
+ # === SCOPE ===
54
+ # In: <những gì UC này cover>
55
+ # Out: <những gì KHÔNG thuộc UC này — link sang UC khác / feature khác (R10)>
56
+
57
+ # === BUSINESS DEFINITION (MANDATORY) ===
58
+ # Quick reference các thuật ngữ dùng trong feature này. SoT chi tiết: business-dictionary.md
59
+ # Mục đích: reader đọc 1 lần hiểu ngay khái niệm trước khi xem scenarios.
60
+ #
61
+ # <Term 1> (English mapping): <định nghĩa ngắn gọn, vd cấu trúc, scope>
62
+ # <Term 2>: <định nghĩa>
63
+ # ...
64
+ #
65
+ # === Test data convention (R9) ===
66
+ # Khai báo default value khi data table không có cột tương ứng.
67
+ # VD: "SC không khai báo cột customerOrdered → ngầm hiểu customerOrdered = 0 (chưa có khách đặt)"
68
+ # VD: "SC không khai báo cột toggle → ngầm hiểu toggle = Hiện (default Ẩn/Hiện trạng thái)"
69
+ #
70
+ # === Popup/Modal Lifecycle (B.2.4 — bắt buộc nếu feature là popup/modal) ===
71
+ # - Open trigger: <khi nào popup hiển thị, vd: click menu sidebar>
72
+ # - Close trigger: <khi nào popup đóng, vd: F5 / click X / ESC / navigate away>
73
+ # - Refresh model: <data refresh khi nào, vd: mỗi lần open (NO CACHE) / persisted / polling>
74
+ # - State reset: <state nào reset khi đóng/mở lại, vd: pagination, expand, dropdown selection>
75
+
76
+ # === DISPLAY LOGIC MATRIX (optional — bắt buộc nếu display logic phụ thuộc ≥2 dimension, B.1.7) ===
77
+ # Enumerate full matrix N×M case + map mỗi case → SC.
78
+ # Tên SC theo pattern: `<cấu trúc>: <outcome>` — KHÔNG dùng "(Case X)" suffix.
79
+ # VD ma trận `{số thuộc tính: 0/1/≥2} × {số đơn vị tính: 0/1/≥2}` = 9 case:
80
+ #
81
+ # | # | Dim1 | Dim2 | Format hiển thị | SC |
82
+ # |---|------|------|----------------------------------------------|------|
83
+ # | 1 | 0 | 0 | `Tên hàng` | SC{} |
84
+ # | 2 | 0 | 1 | `Tên hàng (đơn vị)` | SC{} |
85
+ # | ... | ... | ... | ... | ... |
86
+
87
+ # === DICTIONARY REFERENCES (R3 + C.4) ===
88
+ # Liệt kê các term từ business-dictionary.md mà feature này dùng → pointer cho reviewer auto-check.
89
+ # Banned terms (xem business-dictionary.md § Banned Terms) MUST NOT appear: 0 match khi grep.
90
+ #
91
+ # Terms dùng trong feature này:
92
+ # - <Term 1> (xem dictionary line {N})
93
+ # - <Term 2> (xem dictionary line {M})
94
+ # - ...
95
+
96
+ Feature: <Tên tính năng bằng tiếng Việt>
97
+ Với vai trò là <vai trò>
98
+ Tôi muốn <hành động>
99
+ Để <lợi ích nghiệp vụ>
100
+
101
+ # --- DATASET REFERENCE CONVENTION ---
102
+ # Ưu tiên dùng ALIAS (tiếng Việt) thay vì ID kỹ thuật, để BDD dễ đọc.
103
+ # Backtick ID chỉ dùng khi cần precision (vd: assertion về mã đơn).
104
+ #
105
+ # Ví dụ:
106
+ # ✅ Given đơn hàng draft "Đơn COD giao hàng — 2× áo + 1× quần, total 650K"
107
+ # ✅ Then đơn được gán mã `ZMA{id}` nhận từ Retail
108
+ # ❌ Given đơn hàng draft là `ORD_COD_DRAFT_001` ← khó đọc, hạn chế
109
+
110
+ Background:
111
+ Given <điều kiện tiên quyết chung — dùng alias từ dataset>
112
+ # Ví dụ: Given consumer "Khách mới đã cấp quyền Zalo" ở màn "Xác nhận đơn hàng"
113
+ # của gian hàng "Cửa hàng Thời Trang (đang kích hoạt)"
114
+
115
+ # ============================================================
116
+ # § NHÓM GROUPING CONVENTION (C.5 — bắt buộc cho mọi feature ≥3 SCs)
117
+ # ============================================================
118
+ # Mục đích: organize scenarios theo CHỦ ĐỀ NGHIỆP VỤ để dễ navigate + scope-awareness, KHÔNG
119
+ # theo phân loại happy/negative/edge (deprecated section markers HAPPY-PATH / NEGATIVE-CASE / EDGE-CASE).
120
+ #
121
+ # Quy tắc:
122
+ # 1. **Gom theo chủ đề business** — mỗi NHÓM = 1 business theme (flow / state / behavior subset).
123
+ # ✅ NHÓM 1: Khởi tạo gian hàng thành công với dữ liệu mặc định (BR1, BR2)
124
+ # ✅ NHÓM 2: Resume khi onboarding bị gián đoạn (BR1 resume)
125
+ # ✅ NHÓM 3: Xử lý lỗi khởi tạo (BR3)
126
+ # ❌ NHÓM 1: HAPPY-PATH ← chia theo loại path, không phải chủ đề
127
+ # ❌ NHÓM 1: COD scenarios ← UI feature, không phải business theme
128
+ #
129
+ # 2. **Mỗi NHÓM có thể chứa cả @happy + @edge + @negative SCs cùng chủ đề** — KHÔNG tách happy/edge ra 2 NHÓM riêng.
130
+ # Ví dụ: NHÓM "Xử lý lỗi khi khởi tạo" chứa SC happy retry + SC edge X close + SC negative no retry.
131
+ # Tag taxonomy (@happy/@edge/@cross-system per B.2.3) áp dụng ở SC level — KHÔNG ở NHÓM level.
132
+ #
133
+ # 3. **Format NHÓM header** (3 dòng comment box):
134
+ # # ==========================================================
135
+ # # NHÓM N: <Chủ đề> (<BR refs nếu áp dụng>)
136
+ # # ==========================================================
137
+ # Indent 2 spaces (cùng level với Background + Scenario).
138
+ #
139
+ # 4. **Đánh số NHÓM tuần tự** từ 1 → N. Không skip số. Reorder NHÓM được — KHÔNG ảnh hưởng SC IDs.
140
+ #
141
+ # 5. **SC trong NHÓM KHÔNG cần theo thứ tự ID** — VD NHÓM 2 có thể chứa SC8, SC4, SC11 nếu cùng chủ đề.
142
+ # SC IDs tuần tự theo lifecycle (skill §3.4), KHÔNG theo NHÓM ordering.
143
+ #
144
+ # 6. **Khi nào skip NHÓM**: feature có <3 SCs → có thể bỏ NHÓM headers (không value to organize so few).
145
+ # Đơn giản đặt SCs nối tiếp sau Background. Feature ≥3 SCs → BẮT BUỘC NHÓM.
146
+ #
147
+ # Pattern thường gặp (gợi ý theme — tuỳ chỉnh per UC):
148
+ # - "Khởi tạo / Lưu thành công — các tổ hợp data hợp lệ" (gom happy + alternative)
149
+ # - "Validation / Chặn lưu khi không hợp lệ" (gom negative + edge validation)
150
+ # - "Xử lý lỗi — API fail / system error" (gom negative + recovery)
151
+ # - "Hủy thay đổi / Đóng modal không lưu" (gom edge UX)
152
+ # - "Hành vi popup / dialog — multi-select / persist / boundary" (gom edge UX behavior)
153
+ # - "Hiệu ứng cross-system / Consumer view" (gom @cross-system SCs)
154
+ # - "Idempotency & Concurrency" (gom edge concurrency)
155
+ # - "State transition / Recovery completion" (gom @cross-UC behavior chains)
156
+ #
157
+ # Ví dụ NHÓM structure cho UC có 9 SCs (LOYAL-32-UC1 reference):
158
+ # NHÓM 1: Lưu cấu hình thành công — các tổ hợp PTTT hợp lệ (BR1, BR2) → SC1, SC2, SC3, SC4
159
+ # NHÓM 2: Chặn lưu khi cấu hình không hợp lệ (BR1, BR2) + lỗi hệ thống → SC5, SC6, SC7
160
+ # NHÓM 3: Hủy thay đổi — đóng Modal không lưu → SC8
161
+ # NHÓM 4: Initial State — Modal phản ánh cấu hình hiện tại → SC10
162
+
163
+ # ==========================================================
164
+ # NHÓM 1: <Chủ đề business 1> (<BR refs nếu cần>)
165
+ # ==========================================================
166
+
167
+ # Side-effects: <liệt kê NGẮN GỌN các hậu quả Then phải verify — 1 dòng>
168
+ # @trace.scenario: {TICKET_ID}-UC{N}-SC1
169
+ # @trace.sc_version: 1.0
170
+ # @trace.business_rules: {TICKET_ID}-UC{N}-BR{M}
171
+ @happy
172
+
173
+ Scenario: <Mô tả luồng chính — dùng động từ CHÍNH XÁC (tạo/nhận/gán/đồng bộ)>
174
+ Given <state đầu vào — dùng alias từ dataset, vd: "Đơn COD giao hàng — 2× áo + 1× quần">
175
+ When <hành động duy nhất>
176
+ Then <kết quả chính — dùng backtick ID khi cần precision, vd: mã `ZMA{id}`>
177
+ And <side-effect 1 đã khai báo ở header>
178
+ And <side-effect 2 đã khai báo ở header>
179
+ # ... đủ với danh sách Side-effects ở trên (Rule R2)
180
+
181
+ # Side-effects: <...>
182
+ # @trace.scenario: {TICKET_ID}-UC{N}-SC2
183
+ # @trace.sc_version: 1.0
184
+ # @trace.business_rules: {TICKET_ID}-UC{N}-BR{M}
185
+ @happy @alternative
186
+
187
+ Scenario: <Cùng chủ đề NHÓM 1 nhưng path khác — vd enum value khác (Rule R4 enum symmetry)>
188
+ Given <state đầu vào>
189
+ When <hành động>
190
+ Then <kết quả>
191
+
192
+ # ==========================================================
193
+ # NHÓM 2: <Chủ đề business 2 — VD: Xử lý lỗi / Validation> (<BR refs>)
194
+ # ==========================================================
195
+
196
+ # Side-effects: <...>
197
+ # @trace.scenario: {TICKET_ID}-UC{N}-SC3
198
+ # @trace.sc_version: 1.0
199
+ # @trace.business_rules: {TICKET_ID}-UC{N}-BR{M}
200
+ @edge
201
+
202
+ Scenario: <Tình huống biên / lỗi cùng chủ đề NHÓM 2>
203
+ Given <state đầu vào>
204
+ When <hành động>
205
+ Then <xử lý lỗi mong đợi>
206
+
207
+ # ==========================================================
208
+ # NHÓM 3: <Chủ đề business 3 — VD: Cross-system / Hiệu ứng downstream> (<BR refs>)
209
+ # ==========================================================
210
+
211
+ # Side-effects: <...>
212
+ # @trace.scenario: {TICKET_ID}-UC{N}-SC4
213
+ # @trace.sc_version: 1.0
214
+ # @trace.business_rules: {TICKET_ID}-UC{N}-BR{M}
215
+ @happy @cross-system
216
+
217
+ Scenario: <Scenario span ≥2 service hoặc hiệu ứng đồng bộ cross-UC>
218
+ Given <state đầu vào>
219
+ When <hành động>
220
+ Then <kết quả tại service A>
221
+ And <kết quả đồng bộ sang service B>
222
+
223
+ # === TECHNICAL HINTS (optional, giúp AI gen code chính xác hơn) ===
224
+ # Dependencies: <UC/service phụ thuộc, vd: LOYAL-28 upstream>
225
+ # Entities: <Entity1, Entity2>
226
+ # Events: <EventName> (publish to <topic>)
227
+ # Cache: <cache invalidation notes>
228
+ # Validation: <validation rules>
229
+
230
+ # === PRD COVERAGE (C.1 + C.2 — wireframe action + AC/BR checklist) ===
231
+ # AC mapping:
232
+ # AC1 (...) → SC1, SC2
233
+ # AC2 (...) → SC3
234
+ # BR mapping (mỗi bullet trong BR PHẢI có ≥1 SC — C.2):
235
+ # BR1 (...) → SC1
236
+ # BR2 (...) → SC1, SC2
237
+ # Wireframe mapping (mọi component/action có ≥1 SC — C.1):
238
+ # Screen "<tên màn>":
239
+ # [x] Click "<button A>" → SC1
240
+ # [x] Click "<button B>" → SC2
241
+ # [ ] Click "<" back → MISSING ← BLOCK MERGE
242
+ # Display Logic Matrix mapping (nếu áp dụng — B.1.7):
243
+ # Case 1 (...) → SC{N}
244
+ # Case 2 (...) → SC{N}
245
+ # User Flow: <path name> → SC1, SC2, SC3
246
+
247
+ # === BUSINESS RULES ===
248
+ # {TICKET_ID}-UC{N}-BR1: <mô tả rule>
249
+ # {TICKET_ID}-UC{N}-BR2: <mô tả rule>
250
+
251
+ # === PRE-MERGE CHECKLIST (auto-verify) ===
252
+ # - [ ] Mọi SC có Side-effects + @trace.scenario + @trace.sc_version + @trace.ac + @trace.business_rules
253
+ # - [ ] Coverage Matrix có 0 dòng `[ ]` MISSING (C.1)
254
+ # - [ ] Mọi AC/BR (kèm từng bullet) map về ≥1 SC (C.2)
255
+ # - [ ] CI grep banned terms = 0 match (C.4) — xem business-dictionary.md § Banned Terms
256
+ # - [ ] Nếu là popup/modal: Popup/Modal Lifecycle khai báo trong BUSINESS DEFINITION (B.2.4)
257
+ # - [ ] Nếu display logic ≥2 dimension: Display Logic Matrix enumerated (B.1.7)
258
+ # - [ ] Feature ≥3 SCs có NHÓM grouping theo chủ đề business (C.5) — KHÔNG dùng section markers cũ HAPPY-PATH/NEGATIVE-CASE/EDGE-CASE
259
+ # - [ ] /review-context score ≥90 (project gate)
@@ -0,0 +1,145 @@
1
+ # Platform Guide — {{SERVICE_NAME}}
2
+
3
+ > This guide provides context that Claude uses when working in THIS service/repository.
4
+ > Keep it concise and factual. Update when the architecture or domain model changes.
5
+ > Reference: CLAUDE.md for project-wide standards. This file covers service-specific context.
6
+
7
+ ---
8
+
9
+ # §1. Service Overview
10
+
11
+ **Service name**: {{SERVICE_NAME}}
12
+ **Purpose**: {{ONE_SENTENCE_PURPOSE}}
13
+ **Bounded context**: {{BOUNDED_CONTEXT}} # e.g., "Owns all order lifecycle logic. Does NOT own payments or inventory."
14
+ **Team**: {{TEAM_NAME}}
15
+ **Repository**: {{REPO_URL}}
16
+
17
+ Primary responsibilities:
18
+ - {{RESPONSIBILITY_1}}
19
+ - {{RESPONSIBILITY_2}}
20
+ - {{RESPONSIBILITY_3}}
21
+
22
+ This service does NOT handle:
23
+ - {{OUT_OF_SCOPE_1}} # e.g., "Payment processing → see payment-service"
24
+ - {{OUT_OF_SCOPE_2}}
25
+
26
+ ---
27
+
28
+ # §2. Domain Model
29
+
30
+ Key entities and their relationships:
31
+
32
+ ```
33
+ {{ENTITY_1}} (aggregate root)
34
+ ├── {{CHILD_ENTITY_1}} (value object / child entity)
35
+ └── {{CHILD_ENTITY_2}}
36
+
37
+ {{ENTITY_2}}
38
+ └── references {{ENTITY_1}} by ID
39
+ ```
40
+
41
+ **{{ENTITY_1}}**:
42
+ - Key fields: {{KEY_FIELDS}}
43
+ - Status lifecycle: {{STATUS_1}} → {{STATUS_2}} → {{STATUS_3}}
44
+ - Business rules: {{KEY_RULE_1}}
45
+
46
+ **{{ENTITY_2}}**:
47
+ - Key fields: {{KEY_FIELDS}}
48
+ - Relationships: {{RELATIONSHIP_DESCRIPTION}}
49
+
50
+ ---
51
+
52
+ # §3. Common Patterns
53
+
54
+ Patterns specific to this service (supplement the project-wide standards in CLAUDE.md):
55
+
56
+ ## {{PATTERN_NAME_1}}
57
+ ```
58
+ // When to use: {{USE_CASE}}
59
+ // Example:
60
+ {{CODE_EXAMPLE}}
61
+ ```
62
+
63
+ ## {{PATTERN_NAME_2}}
64
+ ```
65
+ // When to use: {{USE_CASE}}
66
+ // Example:
67
+ {{CODE_EXAMPLE}}
68
+ ```
69
+
70
+ ---
71
+
72
+ # §4. Integration Points
73
+
74
+ ## Upstream Dependencies (this service calls these)
75
+
76
+ | Service / System | What we call | Protocol | Auth |
77
+ |------------------|--------------|----------|------|
78
+ | {{UPSTREAM_1}} | {{WHAT}} | REST/gRPC/Event | {{AUTH_METHOD}} |
79
+ | {{UPSTREAM_2}} | {{WHAT}} | REST/gRPC/Event | {{AUTH_METHOD}} |
80
+
81
+ ## Downstream Consumers (these services call us or consume our events)
82
+
83
+ | Consumer | What they use | Protocol |
84
+ |----------|---------------|----------|
85
+ | {{DOWNSTREAM_1}} | {{WHAT}} | REST/Event |
86
+ | {{DOWNSTREAM_2}} | {{WHAT}} | REST/Event |
87
+
88
+ ## Events Produced
89
+
90
+ | Event name | Trigger | Payload summary |
91
+ |------------|---------|-----------------|
92
+ | {{EVENT_1}} | {{WHEN}} | {{PAYLOAD_FIELDS}} |
93
+ | {{EVENT_2}} | {{WHEN}} | {{PAYLOAD_FIELDS}} |
94
+
95
+ ## Events Consumed
96
+
97
+ | Event name | From service | What we do with it |
98
+ |------------|-------------|-------------------|
99
+ | {{EVENT_1}} | {{SOURCE}} | {{HANDLER_ACTION}} |
100
+
101
+ ---
102
+
103
+ # §5. Known Constraints
104
+
105
+ ## Performance Constraints
106
+ - {{PERF_CONSTRAINT_1}} # e.g., "Order list endpoint must respond < 200ms for up to 1000 orders"
107
+ - {{PERF_CONSTRAINT_2}}
108
+
109
+ ## Business Rule Constraints
110
+ - {{BUSINESS_CONSTRAINT_1}} # e.g., "Cannot cancel an order after it has been shipped"
111
+ - {{BUSINESS_CONSTRAINT_2}}
112
+
113
+ ## External Dependencies
114
+ - {{EXTERNAL_DEP_1}} # e.g., "Requires inventory-service to be available for order creation"
115
+ - {{EXTERNAL_DEP_2}}
116
+
117
+ ## Known Technical Debt
118
+ - {{TECH_DEBT_1}} # e.g., "OrderItem.price is duplicated from catalog — sync via nightly job"
119
+
120
+ ---
121
+
122
+ # §6. Directory Structure
123
+
124
+ ```
125
+ {{SERVICE_ROOT}}/
126
+ ├── {{SOURCE_DIR}}/ # Main source code
127
+ │ ├── {{LAYER_1}}/ # e.g., controller/ or handler/
128
+ │ │ └── {{EXAMPLE_FILE}}
129
+ │ ├── {{LAYER_2}}/ # e.g., service/ or usecase/
130
+ │ │ └── {{EXAMPLE_FILE}}
131
+ │ ├── {{LAYER_3}}/ # e.g., repository/ or repo/
132
+ │ │ └── {{EXAMPLE_FILE}}
133
+ │ └── {{LAYER_4}}/ # e.g., model/ or domain/
134
+ │ └── {{EXAMPLE_FILE}}
135
+ ├── {{TEST_DIR}}/ # Tests mirroring src structure
136
+ ├── specs/ # BDD feature files
137
+ │ └── bdd/
138
+ │ └── {{DOMAIN}}/
139
+ │ └── {{UC-ID}}-{{slug}}.feature
140
+ └── {{CONFIG_FILE}} # e.g., application.yaml / appsettings.json
141
+ ```
142
+
143
+ **Key conventions for this repo:**
144
+ - {{CONVENTION_1}} # e.g., "All DTOs are in the api/ package, not mixed with domain models"
145
+ - {{CONVENTION_2}} # e.g., "Integration tests are in src/test/java/.../integration/ with @Tag(\"integration\")"