@educa-corp/sdd-framework 0.1.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 (382) hide show
  1. package/bin/build.js +230 -0
  2. package/bin/index.js +609 -0
  3. package/commands/debug.md +835 -0
  4. package/commands/debug.tmpl +257 -0
  5. package/commands/define-product.md +746 -0
  6. package/commands/define-product.tmpl +191 -0
  7. package/commands/dev-gen-test.md +1015 -0
  8. package/commands/dev-gen-test.tmpl +490 -0
  9. package/commands/dev-run-test.md +749 -0
  10. package/commands/dev-run-test.tmpl +224 -0
  11. package/commands/dev-smoke-test.md +716 -0
  12. package/commands/dev-smoke-test.tmpl +217 -0
  13. package/commands/fix-bug.md +749 -0
  14. package/commands/fix-bug.tmpl +171 -0
  15. package/commands/generate-bdd.md +1144 -0
  16. package/commands/generate-bdd.tmpl +499 -0
  17. package/commands/generate-code.md +1038 -0
  18. package/commands/generate-code.tmpl +513 -0
  19. package/commands/generate-design-spec.md +1079 -0
  20. package/commands/generate-design-spec.tmpl +524 -0
  21. package/commands/generate-prd.md +945 -0
  22. package/commands/generate-prd.tmpl +166 -0
  23. package/commands/generate-spec-manifest.md +663 -0
  24. package/commands/generate-spec-manifest.tmpl +164 -0
  25. package/commands/generate-tech-docs.md +1249 -0
  26. package/commands/generate-tech-docs.tmpl +252 -0
  27. package/commands/learn.md +641 -0
  28. package/commands/learn.tmpl +63 -0
  29. package/commands/map-testids.md +580 -0
  30. package/commands/map-testids.tmpl +81 -0
  31. package/commands/propose-scenario.md +632 -0
  32. package/commands/propose-scenario.tmpl +133 -0
  33. package/commands/qc-analyze.md +611 -0
  34. package/commands/qc-analyze.tmpl +112 -0
  35. package/commands/qc-design-test.md +567 -0
  36. package/commands/qc-design-test.tmpl +68 -0
  37. package/commands/qc-plan.md +548 -0
  38. package/commands/qc-plan.tmpl +49 -0
  39. package/commands/qc-report.md +559 -0
  40. package/commands/qc-report.tmpl +60 -0
  41. package/commands/qc-review.md +552 -0
  42. package/commands/qc-review.tmpl +53 -0
  43. package/commands/qc-run-test.md +609 -0
  44. package/commands/qc-run-test.tmpl +84 -0
  45. package/commands/refine-prd.md +992 -0
  46. package/commands/refine-prd.tmpl +278 -0
  47. package/commands/report-bug.md +647 -0
  48. package/commands/report-bug.tmpl +148 -0
  49. package/commands/review-code.md +682 -0
  50. package/commands/review-code.tmpl +104 -0
  51. package/commands/review-context.md +1202 -0
  52. package/commands/review-context.tmpl +488 -0
  53. package/commands/review-tech-docs.md +871 -0
  54. package/commands/review-tech-docs.tmpl +372 -0
  55. package/commands/setup-ai-first.md +546 -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 +928 -0
  62. package/commands/validate-traces.tmpl +429 -0
  63. package/core/FRAMEWORK_VERSION +1 -0
  64. package/core/commands/debug.md +835 -0
  65. package/core/commands/define-product.md +746 -0
  66. package/core/commands/dev-gen-test.md +1015 -0
  67. package/core/commands/dev-run-test.md +749 -0
  68. package/core/commands/dev-smoke-test.md +716 -0
  69. package/core/commands/fix-bug.md +749 -0
  70. package/core/commands/generate-bdd.md +1144 -0
  71. package/core/commands/generate-code.md +1038 -0
  72. package/core/commands/generate-design-spec.md +1079 -0
  73. package/core/commands/generate-prd.md +945 -0
  74. package/core/commands/generate-spec-manifest.md +663 -0
  75. package/core/commands/generate-tech-docs.md +1249 -0
  76. package/core/commands/learn.md +641 -0
  77. package/core/commands/map-testids.md +580 -0
  78. package/core/commands/propose-scenario.md +632 -0
  79. package/core/commands/qc-analyze.md +611 -0
  80. package/core/commands/qc-design-test.md +567 -0
  81. package/core/commands/qc-plan.md +548 -0
  82. package/core/commands/qc-report.md +559 -0
  83. package/core/commands/qc-review.md +552 -0
  84. package/core/commands/qc-run-test.md +609 -0
  85. package/core/commands/refine-prd.md +992 -0
  86. package/core/commands/report-bug.md +647 -0
  87. package/core/commands/review-code.md +682 -0
  88. package/core/commands/review-context.md +1202 -0
  89. package/core/commands/review-tech-docs.md +871 -0
  90. package/core/commands/setup-ai-first.md +546 -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 +928 -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 +19 -0
  136. package/core/skills/debug/SKILL.md +19 -0
  137. package/core/skills/design-spec/SKILL.md +11 -0
  138. package/core/skills/discovery/SKILL.md +14 -0
  139. package/core/skills/prd/SKILL.md +19 -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 +11 -0
  176. package/core/skills/spec/SKILL.md +19 -0
  177. package/core/skills/test/SKILL.md +18 -0
  178. package/core/steps/business-language.md +56 -0
  179. package/core/steps/capture-lesson.md +79 -0
  180. package/core/steps/context-loader.md +311 -0
  181. package/core/steps/gate.md +88 -0
  182. package/core/steps/report-footer.md +100 -0
  183. package/core/steps/review-fanout.md +159 -0
  184. package/core/steps/spawn-agent.md +129 -0
  185. package/core/steps/trace-mirror.md +26 -0
  186. package/core/templates/architecture.template.md +113 -0
  187. package/core/templates/design-spec.template.md +217 -0
  188. package/core/templates/feature.template +120 -0
  189. package/core/templates/platform-guide.template.md +145 -0
  190. package/core/templates/prd.template.md +224 -0
  191. package/core/templates/product-definition.template.md +188 -0
  192. package/core/templates/project-context.yaml +161 -0
  193. package/core/templates/tech-design.template.md +498 -0
  194. package/docs/01-getting-started/README.md +19 -0
  195. package/docs/01-getting-started/core-concepts.md +102 -0
  196. package/docs/01-getting-started/installation.md +156 -0
  197. package/docs/01-getting-started/quickstart.md +86 -0
  198. package/docs/02-guides/README.md +26 -0
  199. package/docs/02-guides/bdd-input-checklist.md +68 -0
  200. package/docs/02-guides/developer/README.md +49 -0
  201. package/docs/02-guides/developer/bdd-and-trace.md +126 -0
  202. package/docs/02-guides/developer/commands.md +76 -0
  203. package/docs/02-guides/developer/pr-checklist.md +16 -0
  204. package/docs/02-guides/developer/scenarios.md +460 -0
  205. package/docs/02-guides/developer/workflow.md +121 -0
  206. package/docs/02-guides/prd-input-checklist.md +94 -0
  207. package/docs/02-guides/product-owner/README.md +81 -0
  208. package/docs/02-guides/product-owner/commands.md +30 -0
  209. package/docs/02-guides/product-owner/handoff-checklist.md +42 -0
  210. package/docs/02-guides/product-owner/prd-writing-rules.md +45 -0
  211. package/docs/02-guides/product-owner/scenarios.md +438 -0
  212. package/docs/02-guides/tech-docs-input-checklist.md +109 -0
  213. package/docs/02-guides/tester/README.md +75 -0
  214. package/docs/02-guides/tester/bug-reporting.md +117 -0
  215. package/docs/02-guides/tester/qc-automation.md +165 -0
  216. package/docs/02-guides/tester/reading-specs.md +79 -0
  217. package/docs/02-guides/tester/scenarios.md +186 -0
  218. package/docs/02-guides/tester/spec-manifest.md +130 -0
  219. package/docs/02-guides/tester/test-checklist.md +31 -0
  220. package/docs/02-guides/tester/workflow.md +77 -0
  221. package/docs/03-concepts/README.md +20 -0
  222. package/docs/03-concepts/architecture.md +248 -0
  223. package/docs/03-concepts/mechanisms-explained.md +124 -0
  224. package/docs/03-concepts/pipeline.md +278 -0
  225. package/docs/03-concepts/traceability.md +152 -0
  226. package/docs/04-operations/README.md +33 -0
  227. package/docs/04-operations/bug-flow.md +364 -0
  228. package/docs/04-operations/publishing.md +154 -0
  229. package/docs/04-operations/sync-and-update.md +522 -0
  230. package/docs/05-reference/README.md +34 -0
  231. package/docs/05-reference/command-cheatsheet.md +147 -0
  232. package/docs/05-reference/commands.md +234 -0
  233. package/docs/05-reference/model-selection.md +74 -0
  234. package/docs/05-reference/modules.md +110 -0
  235. package/docs/05-reference/trace-schema.md +154 -0
  236. package/docs/06-commands/README.md +75 -0
  237. package/docs/06-commands/explain-debug.md +32 -0
  238. package/docs/06-commands/explain-define-product.md +43 -0
  239. package/docs/06-commands/explain-dev-gen-test.md +28 -0
  240. package/docs/06-commands/explain-dev-run-test.md +24 -0
  241. package/docs/06-commands/explain-dev-smoke-test.md +25 -0
  242. package/docs/06-commands/explain-fix-bug.md +28 -0
  243. package/docs/06-commands/explain-generate-bdd.md +45 -0
  244. package/docs/06-commands/explain-generate-code.md +53 -0
  245. package/docs/06-commands/explain-generate-design-spec.md +54 -0
  246. package/docs/06-commands/explain-generate-prd.md +45 -0
  247. package/docs/06-commands/explain-generate-spec-manifest.md +20 -0
  248. package/docs/06-commands/explain-generate-tech-docs.md +56 -0
  249. package/docs/06-commands/explain-learn.md +21 -0
  250. package/docs/06-commands/explain-map-testids.md +28 -0
  251. package/docs/06-commands/explain-propose-scenario.md +24 -0
  252. package/docs/06-commands/explain-qc-analyze.md +22 -0
  253. package/docs/06-commands/explain-qc-design-test.md +20 -0
  254. package/docs/06-commands/explain-qc-plan.md +21 -0
  255. package/docs/06-commands/explain-qc-report.md +23 -0
  256. package/docs/06-commands/explain-qc-review.md +24 -0
  257. package/docs/06-commands/explain-qc-run-test.md +27 -0
  258. package/docs/06-commands/explain-refine-prd.md +51 -0
  259. package/docs/06-commands/explain-report-bug.md +24 -0
  260. package/docs/06-commands/explain-review-code.md +45 -0
  261. package/docs/06-commands/explain-review-context.md +68 -0
  262. package/docs/06-commands/explain-review-tech-docs.md +45 -0
  263. package/docs/06-commands/explain-setup-ai-first.md +25 -0
  264. package/docs/06-commands/explain-sync.md +24 -0
  265. package/docs/06-commands/explain-update-framework.md +22 -0
  266. package/docs/06-commands/explain-validate-traces.md +25 -0
  267. package/docs/README.md +53 -0
  268. package/docs/t-sample.md +826 -0
  269. package/hooks/data-guard.js +141 -0
  270. package/hooks/settings.json +18 -0
  271. package/modules/android-compose/module.yaml +13 -0
  272. package/modules/android-compose/stack-profile.yaml +57 -0
  273. package/modules/angular/architecture-snippets/component-patterns.md +187 -0
  274. package/modules/angular/module.yaml +6 -0
  275. package/modules/angular/stack-profile.yaml +38 -0
  276. package/modules/context-engineering/architecture-snippets/context-design.md +119 -0
  277. package/modules/context-engineering/module.yaml +9 -0
  278. package/modules/context-engineering/stack-profile.yaml +61 -0
  279. package/modules/dotnet/architecture-snippets/clean-arch.md +160 -0
  280. package/modules/dotnet/module.yaml +6 -0
  281. package/modules/dotnet/stack-profile.yaml +50 -0
  282. package/modules/flutter/module.yaml +14 -0
  283. package/modules/flutter/stack-profile.yaml +59 -0
  284. package/modules/golang/architecture-snippets/domain-layout.md +283 -0
  285. package/modules/golang/module.yaml +6 -0
  286. package/modules/golang/stack-profile.yaml +40 -0
  287. package/modules/ios-swiftui/module.yaml +13 -0
  288. package/modules/ios-swiftui/stack-profile.yaml +55 -0
  289. package/modules/java-spring/architecture-snippets/layered-arch.md +201 -0
  290. package/modules/java-spring/module.yaml +15 -0
  291. package/modules/java-spring/stack-profile.yaml +28 -0
  292. package/modules/nextjs/architecture-snippets/app-router-patterns.md +269 -0
  293. package/modules/nextjs/module.yaml +14 -0
  294. package/modules/nextjs/stack-profile.yaml +74 -0
  295. package/modules/nuxt/module.yaml +14 -0
  296. package/modules/nuxt/stack-profile.yaml +58 -0
  297. package/modules/php-laravel/architecture-snippets/service-repository.md +302 -0
  298. package/modules/php-laravel/module.yaml +15 -0
  299. package/modules/php-laravel/stack-profile.yaml +56 -0
  300. package/modules/qc-playwright/stack-profile.yaml +66 -0
  301. package/modules/react/architecture-snippets/hooks-query-patterns.md +254 -0
  302. package/modules/react/module.yaml +14 -0
  303. package/modules/react/stack-profile.yaml +63 -0
  304. package/modules/react-native/module.yaml +14 -0
  305. package/modules/react-native/stack-profile.yaml +56 -0
  306. package/modules/vue/module.yaml +14 -0
  307. package/modules/vue/stack-profile.yaml +65 -0
  308. package/package.json +49 -0
  309. package/readme.txt +1 -0
  310. package/rules/data-protection.md +80 -0
  311. package/rules/workflow.md +44 -0
  312. package/scripts/init.sh +49 -0
  313. package/scripts/migrate-specs.js +258 -0
  314. package/scripts/rename-prd-files.js +174 -0
  315. package/scripts/upgrade.sh +94 -0
  316. package/skills/code/SKILL.md +19 -0
  317. package/skills/code/SKILL.tmpl +19 -0
  318. package/skills/debug/SKILL.md +19 -0
  319. package/skills/debug/SKILL.tmpl +19 -0
  320. package/skills/design-spec/SKILL.md +11 -0
  321. package/skills/design-spec/SKILL.tmpl +11 -0
  322. package/skills/discovery/SKILL.md +14 -0
  323. package/skills/discovery/SKILL.tmpl +14 -0
  324. package/skills/prd/SKILL.md +19 -0
  325. package/skills/prd/SKILL.tmpl +19 -0
  326. package/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  327. package/skills/qc/qa-analyst/acceptance-criteria.md +60 -0
  328. package/skills/qc/qa-analyst/business-rules.md +59 -0
  329. package/skills/qc/qa-analyst/data-flow.md +64 -0
  330. package/skills/qc/qa-analyst/spec-breakdown.md +61 -0
  331. package/skills/qc/qa-designer/e2e/journey.md +41 -0
  332. package/skills/qc/qa-designer/exploratory/charter.md +68 -0
  333. package/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  334. package/skills/qc/qa-designer/functional/api.md +45 -0
  335. package/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  336. package/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  337. package/skills/qc/qa-designer/integration/api.md +42 -0
  338. package/skills/qc/qa-designer/integration/db.md +39 -0
  339. package/skills/qc/qa-designer/integration/gui.md +40 -0
  340. package/skills/qc/qa-designer/integration/kafka.md +40 -0
  341. package/skills/qc/qa-designer/non-functional.md +40 -0
  342. package/skills/qc/qa-planner/test-plan.md +120 -0
  343. package/skills/qc/qa-reviewer/script/e2e.md +87 -0
  344. package/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  345. package/skills/qc/qa-reviewer/script/functional.md +101 -0
  346. package/skills/qc/qa-reviewer/script/integration.md +91 -0
  347. package/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  348. package/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  349. package/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  350. package/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  351. package/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  352. package/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  353. package/skills/qc/qa-runner/e2e.md +49 -0
  354. package/skills/qc/qa-runner/exploratory/session.md +36 -0
  355. package/skills/qc/qa-runner/functional/api.md +35 -0
  356. package/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  357. package/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  358. package/skills/qc/qa-runner/integration.md +47 -0
  359. package/skills/qc/qa-runner/non-functional.md +49 -0
  360. package/skills/qc/qa-runner/report/report.md +37 -0
  361. package/skills/setup-ai-first/SKILL.md +11 -0
  362. package/skills/setup-ai-first/SKILL.tmpl +11 -0
  363. package/skills/spec/SKILL.md +19 -0
  364. package/skills/spec/SKILL.tmpl +19 -0
  365. package/skills/test/SKILL.md +18 -0
  366. package/skills/test/SKILL.tmpl +18 -0
  367. package/steps/business-language.md +56 -0
  368. package/steps/capture-lesson.md +79 -0
  369. package/steps/context-loader.md +311 -0
  370. package/steps/gate.md +88 -0
  371. package/steps/report-footer.md +100 -0
  372. package/steps/review-fanout.md +159 -0
  373. package/steps/spawn-agent.md +129 -0
  374. package/steps/trace-mirror.md +26 -0
  375. package/templates/architecture.template.md +113 -0
  376. package/templates/design-spec.template.md +217 -0
  377. package/templates/feature.template +120 -0
  378. package/templates/platform-guide.template.md +145 -0
  379. package/templates/prd.template.md +224 -0
  380. package/templates/product-definition.template.md +188 -0
  381. package/templates/project-context.yaml +161 -0
  382. package/templates/tech-design.template.md +498 -0
