@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,161 @@
1
+ # =============================================================
2
+ # Project Context — AI-First Spec-Driven Development
3
+ # =============================================================
4
+ # This is the SINGLE SOURCE OF TRUTH for project-specific
5
+ # paths, tools, and routing used by all workflows.
6
+ #
7
+ # Workflows reference this file for WHERE to find things.
8
+ # Workflow steps define WHAT to do (universal best practices).
9
+ # =============================================================
10
+ #
11
+ # HOW AI AGENTS USE THIS FILE:
12
+ # 1. Open this file at the start of any workflow
13
+ # 2. Parse the YAML structure
14
+ # 3. When a workflow says "→ key.subkey", look up that key
15
+ # and use the resolved value as the actual path
16
+ # 4. All paths are RELATIVE to workspace root
17
+ # 5. For "{domain}", substitute the feature's domain (PRD: row `Domain` in Metadata / folder path; .feature: @trace.domain)
18
+ # =============================================================
19
+
20
+ project:
21
+ name: "{{PROJECT_NAME}}"
22
+ description: "{{PROJECT_DESCRIPTION}}"
23
+
24
+ # ----- File Paths -----
25
+ # All paths are relative to workspace root.
26
+ paths:
27
+ # Feature-Package Layout:
28
+ # specs/{domain}/{prd-slug}/{TICKET-ID}-{prd-slug}.md — PRD document
29
+ # specs/{domain}/{prd-slug}/bdd/ — BDD .feature files
30
+ # specs/{domain}/{prd-slug}/tech-docs/ — Technical design docs
31
+ # specs/{domain}/{prd-slug}/design-spec/ — Design specs (FE/App only)
32
+ # .trace/{domain}/{prd-slug}/{UC-ID}.tsv — Trace state
33
+ #
34
+ # specs_dir is the unified root for all spec artifact types (PRD, BDD, tech-docs, design-spec).
35
+ # prd-slug is derived from the PRD folder path — not a separate config variable.
36
+ specs_dir: "specs"
37
+ templates_dir: "specs/templates"
38
+ feature_template: ".agent/templates/feature.template" # SoT skeleton .feature (dùng bởi /generate-bdd qua {{include}})
39
+ bdd_writing_guide: "specs/templates/bdd-writing-guide.md"
40
+ trace_report: "specs/.trace/trace-report.md"
41
+
42
+ # PRD template (PRDs are at specs/{domain}/{prd-slug}/{TICKET-ID}-{prd-slug}.md)
43
+ prd_template: "specs/templates/prd.template.md"
44
+ refinement_dir: ".agent/review"
45
+
46
+ # QC's OWN analysis/design working docs (qc-analyze/plan/design-test outputs:
47
+ # REQUIREMENT_ANALYSIS.md, DOC_GAPS.md, TEST_PLAN.md, test-cases/*.Test.md).
48
+ # One subfolder per UC: {qc_dir}/{UC-ID}/. Default "docs" (the QC team's own
49
+ # convention), VISIBLE — not hidden under .agent/. NOTE: specs (PRD / .feature /
50
+ # design-spec) are NOT here — they come from the PO spec submodule (spec_source).
51
+ qc_dir: "docs"
52
+
53
+ # WHERE the qc-* commands LOAD their skills from (qa-analyst / qa-designer / qa-planner
54
+ # / qa-reviewer / qa-runner + DOC_GAPS.template.md). Default = the framework-bundled
55
+ # copy at .agent/skills/qc (works standalone). The QC team OWNS these skills in their
56
+ # canonical repo (ai-automation-qc-base) — point this at that repo/submodule (e.g.
57
+ # "qc-base/.claude/skills") so the skills evolve INDEPENDENTLY and are NOT overwritten
58
+ # by framework upgrade (--init / upgrade.sh rewrite only .agent/, never this path).
59
+ qc_skills_dir: ".agent/skills/qc"
60
+
61
+ # Product Definitions
62
+ product_definitions_dir: "specs/product-definition"
63
+ product_definition_template: "specs/templates/product-definition.template.md"
64
+
65
+ # Domain Knowledge
66
+ domain_knowledge_dir: "specs/domain-knowledge"
67
+ business_dictionary: "specs/domain-knowledge/business-dictionary.md"
68
+ core_entities: "specs/domain-knowledge/core-entities.md"
69
+
70
+ # Project Lessons (guardrails accumulated via /learn — loaded by context-loader Step 6.7)
71
+ # Single-service default below. In umbrella/service mode, set this in each service's
72
+ # .agent/project-context.yaml to ".agent/project-lessons.md" (resolved per service_root).
73
+ lessons_file: "specs/domain-knowledge/lessons-learned.md"
74
+
75
+ # Tech Docs (BE-authored API contract).
76
+ # Merged into specs_dir in the feature-package layout:
77
+ # tech-docs live at specs/{domain}/{prd-slug}/tech-docs/.
78
+ # In umbrella mode with spec_source set, context-loader auto-routes this to
79
+ # {spec_source}/specs so FE/App read the contract via the spec submodule.
80
+ tech_docs_dir: "specs"
81
+
82
+ # Design Specs (FE/App platforms only — web, app).
83
+ # In the feature-package layout, design-specs live at specs/{domain}/{prd-slug}/design-spec/.
84
+ # This variable is no longer needed as a separate path — derived from specs_dir.
85
+ # design_spec_dir: "specs/design-spec" ← removed; use specs_dir instead
86
+
87
+ # Trace (internal structure: .trace/{domain}/{prd-slug}/{UC-ID}.tsv)
88
+ trace_dir: ".trace"
89
+
90
+ # Tester / QC feedback (written by /report-bug and /propose-scenario).
91
+ # These live in the SHARED spec repo so PO/Dev see them on their next /sync.
92
+ # In umbrella mode, context-loader auto-resolves them under {spec_source}/feedback/.
93
+ bug_reports_dir: "feedback/bug-reports"
94
+ bdd_proposals_dir: "feedback/bdd-proposals"
95
+ # PRD change requests (new requirement found in test, not covered by any AC) —
96
+ # written by /propose-scenario Case B so the PO can add/extend an AC then re-/generate-bdd.
97
+ prd_change_requests_dir: "feedback/prd-change-requests"
98
+
99
+ tech_stack:
100
+ language: "{{LANGUAGE}}" # e.g., Java 17 / TypeScript / C# / Go
101
+ framework: "{{FRAMEWORK}}" # e.g., Spring Boot 3.2 / Angular 17 / .NET 8
102
+ build_tool: "{{BUILD_TOOL}}" # e.g., Maven / npm / dotnet / go
103
+ test_framework: "{{TEST_FRAMEWORK}}" # e.g., JUnit 5 + Mockito / Jest / xUnit
104
+ database: "{{DATABASE}}" # e.g., PostgreSQL / MySQL / MongoDB
105
+ module: "{{MODULE}}" # e.g., java-spring / angular / dotnet / golang / context-engineering
106
+
107
+ conventions:
108
+ build_command: "{{BUILD_COMMAND}}" # e.g., mvn clean install -DskipTests
109
+ test_command: "{{TEST_COMMAND}}" # e.g., mvn test
110
+ service_run: "{{RUN_COMMAND}}" # e.g., mvn spring-boot:run
111
+ ticket_prefix: "{{TICKET_PREFIX}}" # e.g., PROJ / FEAT / UC
112
+
113
+ domains:
114
+ - "{{DOMAIN_1}}"
115
+ # - "{{DOMAIN_2}}"
116
+
117
+ # ----- Multi-Service / Umbrella Setup -----
118
+ # Fill this section ONLY if this is an UMBRELLA repo that contains multiple
119
+ # service submodules. Leave commented out for single-service projects.
120
+ #
121
+ # setup:
122
+ # mode: umbrella # "umbrella" | "single" (default: single)
123
+ # spec_source: "{{SPEC_SUBMODULE_PATH}}" # path to PO spec submodule, e.g. "free-trial-specs"
124
+ #
125
+ # When spec_source is set, context-loader auto-derives (ALL specs live in the spec repo
126
+ # using the feature-package layout; service submodules hold only code):
127
+ # specs_dir → {spec_source}/specs # unified root — PRD/BDD/tech-docs/design-spec
128
+ # tech_docs_dir → {spec_source}/specs # merged into specs_dir
129
+ # domain_knowledge_dir → {spec_source}/specs/domain-knowledge
130
+ # trace_dir → {spec_source}/.trace # structure: .trace/{domain}/{prd-slug}/{UC-ID}.tsv
131
+ # (You can still override these manually in paths: section below.)
132
+ # With spec_source set, only ONE override is needed instead of four separate dir vars.
133
+ #
134
+ # services: # domain → service submodule routing
135
+ # {{DOMAIN_1}}: # must match the PRD's `Domain` (Metadata row) / folder path segment
136
+ # path: "{{SERVICE_SUBMODULE_DIR}}" # relative path to service submodule (code + .trace/)
137
+ # module: "{{STACK_MODULE}}" # e.g., java-spring, nextjs, flutter
138
+ # # NOTE: with spec_source set, BDD + tech-docs are cross-team and live in the spec repo —
139
+ # # do NOT pin per-service specs_dir / tech_docs_dir here (they would be ignored).
140
+ # # Per-service specs_dir / tech_docs_dir apply ONLY when there is no spec_source.
141
+ #
142
+ # IMPORTANT — per-service CLAUDE.md:
143
+ # Each service submodule should have its OWN CLAUDE.md ({path}/CLAUDE.md) defining its
144
+ # architecture + coding standards for ITS stack. context-loader loads CLAUDE.md in two
145
+ # layers: root CLAUDE.md (umbrella-wide shared rules) + {service}/CLAUDE.md (overlay,
146
+ # wins on conflict for architecture/coding-standards). The agent sits at the umbrella
147
+ # root, so without a service CLAUDE.md, code generation falls back to umbrella defaults
148
+ # (likely the wrong stack). Generate one per service via /setup-ai-first inside each.
149
+ # {{DOMAIN_2}}:
150
+ # path: "{{SERVICE_2_DIR}}"
151
+ # module: "{{STACK_MODULE}}"
152
+ # specs_dir: "{{SERVICE_2_DIR}}/specs"
153
+ # tech_docs_dir: "{{SERVICE_2_DIR}}/specs"
154
+
155
+ # ----- Architecture -----
156
+ architecture:
157
+ style: "{{ARCH_STYLE}}" # e.g., Layered / Clean / Hexagonal
158
+ layers: "{{LAYER_STACK}}" # e.g., Controller → Facade → Service → Repository
159
+ key_rules:
160
+ - "{{ARCH_RULE_1}}"
161
+ - "{{ARCH_RULE_2}}"
@@ -0,0 +1,498 @@
1
+ <!--
2
+ ════════════════════════════════════════════════════════════════════════════
3
+ TEMPLATE: Technical Design Document (per-PRD, full-stack, merged)
4
+ Used by: /generate-tech-docs
5
+ ════════════════════════════════════════════════════════════════════════════
6
+
7
+ SCOPE MODEL
8
+ - ONE document per PRD (not per UC). It covers EVERY use case of the PRD in a
9
+ single merged, full-stack design: backend (API, data model, DB) AND client
10
+ (components, state, API-integration) side by side, joined by cross-tier
11
+ sequence diagrams. This is the "construction blueprint" any developer opens
12
+ to implement the whole feature.
13
+ - INPUT is the BDD feature files of the PRD (web/ · app/ · system/), NOT the
14
+ PRD prose. The PRD is loaded only for Overview/Goals/Actors context.
15
+
16
+ INCREMENTAL / APPEND
17
+ - When new BDD is added to the same PRD later, this document is EXTENDED, not
18
+ regenerated: add the new UC's sections + sequence diagrams, update the
19
+ UC Coverage matrix (§10) and the Changelog. Never clobber existing content
20
+ or hand edits.
21
+
22
+ FILLING RULES
23
+ - Replace every {…} placeholder with real content. Delete guidance comments.
24
+ - TERMINOLOGY: obey the project dictionary 100%
25
+ (specs/domain-knowledge/business-dictionary.md). Status/enum values →
26
+ core-entities.md (Enum Registry). Entities → core-entities.md.
27
+ - Keep code/DTO/DB samples in the project's stack idiom (see the active module
28
+ stack-profile). The C#/Angular snippets below are ILLUSTRATIVE — swap for
29
+ the real stack.
30
+ - A section that does not apply to this PRD: keep the heading and write
31
+ "N/A — {reason}" rather than deleting it, so the shape stays predictable.
32
+ - Every sequence diagram / API / rule should be traceable back to a scenario:
33
+ reference the SC id (e.g. UC1-SC3) it serves.
34
+ -->
35
+
36
+ # {Feature Area} — {PRD Title} Technical Design Document
37
+
38
+ <!-- @trace block (PRD-level). ucs = every UC covered by this doc; append ids as UCs are added. -->
39
+ ---
40
+ @trace.id: {TICKET-ID}
41
+ @trace.domain: {domain}
42
+ @trace.prd: {TICKET-ID}
43
+ @trace.ucs: {TICKET-ID}-UC1, {TICKET-ID}-UC2{, …}
44
+ @trace.service: {service — from BDD header @trace.service}
45
+ @trace.module: {module(s) involved — e.g. dotnet, angular}
46
+ @trace.platforms: {system | web | app — whichever BDD folders exist}
47
+ @trace.bdd_version: {per-platform map — e.g. system=1.5, web=1.9, app=1.7; only platforms present. Each feature carries its own bdd_version; do not flatten to one number.}
48
+ @trace.api_source: {existing | —}
49
+ @trace.revision: 1
50
+ @trace.status: draft
51
+ @trace.generated_at: {YYYY-MM-DD}
52
+ ---
53
+
54
+ > **Related docs:** {link sibling PRDs / tech-designs this depends on, e.g. [OTHER-TICKET](../{other-slug}/tech-docs/{OTHER-TICKET}-tech-design.md)}. Delete if none.
55
+
56
+ ## 1. Overview
57
+
58
+ <!-- 2–4 sentences: what this feature does, who uses it, the key technical shape
59
+ (data sources, primary side effects). Name where data comes from (DB vs
60
+ external API) and the main write. Source: PRD + system BDD. -->
61
+
62
+ {What the feature does, its main actor, and the core technical mechanism. State
63
+ which data is owned (DB) vs sourced live (external API), and the primary write.}
64
+
65
+ ### Goals
66
+
67
+ <!-- Bullet the technical goals — derived from PRD goals, phrased as what the
68
+ system must guarantee. -->
69
+
70
+ - {Goal 1}
71
+ - {Goal 2}
72
+
73
+ ### Business Actors
74
+
75
+ | Actor | Description | Channel |
76
+ |-------|-------------|---------|
77
+ | {Actor} | {role & permission} | {entry path, e.g. App → Widget → Portal → API} |
78
+
79
+ ---
80
+
81
+ ## 2. Architecture Overview
82
+
83
+ ### 2.1 High-level Architecture
84
+
85
+ <!-- ASCII (or mermaid) topology showing the systems this feature touches:
86
+ client → gateway → service(s) → data stores / external APIs. Keep it to the
87
+ components THIS PRD actually exercises. Source: architecture.md /
88
+ project-context.yaml (services, stack). -->
89
+
90
+ ```
91
+ {ASCII or mermaid diagram of the components this feature touches}
92
+ ```
93
+
94
+ > **Note:** {call out which data is fetched live from an external API vs stored in the owned DB, and any cache layer + TTL.}
95
+
96
+ ### 2.2 Communication Patterns
97
+
98
+ | Pattern | Usage | Scope (UC/SC) |
99
+ |---------|-------|---------------|
100
+ | {Client → Gateway → API} | {auth / action} | {UC1} |
101
+ | {API → External API} | {what it fetches, cache TTL} | {UC1-SC…} |
102
+
103
+ ---
104
+
105
+ ## 3. Data Model
106
+
107
+ <!-- Source: core-entities.md (owned entities) + BDD Then-clauses (state) + PRD.
108
+ Distinguish OWNED entities (in the DB) from API-SOURCED models (fetched
109
+ live, not persisted). List only fields this PRD reads or writes. -->
110
+
111
+ ### 3.1 Entity Design
112
+
113
+ #### {EntityName} ({DB entity | API-sourced POCO})
114
+
115
+ {One line: what it represents, and whether it is persisted or fetched live.}
116
+
117
+ | Field | Type | Usage in {TICKET-ID} |
118
+ |-------|------|----------------------|
119
+ | `{field}` | `{type}` | {how this feature uses it — read/write, which SC} |
120
+
121
+ <!-- Repeat per entity. If the feature has meaningful state transitions, add a
122
+ small state table/diagram like below. -->
123
+
124
+ **State transitions (if any):**
125
+
126
+ ```
127
+ {state A}: {condition} → {outcome / UI signal}
128
+ {state B}: {condition} → {outcome}
129
+ ```
130
+
131
+ **Constraints:**
132
+ - {invariant enforced in application/DB logic, e.g. exactly one primary per tenant}
133
+
134
+ ### 3.2 Entity Relationships
135
+
136
+ ```
137
+ {relationship diagram — cardinalities, join keys, which fields are read-only vs owned}
138
+ ```
139
+
140
+ ### 3.3 Data Source Boundaries
141
+
142
+ <!-- Crisp statement of what THIS PRD reads vs writes, and what is delegated
143
+ elsewhere. Prevents scope bleed. -->
144
+
145
+ **{TICKET-ID} scope: {READ … / WRITE …}.**
146
+
147
+ | Responsibility | In scope? | Handled by |
148
+ |----------------|-----------|-----------|
149
+ | {read merged list} | ✅ Yes | {endpoint / service} |
150
+ | {write X flag} | ✅ Yes | {service} |
151
+ | {base data} | ❌ Read-only | {external API + cache} |
152
+ | {other module concern} | ❌ No | {module/team} |
153
+
154
+ ### 3.4 Multi-tenant & Sharding
155
+
156
+ <!-- Only if the project is multi-tenant. Else write "N/A — single tenant". -->
157
+
158
+ - {tenant key on entities, query-filter isolation, shard resolution — from architecture.md}
159
+
160
+ ---
161
+
162
+ ## 4. API Contracts
163
+
164
+ <!-- Backend contract. For greenfield: design endpoints from BDD scenarios. For
165
+ brownfield (@trace.api_source = existing): reverse-document the live API
166
+ as-is and note gaps vs BDD expectations. Mark REUSE vs NEW explicitly.
167
+ CLIENT-ONLY PRD (no system/ BDD — this feature owns no backend): do NOT
168
+ fabricate a BE contract. §4.1 then lists the endpoints the client CONSUMES
169
+ (external / third-party / another team's / existing), marked "consumed
170
+ (external)", reverse-documented from the client BDD Then-clauses + PRD;
171
+ fill §4.2/§4.3 only if the shape is known. If the feature makes no network
172
+ calls at all → write "N/A — client-only, no backend". §4.5.4 maps client
173
+ methods to whatever §4.1 lists (or none). -->
174
+
175
+
176
+ ### 4.1 Endpoints
177
+
178
+ ```
179
+ {METHOD} {/path} # NEW | REUSE ({source}) — {one-line purpose}
180
+ ```
181
+
182
+ ### 4.2 Request/Response Models
183
+
184
+ <!-- Show DTO shapes in the stack's idiom. Note which fields come from DB vs
185
+ external API. -->
186
+
187
+ ```{lang}
188
+ {DTO definitions with per-field source comments}
189
+ ```
190
+
191
+ ### 4.3 Validation & Error Codes
192
+
193
+ **Validation rules:**
194
+
195
+ ```{lang}
196
+ {validation rules, in the stack's idiom (e.g. FluentValidation / class-validator)}
197
+ ```
198
+
199
+ | Code | HTTP Status | Description | Trace |
200
+ |------|-------------|-------------|-------|
201
+ | `{ERROR_CODE}` | {4xx/5xx} | {when it fires} | {UC1-SC…} |
202
+
203
+ ### 4.4 Handler Logic (key endpoints)
204
+
205
+ <!-- For non-trivial writes, spell out the ordered steps (validation →
206
+ transaction → commit/rollback → return). Keeps the sequence diagram and
207
+ the code aligned. -->
208
+
209
+ **{HandlerName}:**
210
+ 1. {step}
211
+ 2. {step — transaction boundary if any}
212
+
213
+ ### 4.5 UI Component Mapping — {platform} ({framework})
214
+
215
+ <!-- CLIENT design, GROUPED BY PLATFORM: one "### 4.5 … — {platform}" section per
216
+ client platform present in the BDD (a web group, an app group). Do NOT title
217
+ this heading by screen — screens/UCs live in the sub-blocks below.
218
+ Inside a platform group:
219
+ • §4.5.1 Component Hierarchy — repeat the sub-block per screen/UC:
220
+ "#### 4.5.1.x {Screen} — {UC}". A PRD with many screens/UCs → many sub-blocks
221
+ in the SAME platform group (never a second 4.5 group for the same platform).
222
+ • §4.5.2–§4.5.5 — likewise per screen/UC where they differ.
223
+ • §4.5.6 Test Selectors — ONE shared table for the whole platform group; its
224
+ "Serves SC" column carries (UC · SC) so per-UC consumers filter their rows.
225
+ Append: new platform → new "### 4.5 — {platform}" group; new screen/UC in an
226
+ existing platform → add a sub-block + rows to §4.5.6 (don't duplicate the group).
227
+ Omit §4.5 entirely for a backend-only PRD. -->
228
+
229
+ > **Source:** {Figma file + node id, from design-spec}
230
+ > **Stack:** {framework, state primitive, component library}
231
+ > <!-- @figma.url: {node-level figma url} -->
232
+
233
+ #### 4.5.1 Component Hierarchy — {Screen} ({UC})
234
+
235
+ <!-- Repeat this sub-block per screen/UC in this platform group (4.5.1.a, 4.5.1.b …). -->
236
+
237
+ ```
238
+ {component tree — container vs presentational, conditional children}
239
+ ```
240
+
241
+ #### 4.5.2 Component File Mapping
242
+
243
+ | Component | Path | Type | Purpose |
244
+ |-----------|------|------|---------|
245
+ | `{Component}` | `{path}` | {Feature/Child} | {responsibility} |
246
+
247
+ #### 4.5.3 State Management ({state primitive})
248
+
249
+ <!-- State shape derived from System BDD Then-clauses + response shapes from §4.2.
250
+ Show derived/computed values and their inputs. -->
251
+
252
+ ```{lang}
253
+ {state declarations with source comments (which BDD field / BE field each maps to)}
254
+ ```
255
+
256
+ #### 4.5.4 API Integration Layer (port/adapter)
257
+
258
+ <!-- Modal/route config + API-integration map: each client service method → a
259
+ REAL endpoint from §4.1 (do not invent endpoints). Error → UI state per SC.
260
+ This table is what /generate-code --phase=integration reads to wire the real adapter. -->
261
+
262
+ | Client method | Endpoint (§4.1) | Request map | Response → model | Error → UI |
263
+ |---------------|-----------------|-------------|------------------|-----------|
264
+ | {svc.getX()} | {GET /…} | {params} | {DTO → ViewModel} | {4xx → state/toast} |
265
+
266
+ #### 4.5.5 Figma → Design System Mapping
267
+
268
+ | Figma element | Design system class/token | Notes |
269
+ |---------------|---------------------------|-------|
270
+ | {element} | {class / token} | {size, color, state} |
271
+
272
+ #### 4.5.6 Test Selectors — element IDs for actionable elements (QC contract)
273
+
274
+ <!-- Stable test-id per interactive element so QC locates directly (no runtime
275
+ scan). Convention: {uc-lower}-{screen}-{element}-{type}; DO NOT embed
276
+ scenario numbers. Attribute per platform: web data-testid · RN testID ·
277
+ Flutter Key/Semantics · iOS accessibilityIdentifier. Reuse the same id
278
+ VALUE across web/app for the same logical element.
279
+ ONE shared table for the whole platform group (covers every screen/UC of this
280
+ platform). The "Serves SC" column carries (UC · SC) so a per-UC consumer
281
+ (generate-code / qc) filters to its own rows via §10. This §4.5 group is
282
+ already platform-scoped, so the platform is implicit (web block → web · SC). -->
283
+
284
+ | Test-ID | Element | Component (§4.5.1.x) | Action | Serves SC (UC · SC) |
285
+ |---------|---------|----------------------|--------|---------------------|
286
+ | `{uc}-{screen}-{element}-{type}` | {Submit button} | {Component} | {submit} | {UC1 · SC1, UC1 · SC3} |
287
+
288
+ ---
289
+
290
+ ## 5. Key Flows (Sequence Diagrams)
291
+
292
+ <!-- ONE mermaid sequence diagram per meaningful scenario. Participants span tiers:
293
+ client component → service → API → external API → DB.
294
+ ⚠ SC ids are unique only within (UC × platform): `{UC}-SC1` on `system` and
295
+ `{UC}-SC1` on `web` are DIFFERENT scenarios. So group flows into PLATFORM LANES
296
+ (5.A system · 5.B web · 5.C app) and ALWAYS pair the SC with its platform,
297
+ e.g. "(web · UC1-SC1)". Never write a bare "UC1-SC1" here — it is ambiguous.
298
+ Only include the lanes whose BDD exists in this PRD. -->
299
+
300
+ ### 5.A System flows
301
+
302
+ <!-- One diagram per system-BDD scenario. Skip this lane if no system/ BDD. -->
303
+
304
+ #### 5.A.1 {name} (system · {UC}-SC…)
305
+
306
+ ```mermaid
307
+ sequenceDiagram
308
+ participant {A} as {Actor}
309
+ {…}
310
+ ```
311
+
312
+ ### 5.B Web flows
313
+
314
+ <!-- One diagram per web-BDD scenario. Skip this lane if no web/ BDD. -->
315
+
316
+ #### 5.B.1 {name} (web · {UC}-SC…)
317
+
318
+ ```mermaid
319
+ sequenceDiagram
320
+ {…}
321
+ ```
322
+
323
+ ### 5.C App flows
324
+
325
+ <!-- One diagram per app-BDD scenario. Skip this lane if no app/ BDD. -->
326
+
327
+ #### 5.C.1 {name} (app · {UC}-SC…)
328
+
329
+ ```mermaid
330
+ sequenceDiagram
331
+ {…}
332
+ ```
333
+
334
+ <!-- Number within each lane: 5.A.1, 5.A.2 … / 5.B.1 … / 5.C.1 …. For a scenario
335
+ whose effect crosses into another module, note "(covered by {OTHER-UC})". -->
336
+
337
+ **Key integration points (optional table per flow):**
338
+
339
+ | Step | State transition | Verified by (platform · SC) |
340
+ |------|------------------|-----------------------------|
341
+ | {step} | {before → after} | {web · UC1-SC…} |
342
+
343
+ ---
344
+
345
+ ## 6. Integration Points
346
+
347
+ | Integration | Direction | Method | Description |
348
+ |-------------|-----------|--------|-------------|
349
+ | {Client → API} | Outbound (client) | {REST/Bearer} | {what} |
350
+ | {API → External} | Outbound (server) | {REST + header} | {what, cache TTL} |
351
+
352
+ ### 6.1 Event Bus / Messaging
353
+
354
+ <!-- Kafka/queue events produced/consumed by this feature. "N/A — no events" if none. -->
355
+
356
+ {events, or N/A}
357
+
358
+ ### 6.2 Cross-Service Dependencies
359
+
360
+ | Dependent service | What's needed | Contract | Status |
361
+ |-------------------|---------------|----------|--------|
362
+ | {service} | {need} | {endpoint} | {✅ Exists / ⚠️ pending} |
363
+
364
+ ---
365
+
366
+ ## 7. Security & Authorization
367
+
368
+ ### 7.1 Authentication
369
+
370
+ {Auth flow + token type/TTL. Source: PRD auth + project rules.}
371
+
372
+ ### 7.2 Authorization Rules
373
+
374
+ | Action | Required role/permission | Description | Trace |
375
+ |--------|--------------------------|-------------|-------|
376
+ | {action} | {role} | {how enforced, where} | {UC1-SC… / out of scope} |
377
+
378
+ ---
379
+
380
+ ## 8. Error Handling & Edge Cases
381
+
382
+ <!-- One row per error / edge / negative scenario in the BDD. This must line up
383
+ with §4.3 error codes and the §5 error sequence diagrams. -->
384
+
385
+ | Scenario | Strategy | Details | Trace |
386
+ |----------|----------|---------|-------|
387
+ | {condition} | {approach} | {behavior, message, side effect} | {UC1-SC…, BR…} |
388
+
389
+ ---
390
+
391
+ ## 9. Design Decisions
392
+
393
+ <!-- The "why" behind non-obvious choices, with alternatives considered. Source:
394
+ PRD alternatives/assumptions + reasoning during generation. This is what lets
395
+ a reviewer trust the design. -->
396
+
397
+ | # | Decision | Rationale | Alternatives considered |
398
+ |---|----------|-----------|-------------------------|
399
+ | 1 | **{decision}** | {why} | {alt — why rejected} |
400
+
401
+ ### NFR-to-Design Mapping
402
+
403
+ | NFR category | PRD requirement | Design decision |
404
+ |--------------|-----------------|-----------------|
405
+ | {e.g. Multi-tenant isolation} | {requirement} | {mechanism} |
406
+
407
+ ---
408
+
409
+ ## 10. UC Coverage
410
+
411
+ <!-- THE APPEND ANCHOR **and the INDEX for per-UC consumers**. Every UC of the PRD
412
+ gets a row; every scenario maps to the section(s) that design it.
413
+ - /generate-tech-docs uses it to detect what is already covered vs missing.
414
+ - /generate-code, /map-testids, /qc-* work on ONE UC of a PRD-level doc — they
415
+ look this UC up HERE first to locate its scenarios → the sections/§5-lanes
416
+ (and thus the §4.1 endpoints its §5 flows call) that belong to it. Don't
417
+ pull another UC's endpoints/sections.
418
+ ⚠ Scenario coverage is keyed by (platform, SC) because SC ids repeat across
419
+ platforms — the Platform column disambiguates. -->
420
+
421
+ | UC | Feature | Platforms | Sections covered | Status |
422
+ |----|---------|-----------|------------------|--------|
423
+ | {TICKET-ID}-UC1 | {title} | {system, web, app} | §… | ✅ Covered |
424
+
425
+ ### UC1 Scenario Coverage
426
+
427
+ <!-- One row per (platform, SC). Same SC number on different platforms = different
428
+ scenarios → separate rows. -->
429
+
430
+ | Platform | Scenario | Section | Business rule |
431
+ |----------|----------|---------|---------------|
432
+ | system | {UC}-SC1: {name} | §5.A.1 | {BR…} |
433
+ | web | {UC}-SC1: {name} | §4.5 (web), §5.B.1 | {BR…} |
434
+
435
+ <!-- Repeat a scenario-coverage block per UC. -->
436
+
437
+ ---
438
+
439
+ ## 11. Cross-cutting & Assumptions (Out-of-Scope Reference)
440
+
441
+ <!-- Upstream concerns this PRD DEPENDS ON but does not implement (admin gate,
442
+ downstream UI in another module, order snapshotting…). Keep for cross-team
443
+ context. Reference the owning UC/team + doc. Source: PRD out-of-scope +
444
+ BDD BR "out of scope" notes. -->
445
+
446
+ ### 11.1 {Concern}
447
+
448
+ > {Quote the BDD/PRD line that scopes it out.}
449
+
450
+ {Explanation of the boundary + a reference sequence diagram if useful.}
451
+
452
+ **Owned by:** {team / module}. See {link}.
453
+
454
+ ---
455
+
456
+ ## 12. GAP Register — ẩn số thiết kế chưa chốt
457
+
458
+ <!--
459
+ Mọi [GAP: Gn] / [ASSUMPTION: An] đánh dấu inline trong doc PHẢI có đúng MỘT dòng ở đây
460
+ (và ngược lại — không marker mồ côi, không dòng thừa). Đây là sổ quản lý vòng đời ẩn số.
461
+
462
+ - Loại:
463
+ • nội tại — BE tự quyết (đóng: BE điền giá trị, thay marker)
464
+ • cross-service — cần team/partner khác (đóng: qua T7 sign-off của owner)
465
+ • spec-defect — BDD/PRD sai/thiếu (KHÔNG tự đóng: escalate PO sửa .feature/PRD → regen; xem §9 Conflict)
466
+ - Severity:
467
+ • 🔴 blocker — code BẮT BUỘC phải có mới đúng → CHẶN approve
468
+ • 🟢 non-blocker — đoán tạm chạy được, chỉ cần confirm → không chặn
469
+ (Nhãn GAP/ASSUMPTION KHÔNG tự quyết severity — một ASSUMPTION vẫn có thể là blocker nếu đoán sai sẽ vỡ.)
470
+ - Status: open → resolved (owner điền giá trị thật → thay marker inline → bump @trace.revision).
471
+
472
+ GATE: còn ≥1 🔴 blocker ở trạng thái `open` → @trace.status KHÔNG được lên `approved`
473
+ (giữ `in-review`) → generate-code bị chặn. Cùng pattern design-spec giữ `draft` khi còn ❌ Missing.
474
+ -->
475
+
476
+ | id | Dùng ở (§) | Điều chưa biết | Loại | Owner confirm | Severity | Status | Đóng thế nào |
477
+ |----|-----------|----------------|------|---------------|----------|--------|--------------|
478
+ | G1 | {§4.3} | {shape lỗi khi partner từ chối} | cross-service | {team-payment} | 🔴 blocker | open | {T7 sign-off — owner cung cấp contract} |
479
+ | A1 | {§4.1} | {timeout mặc định 30s} | nội tại | {BE lead} | 🟢 non-blocker | open | {BE xác nhận, thay giá trị} |
480
+
481
+ > Nếu doc **không có** ẩn số nào → ghi "Không có — mọi thiết kế đều có nguồn." **KHÔNG** bịa dòng để lấp trống.
482
+
483
+ ---
484
+
485
+ ## Figma Design References
486
+
487
+ <!-- @figma.url: {node-level figma url per screen} -->
488
+ - {Screen}: [Figma — {frame}]({url})
489
+ - Exported: {YYYY-MM-DD}
490
+
491
+ ---
492
+
493
+ ## Changelog
494
+
495
+ | Revision | Date | Changes |
496
+ |----------|------|---------|
497
+ | 1 | {YYYY-MM-DD} | Initial generation from {TICKET-ID} BDD (v{bdd_version}): {list UCs covered} |
498
+ <!-- On append: add a row per extension, e.g. "2 | {date} | Added UC3 (§5.9, §10) from new BDD v{n}" -->