@@ -0,0 +1,120 @@
1
+ # ============================================================
2
+ # @trace.id: {TICKET-ID}-UC{N}
3
+ # @trace.title: <Feature name>
4
+ # @trace.revision: 1 ← field tĩnh; dùng @trace.bdd_version để theo dõi version (tăng bởi /review-context --fix hoặc --resume)
5
+ # @trace.domain: <domain>
6
+ # @trace.platform: {active_platform — web | app | system | (bỏ trong umbrella mode)}
7
+ # @trace.service: {active_service — bỏ trong spec repo mode}
8
+ # @trace.module: {active_module trong umbrella mode; "unknown" trong spec repo mode}
9
+ # @trace.status: draft
10
+ # @trace.author: AI-generated
11
+ # @trace.created_at: {YYYY-MM-DD}
12
+ # @trace.prd: {TICKET-ID}
13
+ # @trace.prd_version: {đọc từ metadata PRD "| **Version** |"}
14
+ # @trace.bdd_version: {1.0 nếu gen mới; tăng 0.1 khi gen lại — vd 1.0 → 1.1}
15
+ # @trace.business_rules: {TICKET-ID}-UC{N}-BR1, {TICKET-ID}-UC{N}-BR2
16
+ # @trace.dataset: {domain}.testdata.yaml
17
+ # ============================================================
18
+
19
+ # === CONTEXT ===
20
+ # Actor: <vai trò thực hiện hành động, vd: Consumer, Staff, System>
21
+ # Screens: <các màn liên quan, vd: Cart → Confirm Order → Order Detail>
22
+ # Entities: <business entity, vd: Order, OrderItem, Consumer>
23
+ # Pre-state: <state dùng chung trước khi vào các scenario>
24
+
25
+ # === SCOPE ===
26
+ # In: <UC này phủ gì>
27
+ # Out: <cái gì KHÔNG thuộc UC này — link tới UC/feature khác (R10)>
28
+
29
+ # === BUSINESS DEFINITION ===
30
+ # Tham chiếu nhanh các term dùng trong feature này. Chi tiết SoT: business-dictionary.md
31
+ # <Term 1>: <định nghĩa ngắn>
32
+ # <Term 2>: <định nghĩa ngắn>
33
+ #
34
+ # --- Popup/Modal Lifecycle (tùy chọn — BẮT BUỘC nếu feature là popup/modal; Pre-merge yêu cầu) ---
35
+ # - Open trigger: <khi nào popup hiển thị, vd: click menu sidebar>
36
+ # - Close trigger: <khi nào popup đóng, vd: F5 / click X / ESC / navigate away>
37
+ # - Refresh model: <data refresh khi nào, vd: mỗi lần open (NO CACHE) / persisted / polling>
38
+ # - State reset: <state nào reset khi đóng/mở lại, vd: pagination, expand, dropdown selection>
39
+ #
40
+ # --- Display Logic Matrix (tùy chọn — BẮT BUỘC nếu display logic phụ thuộc ≥2 chiều; Pre-merge yêu cầu) ---
41
+ # Liệt kê đủ ma trận N×M case + map mỗi case → SC. Tên SC theo pattern `<cấu trúc>: <outcome>` (KHÔNG dùng "(Case X)").
42
+ # | # | Dim1 | Dim2 | Format hiển thị | SC |
43
+ # |---|------|------|------------------------|------|
44
+ # | 1 | 0 | 0 | `Tên hàng` | SC{} |
45
+ # | 2 | 0 | 1 | `Tên hàng (đơn vị)` | SC{} |
46
+ # | ... | ... | ... | ... | ... |
47
+
48
+ Feature: <Feature name>
49
+ As a <role>
50
+ I want to <action>
51
+ So that <business value>
52
+
53
+ Background:
54
+ Given <precondition dùng chung — dùng alias từ dataset, không phải ID kỹ thuật>
55
+
56
+ # ==========================================================
57
+ # NHÓM 1: <Business theme> (<BR refs>)
58
+ # ==========================================================
59
+
60
+ # Side-effects: <liệt kê ngắn các Then side-effect cần verify>
61
+ # @trace.scenario: {TICKET-ID}-UC{N}-SC1
62
+ # @trace.sc_version: 1.0
63
+ # @trace.business_rules: {TICKET-ID}-UC{N}-BR1
64
+ @happy
65
+ Scenario: <mô tả business outcome — dùng động từ chính xác: create/receive/assign/block>
66
+ Given <input state — alias từ dataset>
67
+ When <single action>
68
+ Then <main observable outcome>
69
+ And <side-effect 1 khai báo trong header>
70
+
71
+ # Side-effects: <...>
72
+ # @trace.scenario: {TICKET-ID}-UC{N}-SC2
73
+ # @trace.sc_version: 1.0
74
+ # @trace.business_rules: {TICKET-ID}-UC{N}-BR1
75
+ @happy @alternative
76
+ Scenario: <cùng theme NHÓM 1 nhưng path khác — vd: giá trị enum khác>
77
+ Given <state>
78
+ When <action>
79
+ Then <outcome>
80
+
81
+ # ==========================================================
82
+ # NHÓM 2: <Business theme 2> (<BR refs>)
83
+ # ==========================================================
84
+
85
+ # Side-effects: <...>
86
+ # @trace.scenario: {TICKET-ID}-UC{N}-SC3
87
+ # @trace.sc_version: 1.0
88
+ # @trace.business_rules: {TICKET-ID}-UC{N}-BR2
89
+ @edge
90
+ Scenario: <scenario boundary / error>
91
+ Given <state>
92
+ When <action>
93
+ Then <expected error handling>
94
+
95
+ # === PRD COVERAGE (C.1 + C.2) ===
96
+ # AC mapping:
97
+ # AC1 (...) → SC1, SC2
98
+ # AC2 (...) → SC3
99
+ # BR mapping (mỗi bullet PHẢI có ≥1 SC — C.2):
100
+ # {TICKET-ID}-UC{N}-BR1 (...) → SC1, SC2
101
+ # {TICKET-ID}-UC{N}-BR2 (...) → SC3
102
+ # Wireframe mapping (mỗi component/action ≥1 SC — C.1):
103
+ # Screen "<screen name>":
104
+ # [x] <action 1> → SC1
105
+ # [x] <action 2> → SC2
106
+ # [ ] <action 3> → MISSING ← BLOCK MERGE
107
+ # Design Spec coverage (chỉ FE/App — C.1 mở rộng; bỏ khối này nếu không nạp design-spec):
108
+ # Screen "<screen>": loading → SC?, error → SC?, empty → SC?
109
+ # AC-UI behavioral: AC-UI3 (lỗi+khôi phục) → SC?, AC-UI4 (empty CTA) → SC?
110
+ # (bỏ AC-UI visual thuần: AC-UI1 khớp Figma, AC-UI5 WCAG — Designer/QA review riêng)
111
+
112
+ # === PRE-MERGE CHECKLIST ===
113
+ # - [ ] Mỗi SC có Side-effects + @trace.scenario + @trace.sc_version + @trace.business_rules
114
+ # - [ ] Coverage Matrix: 0 dòng MISSING (C.1)
115
+ # - [ ] FE/App: mỗi Screen State (≠default) + AC-UI behavioral của design-spec có ≥1 SC (C.1 mở rộng)
116
+ # - [ ] Mỗi AC/BR map tới ≥1 SC (C.2)
117
+ # - [ ] 0 banned term (C.4) — grep file trước khi merge
118
+ # - [ ] Feature ≥3 SC có NHÓM grouping theo business theme (C.5)
119
+ # - [ ] Nếu popup/modal: khai báo Popup/Modal Lifecycle trong BUSINESS DEFINITION
120
+ # - [ ] Nếu display logic ≥2 chiều: Display Logic Matrix trong BUSINESS DEFINITION
@@ -0,0 +1,145 @@
1
+ # Platform Guide — {{SERVICE_NAME}}
2
+
3
+ > Guide này cung cấp context mà Claude dùng khi làm việc trong service/repository NÀY.
4
+ > Giữ ngắn gọn và đúng sự thật. Cập nhật khi kiến trúc hoặc domain model thay đổi.
5
+ > Tham chiếu: CLAUDE.md cho chuẩn toàn dự án. File này phủ context riêng của service.
6
+
7
+ ---
8
+
9
+ # §1. Service Overview
10
+
11
+ **Tên service**: {{SERVICE_NAME}}
12
+ **Mục đích**: {{ONE_SENTENCE_PURPOSE}}
13
+ **Bounded context**: {{BOUNDED_CONTEXT}} # vd: "Sở hữu toàn bộ logic vòng đời order. KHÔNG sở hữu payment hay inventory."
14
+ **Team**: {{TEAM_NAME}}
15
+ **Repository**: {{REPO_URL}}
16
+
17
+ Trách nhiệm chính:
18
+ - {{RESPONSIBILITY_1}}
19
+ - {{RESPONSIBILITY_2}}
20
+ - {{RESPONSIBILITY_3}}
21
+
22
+ Service này KHÔNG xử lý:
23
+ - {{OUT_OF_SCOPE_1}} # vd: "Xử lý payment → xem payment-service"
24
+ - {{OUT_OF_SCOPE_2}}
25
+
26
+ ---
27
+
28
+ # §2. Domain Model
29
+
30
+ Các entity chính và quan hệ của chúng:
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
+ - Field chính: {{KEY_FIELDS}}
43
+ - Vòng đời status: {{STATUS_1}} → {{STATUS_2}} → {{STATUS_3}}
44
+ - Business rule: {{KEY_RULE_1}}
45
+
46
+ **{{ENTITY_2}}**:
47
+ - Field chính: {{KEY_FIELDS}}
48
+ - Quan hệ: {{RELATIONSHIP_DESCRIPTION}}
49
+
50
+ ---
51
+
52
+ # §3. Common Patterns
53
+
54
+ Các pattern riêng của service này (bổ sung cho chuẩn toàn dự án trong CLAUDE.md):
55
+
56
+ ## {{PATTERN_NAME_1}}
57
+ ```
58
+ // Khi nào dùng: {{USE_CASE}}
59
+ // Ví dụ:
60
+ {{CODE_EXAMPLE}}
61
+ ```
62
+
63
+ ## {{PATTERN_NAME_2}}
64
+ ```
65
+ // Khi nào dùng: {{USE_CASE}}
66
+ // Ví dụ:
67
+ {{CODE_EXAMPLE}}
68
+ ```
69
+
70
+ ---
71
+
72
+ # §4. Integration Points
73
+
74
+ ## Upstream Dependencies (service này gọi các bên dưới)
75
+
76
+ | Service / System | Cái ta gọi | 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 (các bên dưới gọi ta hoặc tiêu thụ event của ta)
82
+
83
+ | Consumer | Cái họ dùng | Protocol |
84
+ |----------|---------------|----------|
85
+ | {{DOWNSTREAM_1}} | {{WHAT}} | REST/Event |
86
+ | {{DOWNSTREAM_2}} | {{WHAT}} | REST/Event |
87
+
88
+ ## Event phát ra (Produced)
89
+
90
+ | Tên event | Trigger | Tóm tắt payload |
91
+ |------------|---------|-----------------|
92
+ | {{EVENT_1}} | {{WHEN}} | {{PAYLOAD_FIELDS}} |
93
+ | {{EVENT_2}} | {{WHEN}} | {{PAYLOAD_FIELDS}} |
94
+
95
+ ## Event tiêu thụ (Consumed)
96
+
97
+ | Tên event | Từ service | Ta làm gì với nó |
98
+ |------------|-------------|-------------------|
99
+ | {{EVENT_1}} | {{SOURCE}} | {{HANDLER_ACTION}} |
100
+
101
+ ---
102
+
103
+ # §5. Known Constraints
104
+
105
+ ## Ràng buộc hiệu năng (Performance)
106
+ - {{PERF_CONSTRAINT_1}} # vd: "Endpoint danh sách order phải phản hồi < 200ms cho tới 1000 order"
107
+ - {{PERF_CONSTRAINT_2}}
108
+
109
+ ## Ràng buộc business rule
110
+ - {{BUSINESS_CONSTRAINT_1}} # vd: "Không thể huỷ order sau khi đã ship"
111
+ - {{BUSINESS_CONSTRAINT_2}}
112
+
113
+ ## Phụ thuộc bên ngoài (External)
114
+ - {{EXTERNAL_DEP_1}} # vd: "Cần inventory-service sẵn sàng để tạo order"
115
+ - {{EXTERNAL_DEP_2}}
116
+
117
+ ## Technical Debt đã biết
118
+ - {{TECH_DEBT_1}} # vd: "OrderItem.price bị nhân bản từ catalog — đồng bộ qua job hằng đêm"
119
+
120
+ ---
121
+
122
+ # §6. Directory Structure
123
+
124
+ ```
125
+ {{SERVICE_ROOT}}/
126
+ ├── {{SOURCE_DIR}}/ # Code nguồn chính
127
+ │ ├── {{LAYER_1}}/ # vd: controller/ hoặc handler/
128
+ │ │ └── {{EXAMPLE_FILE}}
129
+ │ ├── {{LAYER_2}}/ # vd: service/ hoặc usecase/
130
+ │ │ └── {{EXAMPLE_FILE}}
131
+ │ ├── {{LAYER_3}}/ # vd: repository/ hoặc repo/
132
+ │ │ └── {{EXAMPLE_FILE}}
133
+ │ └── {{LAYER_4}}/ # vd: model/ hoặc domain/
134
+ │ └── {{EXAMPLE_FILE}}
135
+ ├── {{TEST_DIR}}/ # Test phản chiếu cấu trúc src
136
+ ├── specs/ # File BDD feature
137
+ │ └── bdd/
138
+ │ └── {{DOMAIN}}/
139
+ │ └── {{UC-ID}}-{{slug}}.feature
140
+ └── {{CONFIG_FILE}} # vd: application.yaml / appsettings.json
141
+ ```
142
+
143
+ **Convention chính của repo này:**
144
+ - {{CONVENTION_1}} # vd: "Mọi DTO nằm trong package api/, không trộn với domain model"
145
+ - {{CONVENTION_2}} # vd: "Integration test nằm ở src/test/java/.../integration/ với @Tag(\"integration\")"
@@ -0,0 +1,224 @@
1
+ # {TICKET}-{N} {Feature Name}
2
+
3
+ <!--
4
+ Template này được sử dụng bởi workflow /generate-prd.
5
+ AI Agent sẽ điền các section dựa trên input từ PO.
6
+ Các placeholder {…} cần được thay thế bằng nội dung thực tế.
7
+
8
+ FORMAT CHUẨN: Business Rule = bảng 3 cột
9
+ ID | Business Rule | Business Logic (KHÔNG tách Business Logic ra khối riêng).
10
+
11
+ TERMINOLOGY:
12
+ - Tuân thủ 100% từ điển project: specs/domain-knowledge/business-dictionary.md
13
+ (KHÔNG dùng từ điển của project khác). Thay banned term bằng canonical term;
14
+ nếu phát hiện banned term trong input PO → thay + ghi chú trong "Giả định AI".
15
+ - Status/Enum values → tham chiếu core-entities.md (Enum Registry).
16
+
17
+ CROSS-REFERENCE (BẮT BUỘC): Bất kỳ chỗ nào nhắc đến một tính năng/ticket khác
18
+ (pre-condition, business rule, giả định, AC, hay bất kỳ section nào) → PHẢI gắn inline link:
19
+ [TICKET-ID khác](../{prd-slug-khác}/{TICKET-ID-khác}-{prd-slug-khác}.md)
20
+ Không để TICKET-ID dạng plain text nếu tồn tại file PRD tương ứng. (Mỗi PRD nằm trong feature-package riêng nên link trỏ sang folder anh em `../{prd-slug-khác}/`.)
21
+ Ngoài ra, ghi rõ quan hệ phụ thuộc trong "Tài liệu tham khảo" ở Appendix.
22
+
23
+ NEW TERM DETECTION: Nếu input PO xuất hiện thuật ngữ CHƯA CÓ trong business-dictionary.md
24
+ và lặp lại ≥ 2 lần → DỪNG lại, hỏi PO confirm trước khi tiếp tục:
25
+ + Thuật ngữ đó nghĩa gì trong ngữ cảnh hệ thống?
26
+ + English term chuẩn nên dùng là gì?
27
+ + Có cần bổ sung vào business-dictionary.md không?
28
+ Sau khi PO confirm → cập nhật business-dictionary.md (nếu PO đồng ý) rồi mới tiếp tục.
29
+
30
+ NUMBERING:
31
+ - UC ID: {TICKET}-{N}-UC{n} (n bắt đầu từ 1, tăng theo từng use case)
32
+ - BR ID: {TICKET}-{N}-UC{n}-BR{m} (m tăng LIÊN TỤC xuyên suốt PRD, KHÔNG reset mỗi UC)
33
+ -->
34
+
35
+ ---
36
+
37
+ ## Metadata
38
+
39
+ | Field | Value |
40
+ |---------------|------------------------------------------|
41
+ | **PRD ID** | {TICKET}-{N} |
42
+ | **Version** | 1.0 |
43
+ | **Status** | draft |
44
+ | **Author** | AI-assisted |
45
+ | **PO** | {tên PO} |
46
+ | **Domain** | {domain} |
47
+ | **Created** | {date} |
48
+ | **Updated** | {date} |
49
+ | **Ticket** | {TICKET}-{N}{ — nếu PO có link tracker thật, thêm bên cạnh: `{TICKET}-{N} ([Jira]({tracker_url}))`} |
50
+ | **API Source** | *(để trống nếu greenfield — chỉ điền `existing` khi PRD bọc một API đã chạy production)* |
51
+
52
+ ---
53
+
54
+ # Feature
55
+
56
+ **{Feature Name}**
57
+
58
+ {Đoạn mô tả tổng quan: feature làm gì, cho ai, giải quyết vấn đề gì — lấy từ product-definition.}
59
+
60
+ ---
61
+
62
+ # 1. Tổng quan
63
+
64
+ ## a. User Story
65
+
66
+ - **Là một (As a)** {persona}
67
+ - **Tôi muốn (I want to)** {action}
68
+ - **Để (So that)** {benefit}
69
+
70
+ ## b. Phạm vi
71
+
72
+ > **Scope = ranh giới, KHÔNG phải đặc tả.** Mỗi mục một dòng ngắn "làm gì / không làm gì". Đừng nhét **cơ chế** (retry/timeout/nhánh lỗi → BR/BL) hay **định nghĩa thuật ngữ** (vd "điểm khởi tạo = …" → Business Definition / business-dictionary) vào đây.
73
+
74
+ **In Scope**
75
+ - {hạng mục trong phạm vi 1}
76
+ - {hạng mục trong phạm vi 2}
77
+
78
+ **Out of Scope** *(chỉ thêm khi có ranh giới cần nói rõ)*
79
+ - {hạng mục ngoài phạm vi + lý do / chủ sở hữu}
80
+
81
+ ## c. Phụ thuộc liên service *(mức nghiệp vụ — KHÔNG mô tả API/event/kỹ thuật)*
82
+
83
+ > Kế thừa từ Product Definition Phase 1 ("Phụ thuộc liên service"). Nếu contract do đối tác phát triển song song (xem `API Source`), ghi phụ thuộc partner vào đây.
84
+
85
+ - {Cần {dữ liệu/năng lực} từ {feature/team/partner} — vì {lý do nghiệp vụ}} — hoặc "Không có"
86
+
87
+ ---
88
+
89
+ # 2. Acceptance Criteria
90
+
91
+ > Mỗi AC kế thừa liên kết "Bắt nguồn từ BR" của Product Definition (Phase 6), remap sang BR ID của PRD. Vì BR ID đã chứa số UC nên ref BR truy ngược được tới đúng UC.
92
+ >
93
+ > **1 AC = 1 tiêu chí NGHIỆM THU (outcome quan sát/kiểm được) + ref BR.** KHÔNG viết cơ chế trong AC (số lần retry, timeout, tên/chủ cờ, nhánh lỗi chi tiết) — cái đó thuộc **BR/BL** ở §3, AC chỉ trỏ tới. Nếu tiêu chí có **nhiều nhánh** → tách **bullet con** (mỗi ý một dòng), đừng dồn thành câu dài. Khi `/refine-prd` làm rõ thêm: chi tiết cơ chế → đẩy sang BR/BL; ở tầng AC thì tách bullet/AC mới — KHÔNG nối mệnh đề vào câu cũ (tránh AC thành "đoạn văn" và trùng BR).
94
+
95
+ **AC1:** {Tiêu chí nghiệm thu, văn xuôi, kiểm chứng được.} _(BR: {TICKET}-{N}-UC{n}-BR{m})_
96
+
97
+ **AC2:** {Tiêu chí có nhiều nhánh — tách bullet:} _(BR: {TICKET}-{N}-UC{n}-BR{m})_
98
+ - {nhánh/điều kiện 1 → kết quả kỳ vọng}
99
+ - {nhánh/điều kiện 2 → kết quả kỳ vọng}
100
+
101
+ ---
102
+
103
+ # 3. Use Case
104
+
105
+ #### {TICKET}-{N}-UC1: {Tên use case}
106
+
107
+ **Actor:** {actor}
108
+
109
+ **Description:** {mô tả luồng}
110
+
111
+ **Pre-condition:**
112
+ - {điều kiện trước 1}
113
+
114
+ **Post-condition:**
115
+ - {kết quả sau 1}
116
+
117
+ **AC liên quan:** AC{x}, AC{y} *(các AC mà UC này thoả — phải đúng bằng tập AC có ref BR trỏ về UC này ở §2)*
118
+
119
+ **Business Rule**
120
+
121
+ | ID | Business Rule | Business Logic |
122
+ |----|---------------|----------------|
123
+ | {TICKET}-{N}-UC1-BR1 | {luật ngắn gọn} | - {logic chi tiết, xuống dòng bằng `<br/>`}<br/>- {…} |
124
+ | {TICKET}-{N}-UC1-BR2 | {…} | - {…} |
125
+
126
+ ---
127
+
128
+ #### {TICKET}-{N}-UC2: {Tên use case}
129
+
130
+ {lặp cấu trúc UC như trên; BR đánh số tiếp tục BR3, BR4…}
131
+
132
+ ---
133
+
134
+ # 4. UI/UX Guidelines
135
+
136
+ ## a. User Flow
137
+
138
+ ```mermaid
139
+ flowchart TD
140
+ START(["{điểm bắt đầu}"]) --> A{"{điểm quyết định}"}
141
+ A -->|{nhánh}| B["{bước}"]
142
+ ```
143
+
144
+ ## b. Wireframe
145
+
146
+ ### Screen 1: {Tên màn}
147
+
148
+ | Thành phần | Chi tiết |
149
+ |------------|----------|
150
+ | **Screen** | {tên/ngữ cảnh màn} |
151
+ | **Components** | - {thành phần 1}<br/>- {thành phần 2} |
152
+ | **Actions** | - {hành động 1 → kết quả}<br/>- {hành động 2 → kết quả} |
153
+
154
+ ---
155
+
156
+ ### Screen 2: {Tên màn}
157
+
158
+ {lặp bảng như trên cho từng màn}
159
+
160
+ ---
161
+
162
+ # Appendix
163
+
164
+ ## Input gốc từ PO
165
+
166
+ > {Trích nguyên văn input/ghi chú gốc của PO + đường dẫn product-definition nguồn.}
167
+
168
+ ## Tài liệu tham khảo
169
+
170
+ - [{TICKET liên quan}](../{prd-slug-khác}/{TICKET-ID-khác}-{prd-slug-khác}.md) — {quan hệ: pre-condition / overlapping / related…}
171
+ - BDD: [`./bdd/`](./bdd/)
172
+ - Design spec: [`./design-spec/`](./design-spec/) — không áp dụng với feature thuần backend (không có màn hình)
173
+ - Từ điển nghiệp vụ: [`specs/domain-knowledge/business-dictionary.md`](../../domain-knowledge/business-dictionary.md)
174
+ - Domain knowledge: [`specs/domain-knowledge/{domain}.md`](../../domain-knowledge/{domain}.md)
175
+
176
+ ## Existing API Contract *(CHỈ brownfield — điền khi API Source = existing; greenfield BỎ QUA cả section này)*
177
+
178
+ <!--
179
+ Chỉ dùng khi PRD bọc một API đã tồn tại trên hệ thống. PO ghi lại contract để:
180
+ - /generate-bdd (system) dùng trực tiếp làm input — không cần tổng hợp từ FE/App BDD;
181
+ - /generate-tech-docs chạy mode reverse-document (mô tả lại as-is, không design mới);
182
+ - /review-tech-docs bỏ qua cổng T7 cross-team sign-off (contract đã cố định).
183
+ Nếu greenfield (thiết kế mới) → xoá toàn bộ section này.
184
+ -->
185
+
186
+ | Method | Path | Auth | Request | Response |
187
+ |--------|------|------|---------|----------|
188
+ | {GET/POST/PUT/DELETE} | {/api/v1/path} | {Bearer / none} | `{ field: type }` | `{ field: type }` |
189
+
190
+ **Error responses:**
191
+
192
+ | HTTP Status | Error Code | Khi nào xảy ra |
193
+ |-------------|------------|----------------|
194
+ | {4xx/5xx} | {ERR_CODE} | {condition} |
195
+
196
+ ## Giả định AI
197
+
198
+ > {Giả định / độ vênh AI phát hiện khi đối chiếu product-definition với domain-knowledge — cần PO review. AI KHÔNG tự hoà giải.}
199
+
200
+ - **Q1 — [AI DRAFT] {tiêu đề}:** {mô tả độ vênh + nguồn}. **Cần PO chốt {điều gì}.**
201
+
202
+ _(Nếu không có độ vênh: ghi "Không có — toàn bộ nội dung đã được PO xác nhận qua Product Definition.")_
203
+
204
+ ---
205
+
206
+ # Change Log
207
+
208
+ > Hiện tại: **v1.0** ({date}) · Lịch sử đầy đủ → [changelog](./changelog/{TICKET}-{N}-{slug}.changelog.md) *(file kho chỉ tạo khi changelog vượt 5 version)*
209
+
210
+ <!-- Bảng phẳng, MỘT dòng/version, MỚI NHẤT TRÊN CÙNG. Chỉ giữ tối đa 5 version gần nhất ở đây;
211
+ cũ hơn → /refine-prd & /review-context tự dồn (rollover) sang file changelog/ ở link trên. -->
212
+
213
+ | Version | Date | Changes (UC/AC/BR bị ảnh hưởng) |
214
+ |---------|------|---------------------------------|
215
+ | 1.0 | {date} | Bản đầu — sinh từ product-definition. |
216
+
217
+ ---
218
+
219
+ <!--
220
+ NEXT STEPS:
221
+ Khi PRD được approve (status: approved), chạy:
222
+ /generate-bdd "specs/{domain}/{prd-slug}/{TICKET-ID}-{prd-slug}.md"
223
+ để sinh BDD feature specs từ PRD này.
224
+ -->
@@ -0,0 +1,188 @@
1
+ # {TICKET-ID} Product Definition — {Feature Name}
2
+
3
+ <!--
4
+ Template này được dùng bởi workflow /define-product.
5
+ AI Agent điền từng section qua Q&A theo từng phase với PO.
6
+ Output là input có cấu trúc cho /generate-prd.
7
+
8
+ QUY TẮC:
9
+ - Mỗi section tương ứng với 1 phase trong workflow
10
+ - Section chưa đủ → giữ placeholder, KHÔNG được sang phase tiếp theo
11
+ - Trạng thái xác nhận của PO được ghi trong mỗi section
12
+ -->
13
+
14
+ ---
15
+
16
+ ## Metadata
17
+
18
+ | Field | Value |
19
+ |--------------------|--------------------------------|
20
+ | **Ticket** | {TICKET-ID} |
21
+ | **Feature** | {tên tính năng} |
22
+ | **Domain** | {domain} |
23
+ | **PO** | {tên PO} |
24
+ | **Created** | {YYYY-MM-DD} |
25
+ | **Status** | in-progress / completed |
26
+ | **Completed Phase**| {số phase hoàn thành gần nhất} |
27
+
28
+ ---
29
+
30
+ ## Phase 0: Đồng bộ tri thức (Knowledge Sync)
31
+
32
+ > ⚙️ AI tự thu thập — đây là **bối cảnh hệ thống**, KHÔNG phải yêu cầu nghiệp vụ do PO viết. Mục đích: chuẩn hoá thuật ngữ và nhận biết phần đã có để tái sử dụng. Không cần input từ PO.
33
+
34
+ ### Khái niệm / dữ liệu nghiệp vụ liên quan
35
+ - {Khái niệm 1} — {mô tả ngắn}
36
+ - {Khái niệm 2} — {mô tả ngắn}
37
+
38
+ ### Phần hệ thống / feature liên quan
39
+ - {Phần 1}
40
+ - {Phần 2}
41
+
42
+ ### Rule / Logic có sẵn
43
+ - {Rule/logic từ các PRD có sẵn hoặc domain knowledge}
44
+
45
+ ### Chuẩn hoá thuật ngữ
46
+ | Thuật ngữ trong input PO | Thuật ngữ chuẩn (business-dictionary) |
47
+ |--------------------------|---------------------------------------|
48
+ | {thuật ngữ gốc} | {thuật ngữ chuẩn} |
49
+
50
+ ---
51
+
52
+ ## Phase 1: Định nghĩa tính năng (Feature Definition)
53
+
54
+ > ✅ PO xác nhận: {Có/Không}
55
+
56
+ ### Bối cảnh (Context)
57
+ {Bối cảnh nghiệp vụ dẫn đến tính năng này}
58
+
59
+ ### Tuyên bố vấn đề (Problem Statement)
60
+ {Vấn đề cần giải quyết}
61
+
62
+ ### Mục tiêu (Goal)
63
+ {Mục tiêu của tính năng}
64
+
65
+ ### Actor
66
+ | Actor | Vai trò | Chính/Phụ |
67
+ |----------|--------------------|-----------|
68
+ | {Actor} | {mô tả vai trò} | Primary |
69
+
70
+ ### Phạm vi (In Scope)
71
+ - {Chức năng 1}
72
+ - {Chức năng 2}
73
+
74
+ ### Ngoài phạm vi (Out of Scope)
75
+ - {Hạng mục KHÔNG làm trong ticket này — kèm lý do / để dành pha sau}
76
+
77
+ ### User Story
78
+ - **Là một (As a)** {vai trò}
79
+ - **Tôi muốn (I want to)** {mục tiêu}
80
+ - **Để (So that)** {giá trị nghiệp vụ}
81
+
82
+ ### Phụ thuộc liên service *(mức nghiệp vụ)*
83
+
84
+ > Feature này cần **dữ liệu/năng lực** gì từ feature/team khác — KHÔNG mô tả API/event/callback (đó là kỹ thuật, thuộc Tech-docs).
85
+
86
+ - {Cần {dữ liệu/năng lực} từ {feature/team} — vì {lý do nghiệp vụ}} — hoặc "Không có"
87
+
88
+ ---
89
+
90
+ ## Phase 2: Định nghĩa User Flow
91
+
92
+ > ✅ PO xác nhận: {Có/Không}
93
+
94
+ ### Điểm vào (Entry Point)
95
+ {Người dùng bắt đầu tương tác với tính năng như thế nào}
96
+
97
+ ### Các bước của Flow
98
+ | Bước | Hành động | Trạng thái/Kết quả nghiệp vụ | Ghi chú |
99
+ |------|-----------------|------------------------------|------------|
100
+ | 1 | {hành động} | {trạng thái/kết quả nghiệp vụ} | {ghi chú} |
101
+ | 2 | {hành động} | {trạng thái/kết quả nghiệp vụ} | {ghi chú} |
102
+
103
+ ### Màn hình & thành phần chính
104
+ > Mức nghiệp vụ — nguồn cho Wireframe PRD (§4b) và độ phủ BDD (C.1). KHÔNG pixel/layout/màu.
105
+
106
+ | Màn hình | Thành phần chính | Hành động → kết quả nghiệp vụ |
107
+ |----------|------------------|-------------------------------|
108
+ | {màn 1} | {thành phần} | {hành động → kết quả} |
109
+
110
+ ### Điểm ra (Exit Point)
111
+ {Kết quả cuối khi flow hoàn thành}
112
+
113
+ ### Edge Cases / Luồng lỗi & ngoại lệ
114
+ > Các kịch bản thất bại nghiệp vụ ngoài happy path — input thiếu, điều kiện không thoả, thao tác đồng thời, phụ thuộc không sẵn sàng.
115
+ - {Kịch bản: khi {điều kiện bất thường} → {kết quả nghiệp vụ kỳ vọng}}
116
+
117
+ ---
118
+
119
+ ## Phase 3: Nhật ký làm rõ (Clarification Log)
120
+
121
+ > Ghi lại mọi câu hỏi và câu trả lời qua các vòng.
122
+
123
+ ### Vòng {N}
124
+ | # | Nhóm | Câu hỏi | PO trả lời |
125
+ |---|----------|------------|------------|
126
+ | 1 | Context | {câu hỏi} | {trả lời} |
127
+ | 2 | Flow | {câu hỏi} | {trả lời} |
128
+ | 3 | Logic | {câu hỏi} | {trả lời} |
129
+
130
+ ### Mục chưa giải quyết
131
+ - {Mục chưa giải quyết — nếu còn tồn đọng, KHÔNG được sang Phase 4}
132
+
133
+ ---
134
+
135
+ ## Phase 4: Business Rules
136
+
137
+ > ✅ PO xác nhận: {Có/Không}
138
+
139
+ | Rule ID | Hành động/Trigger | Quy tắc | Điều kiện |
140
+ |---------|---------------------|---------------------|------------------------|
141
+ | BR-1 | {hành động từ flow} | {business rule} | {điều kiện áp dụng} |
142
+ | BR-2 | {hành động từ flow} | {business rule} | {điều kiện áp dụng} |
143
+
144
+ ---
145
+
146
+ ## Phase 5: Business Logic
147
+
148
+ > ✅ PO xác nhận: {Có/Không}
149
+
150
+ | Rule ID | Logic nghiệp vụ (rẽ nhánh / công thức / điều kiện) | Thông báo/kết quả nghiệp vụ khi lỗi |
151
+ |---------|---------------------------------------------------|-------------------------------------|
152
+ | BR-1 | {logic nghiệp vụ khi rule kích hoạt} | {vd: báo "Số dư không đủ"} |
153
+ | BR-2 | {logic nghiệp vụ khi rule kích hoạt} | {…} |
154
+
155
+ ---
156
+
157
+ ## Phase 6: Acceptance Criteria
158
+
159
+ > ✅ PO xác nhận: {Có/Không}
160
+
161
+ | AC ID | Mô tả | Hành vi kỳ vọng | Bắt nguồn từ |
162
+ |-------|------------------------|---------------------------|--------------|
163
+ | AC-1 | {mô tả tiêu chí} | {hành vi kỳ vọng} | BR-{N} |
164
+ | AC-2 | {mô tả tiêu chí} | {hành vi kỳ vọng} | BR-{N} |
165
+
166
+ ---
167
+
168
+ ## Phase 7: Báo cáo kiểm chứng (Validation Report)
169
+
170
+ ### Ma trận độ phủ (Coverage Matrix)
171
+ | Hành động Flow | Có Rule? | Có Logic? | Có AC? | Status |
172
+ |----------------|----------|-----------|--------|--------|
173
+ | {Hành động 1} | ✅/❌ | ✅/❌ | ✅/❌ | OK/GAP |
174
+
175
+ ### Xung đột phát hiện
176
+ - {Mô tả xung đột — hoặc "None"}
177
+
178
+ ### Mục còn thiếu
179
+ - {Rule/AC/logic còn thiếu — hoặc "None"}
180
+
181
+ ---
182
+
183
+ <!--
184
+ NEXT STEPS:
185
+ Khi Product Definition hoàn tất (Status: completed), chạy:
186
+ /generate-prd {path-to-this-file}
187
+ để sinh PRD từ Product Definition này.
188
+ -->