@edupia-tutor/spec-driven-docs 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (339) hide show
  1. package/bin/build.js +230 -0
  2. package/bin/index.js +598 -0
  3. package/commands/debug.md +830 -0
  4. package/commands/debug.tmpl +257 -0
  5. package/commands/define-product.md +652 -0
  6. package/commands/define-product.tmpl +158 -0
  7. package/commands/dev-gen-test.md +1010 -0
  8. package/commands/dev-gen-test.tmpl +490 -0
  9. package/commands/dev-run-test.md +744 -0
  10. package/commands/dev-run-test.tmpl +224 -0
  11. package/commands/dev-smoke-test.md +711 -0
  12. package/commands/dev-smoke-test.tmpl +217 -0
  13. package/commands/fix-bug.md +744 -0
  14. package/commands/fix-bug.tmpl +171 -0
  15. package/commands/generate-bdd.md +1054 -0
  16. package/commands/generate-bdd.tmpl +534 -0
  17. package/commands/generate-code.md +869 -0
  18. package/commands/generate-code.tmpl +349 -0
  19. package/commands/generate-design-spec.md +958 -0
  20. package/commands/generate-design-spec.tmpl +464 -0
  21. package/commands/generate-prd.md +748 -0
  22. package/commands/generate-prd.tmpl +254 -0
  23. package/commands/generate-spec-manifest.md +658 -0
  24. package/commands/generate-spec-manifest.tmpl +164 -0
  25. package/commands/generate-tech-docs.md +849 -0
  26. package/commands/generate-tech-docs.tmpl +355 -0
  27. package/commands/learn.md +636 -0
  28. package/commands/learn.tmpl +63 -0
  29. package/commands/map-testids.md +575 -0
  30. package/commands/map-testids.tmpl +81 -0
  31. package/commands/propose-scenario.md +623 -0
  32. package/commands/propose-scenario.tmpl +129 -0
  33. package/commands/qc-analyze.md +580 -0
  34. package/commands/qc-analyze.tmpl +86 -0
  35. package/commands/qc-design-test.md +562 -0
  36. package/commands/qc-design-test.tmpl +68 -0
  37. package/commands/qc-plan.md +543 -0
  38. package/commands/qc-plan.tmpl +49 -0
  39. package/commands/qc-report.md +554 -0
  40. package/commands/qc-report.tmpl +60 -0
  41. package/commands/qc-review.md +547 -0
  42. package/commands/qc-review.tmpl +53 -0
  43. package/commands/qc-run-test.md +604 -0
  44. package/commands/qc-run-test.tmpl +84 -0
  45. package/commands/refine-prd.md +772 -0
  46. package/commands/refine-prd.tmpl +140 -0
  47. package/commands/report-bug.md +639 -0
  48. package/commands/report-bug.tmpl +145 -0
  49. package/commands/review-code.md +677 -0
  50. package/commands/review-code.tmpl +104 -0
  51. package/commands/review-context.md +1047 -0
  52. package/commands/review-context.tmpl +415 -0
  53. package/commands/review-tech-docs.md +811 -0
  54. package/commands/review-tech-docs.tmpl +317 -0
  55. package/commands/setup-ai-first.md +545 -0
  56. package/commands/setup-ai-first.tmpl +358 -0
  57. package/commands/sync.md +451 -0
  58. package/commands/sync.tmpl +351 -0
  59. package/commands/update-framework.md +251 -0
  60. package/commands/update-framework.tmpl +151 -0
  61. package/commands/validate-traces.md +842 -0
  62. package/commands/validate-traces.tmpl +348 -0
  63. package/core/FRAMEWORK_VERSION +1 -0
  64. package/core/commands/debug.md +830 -0
  65. package/core/commands/define-product.md +652 -0
  66. package/core/commands/dev-gen-test.md +1010 -0
  67. package/core/commands/dev-run-test.md +744 -0
  68. package/core/commands/dev-smoke-test.md +711 -0
  69. package/core/commands/fix-bug.md +744 -0
  70. package/core/commands/generate-bdd.md +1054 -0
  71. package/core/commands/generate-code.md +869 -0
  72. package/core/commands/generate-design-spec.md +958 -0
  73. package/core/commands/generate-prd.md +748 -0
  74. package/core/commands/generate-spec-manifest.md +658 -0
  75. package/core/commands/generate-tech-docs.md +849 -0
  76. package/core/commands/learn.md +636 -0
  77. package/core/commands/map-testids.md +575 -0
  78. package/core/commands/propose-scenario.md +623 -0
  79. package/core/commands/qc-analyze.md +580 -0
  80. package/core/commands/qc-design-test.md +562 -0
  81. package/core/commands/qc-plan.md +543 -0
  82. package/core/commands/qc-report.md +554 -0
  83. package/core/commands/qc-review.md +547 -0
  84. package/core/commands/qc-run-test.md +604 -0
  85. package/core/commands/refine-prd.md +772 -0
  86. package/core/commands/report-bug.md +639 -0
  87. package/core/commands/review-code.md +677 -0
  88. package/core/commands/review-context.md +1047 -0
  89. package/core/commands/review-tech-docs.md +811 -0
  90. package/core/commands/setup-ai-first.md +545 -0
  91. package/core/commands/sync.md +451 -0
  92. package/core/commands/update-framework.md +251 -0
  93. package/core/commands/validate-traces.md +842 -0
  94. package/core/hooks/data-guard.js +141 -0
  95. package/core/hooks/settings.json +18 -0
  96. package/core/modules/android-compose/module.yaml +13 -0
  97. package/core/modules/android-compose/stack-profile.yaml +57 -0
  98. package/core/modules/angular/architecture-snippets/component-patterns.md +187 -0
  99. package/core/modules/angular/module.yaml +6 -0
  100. package/core/modules/angular/stack-profile.yaml +38 -0
  101. package/core/modules/context-engineering/architecture-snippets/context-design.md +119 -0
  102. package/core/modules/context-engineering/module.yaml +9 -0
  103. package/core/modules/context-engineering/stack-profile.yaml +61 -0
  104. package/core/modules/dotnet/architecture-snippets/clean-arch.md +160 -0
  105. package/core/modules/dotnet/module.yaml +6 -0
  106. package/core/modules/dotnet/stack-profile.yaml +50 -0
  107. package/core/modules/flutter/module.yaml +14 -0
  108. package/core/modules/flutter/stack-profile.yaml +59 -0
  109. package/core/modules/golang/architecture-snippets/domain-layout.md +283 -0
  110. package/core/modules/golang/module.yaml +6 -0
  111. package/core/modules/golang/stack-profile.yaml +40 -0
  112. package/core/modules/ios-swiftui/module.yaml +13 -0
  113. package/core/modules/ios-swiftui/stack-profile.yaml +55 -0
  114. package/core/modules/java-spring/architecture-snippets/layered-arch.md +201 -0
  115. package/core/modules/java-spring/module.yaml +15 -0
  116. package/core/modules/java-spring/stack-profile.yaml +28 -0
  117. package/core/modules/nextjs/architecture-snippets/app-router-patterns.md +269 -0
  118. package/core/modules/nextjs/module.yaml +14 -0
  119. package/core/modules/nextjs/stack-profile.yaml +74 -0
  120. package/core/modules/nuxt/module.yaml +14 -0
  121. package/core/modules/nuxt/stack-profile.yaml +58 -0
  122. package/core/modules/php-laravel/architecture-snippets/service-repository.md +302 -0
  123. package/core/modules/php-laravel/module.yaml +15 -0
  124. package/core/modules/php-laravel/stack-profile.yaml +56 -0
  125. package/core/modules/qc-playwright/stack-profile.yaml +66 -0
  126. package/core/modules/react/architecture-snippets/hooks-query-patterns.md +254 -0
  127. package/core/modules/react/module.yaml +14 -0
  128. package/core/modules/react/stack-profile.yaml +63 -0
  129. package/core/modules/react-native/module.yaml +14 -0
  130. package/core/modules/react-native/stack-profile.yaml +56 -0
  131. package/core/modules/vue/module.yaml +14 -0
  132. package/core/modules/vue/stack-profile.yaml +65 -0
  133. package/core/rules/data-protection.md +80 -0
  134. package/core/rules/workflow.md +44 -0
  135. package/core/skills/code/SKILL.md +770 -0
  136. package/core/skills/debug/SKILL.md +869 -0
  137. package/core/skills/design-spec/SKILL.md +589 -0
  138. package/core/skills/discovery/SKILL.md +554 -0
  139. package/core/skills/prd/SKILL.md +562 -0
  140. package/core/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  141. package/core/skills/qc/qa-analyst/acceptance-criteria.md +60 -0
  142. package/core/skills/qc/qa-analyst/business-rules.md +59 -0
  143. package/core/skills/qc/qa-analyst/data-flow.md +64 -0
  144. package/core/skills/qc/qa-analyst/spec-breakdown.md +61 -0
  145. package/core/skills/qc/qa-designer/e2e/journey.md +41 -0
  146. package/core/skills/qc/qa-designer/exploratory/charter.md +68 -0
  147. package/core/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  148. package/core/skills/qc/qa-designer/functional/api.md +45 -0
  149. package/core/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  150. package/core/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  151. package/core/skills/qc/qa-designer/integration/api.md +42 -0
  152. package/core/skills/qc/qa-designer/integration/db.md +39 -0
  153. package/core/skills/qc/qa-designer/integration/gui.md +40 -0
  154. package/core/skills/qc/qa-designer/integration/kafka.md +40 -0
  155. package/core/skills/qc/qa-designer/non-functional.md +40 -0
  156. package/core/skills/qc/qa-planner/test-plan.md +120 -0
  157. package/core/skills/qc/qa-reviewer/script/e2e.md +87 -0
  158. package/core/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  159. package/core/skills/qc/qa-reviewer/script/functional.md +101 -0
  160. package/core/skills/qc/qa-reviewer/script/integration.md +91 -0
  161. package/core/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  162. package/core/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  163. package/core/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  164. package/core/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  165. package/core/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  166. package/core/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  167. package/core/skills/qc/qa-runner/e2e.md +49 -0
  168. package/core/skills/qc/qa-runner/exploratory/session.md +36 -0
  169. package/core/skills/qc/qa-runner/functional/api.md +35 -0
  170. package/core/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  171. package/core/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  172. package/core/skills/qc/qa-runner/integration.md +47 -0
  173. package/core/skills/qc/qa-runner/non-functional.md +49 -0
  174. package/core/skills/qc/qa-runner/report/report.md +37 -0
  175. package/core/skills/setup-ai-first/SKILL.md +216 -0
  176. package/core/skills/spec/SKILL.md +461 -0
  177. package/core/skills/test/SKILL.md +1297 -0
  178. package/core/steps/capture-lesson.md +79 -0
  179. package/core/steps/context-loader.md +307 -0
  180. package/core/steps/gate.md +87 -0
  181. package/core/steps/report-footer.md +100 -0
  182. package/core/steps/review-fanout.md +138 -0
  183. package/core/steps/spawn-agent.md +124 -0
  184. package/core/steps/trace-mirror.md +26 -0
  185. package/core/templates/architecture.template.md +113 -0
  186. package/core/templates/design-spec.template.md +217 -0
  187. package/core/templates/feature.template +259 -0
  188. package/core/templates/platform-guide.template.md +145 -0
  189. package/core/templates/prd.template.md +327 -0
  190. package/core/templates/product-definition.template.md +168 -0
  191. package/core/templates/project-context.yaml +161 -0
  192. package/docs/01-getting-started/README.md +19 -0
  193. package/docs/01-getting-started/core-concepts.md +102 -0
  194. package/docs/01-getting-started/installation.md +156 -0
  195. package/docs/01-getting-started/quickstart.md +85 -0
  196. package/docs/02-guides/README.md +26 -0
  197. package/docs/02-guides/developer/README.md +46 -0
  198. package/docs/02-guides/developer/bdd-and-trace.md +125 -0
  199. package/docs/02-guides/developer/commands.md +76 -0
  200. package/docs/02-guides/developer/pr-checklist.md +15 -0
  201. package/docs/02-guides/developer/scenarios.md +460 -0
  202. package/docs/02-guides/developer/workflow.md +121 -0
  203. package/docs/02-guides/product-owner/README.md +79 -0
  204. package/docs/02-guides/product-owner/commands.md +30 -0
  205. package/docs/02-guides/product-owner/handoff-checklist.md +42 -0
  206. package/docs/02-guides/product-owner/prd-writing-rules.md +45 -0
  207. package/docs/02-guides/product-owner/scenarios.md +436 -0
  208. package/docs/02-guides/tester/README.md +75 -0
  209. package/docs/02-guides/tester/bug-reporting.md +117 -0
  210. package/docs/02-guides/tester/qc-automation.md +165 -0
  211. package/docs/02-guides/tester/reading-specs.md +79 -0
  212. package/docs/02-guides/tester/scenarios.md +186 -0
  213. package/docs/02-guides/tester/spec-manifest.md +130 -0
  214. package/docs/02-guides/tester/test-checklist.md +31 -0
  215. package/docs/02-guides/tester/workflow.md +77 -0
  216. package/docs/03-concepts/README.md +19 -0
  217. package/docs/03-concepts/architecture.md +248 -0
  218. package/docs/03-concepts/pipeline.md +274 -0
  219. package/docs/03-concepts/traceability.md +149 -0
  220. package/docs/04-operations/README.md +33 -0
  221. package/docs/04-operations/bug-flow.md +362 -0
  222. package/docs/04-operations/publishing.md +137 -0
  223. package/docs/04-operations/sync-and-update.md +522 -0
  224. package/docs/05-reference/README.md +32 -0
  225. package/docs/05-reference/command-cheatsheet.md +147 -0
  226. package/docs/05-reference/commands.md +232 -0
  227. package/docs/05-reference/modules.md +110 -0
  228. package/docs/05-reference/trace-schema.md +153 -0
  229. package/docs/README.md +49 -0
  230. package/hooks/data-guard.js +141 -0
  231. package/hooks/settings.json +18 -0
  232. package/modules/android-compose/module.yaml +13 -0
  233. package/modules/android-compose/stack-profile.yaml +57 -0
  234. package/modules/angular/architecture-snippets/component-patterns.md +187 -0
  235. package/modules/angular/module.yaml +6 -0
  236. package/modules/angular/stack-profile.yaml +38 -0
  237. package/modules/context-engineering/architecture-snippets/context-design.md +119 -0
  238. package/modules/context-engineering/module.yaml +9 -0
  239. package/modules/context-engineering/stack-profile.yaml +61 -0
  240. package/modules/dotnet/architecture-snippets/clean-arch.md +160 -0
  241. package/modules/dotnet/module.yaml +6 -0
  242. package/modules/dotnet/stack-profile.yaml +50 -0
  243. package/modules/flutter/module.yaml +14 -0
  244. package/modules/flutter/stack-profile.yaml +59 -0
  245. package/modules/golang/architecture-snippets/domain-layout.md +283 -0
  246. package/modules/golang/module.yaml +6 -0
  247. package/modules/golang/stack-profile.yaml +40 -0
  248. package/modules/ios-swiftui/module.yaml +13 -0
  249. package/modules/ios-swiftui/stack-profile.yaml +55 -0
  250. package/modules/java-spring/architecture-snippets/layered-arch.md +201 -0
  251. package/modules/java-spring/module.yaml +15 -0
  252. package/modules/java-spring/stack-profile.yaml +28 -0
  253. package/modules/nextjs/architecture-snippets/app-router-patterns.md +269 -0
  254. package/modules/nextjs/module.yaml +14 -0
  255. package/modules/nextjs/stack-profile.yaml +74 -0
  256. package/modules/nuxt/module.yaml +14 -0
  257. package/modules/nuxt/stack-profile.yaml +58 -0
  258. package/modules/php-laravel/architecture-snippets/service-repository.md +302 -0
  259. package/modules/php-laravel/module.yaml +15 -0
  260. package/modules/php-laravel/stack-profile.yaml +56 -0
  261. package/modules/qc-playwright/stack-profile.yaml +66 -0
  262. package/modules/react/architecture-snippets/hooks-query-patterns.md +254 -0
  263. package/modules/react/module.yaml +14 -0
  264. package/modules/react/stack-profile.yaml +63 -0
  265. package/modules/react-native/module.yaml +14 -0
  266. package/modules/react-native/stack-profile.yaml +56 -0
  267. package/modules/vue/module.yaml +14 -0
  268. package/modules/vue/stack-profile.yaml +65 -0
  269. package/package.json +49 -0
  270. package/rules/data-protection.md +80 -0
  271. package/rules/workflow.md +44 -0
  272. package/scripts/init.sh +49 -0
  273. package/scripts/migrate-specs.js +256 -0
  274. package/scripts/upgrade.sh +94 -0
  275. package/skills/code/SKILL.md +770 -0
  276. package/skills/code/SKILL.tmpl +176 -0
  277. package/skills/debug/SKILL.md +869 -0
  278. package/skills/debug/SKILL.tmpl +262 -0
  279. package/skills/design-spec/SKILL.md +589 -0
  280. package/skills/design-spec/SKILL.tmpl +95 -0
  281. package/skills/discovery/SKILL.md +554 -0
  282. package/skills/discovery/SKILL.tmpl +147 -0
  283. package/skills/prd/SKILL.md +562 -0
  284. package/skills/prd/SKILL.tmpl +188 -0
  285. package/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  286. package/skills/qc/qa-analyst/acceptance-criteria.md +60 -0
  287. package/skills/qc/qa-analyst/business-rules.md +59 -0
  288. package/skills/qc/qa-analyst/data-flow.md +64 -0
  289. package/skills/qc/qa-analyst/spec-breakdown.md +61 -0
  290. package/skills/qc/qa-designer/e2e/journey.md +41 -0
  291. package/skills/qc/qa-designer/exploratory/charter.md +68 -0
  292. package/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  293. package/skills/qc/qa-designer/functional/api.md +45 -0
  294. package/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  295. package/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  296. package/skills/qc/qa-designer/integration/api.md +42 -0
  297. package/skills/qc/qa-designer/integration/db.md +39 -0
  298. package/skills/qc/qa-designer/integration/gui.md +40 -0
  299. package/skills/qc/qa-designer/integration/kafka.md +40 -0
  300. package/skills/qc/qa-designer/non-functional.md +40 -0
  301. package/skills/qc/qa-planner/test-plan.md +120 -0
  302. package/skills/qc/qa-reviewer/script/e2e.md +87 -0
  303. package/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  304. package/skills/qc/qa-reviewer/script/functional.md +101 -0
  305. package/skills/qc/qa-reviewer/script/integration.md +91 -0
  306. package/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  307. package/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  308. package/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  309. package/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  310. package/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  311. package/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  312. package/skills/qc/qa-runner/e2e.md +49 -0
  313. package/skills/qc/qa-runner/exploratory/session.md +36 -0
  314. package/skills/qc/qa-runner/functional/api.md +35 -0
  315. package/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  316. package/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  317. package/skills/qc/qa-runner/integration.md +47 -0
  318. package/skills/qc/qa-runner/non-functional.md +49 -0
  319. package/skills/qc/qa-runner/report/report.md +37 -0
  320. package/skills/setup-ai-first/SKILL.md +216 -0
  321. package/skills/setup-ai-first/SKILL.tmpl +116 -0
  322. package/skills/spec/SKILL.md +461 -0
  323. package/skills/spec/SKILL.tmpl +174 -0
  324. package/skills/test/SKILL.md +1297 -0
  325. package/skills/test/SKILL.tmpl +296 -0
  326. package/steps/capture-lesson.md +79 -0
  327. package/steps/context-loader.md +307 -0
  328. package/steps/gate.md +87 -0
  329. package/steps/report-footer.md +100 -0
  330. package/steps/review-fanout.md +138 -0
  331. package/steps/spawn-agent.md +124 -0
  332. package/steps/trace-mirror.md +26 -0
  333. package/templates/architecture.template.md +113 -0
  334. package/templates/design-spec.template.md +217 -0
  335. package/templates/feature.template +259 -0
  336. package/templates/platform-guide.template.md +145 -0
  337. package/templates/prd.template.md +327 -0
  338. package/templates/product-definition.template.md +168 -0
  339. package/templates/project-context.yaml +161 -0
package/steps/gate.md ADDED
@@ -0,0 +1,87 @@
1
+ # Gate — Universal Entry Procedure
2
+
3
+ Every command must execute this gate before proceeding with its specific logic.
4
+
5
+ ## Step 0 — Sub-Agent Mode Check
6
+
7
+ Before anything else, check if `$ARGUMENTS` is a JSON payload from an orchestrator:
8
+
9
+ 1. Attempt to parse `$ARGUMENTS` as JSON.
10
+ 2. If it parses successfully **and** contains `"_agent_mode": true`:
11
+ - **Skip Steps 1, 2, and 3 of this Gate entirely.**
12
+ - Set target file = `payload.target_file`
13
+ - Set loaded context = `payload.context` (do NOT run context-loader.md)
14
+ - Set UC scope = `payload.uc_id` (process only this UC)
15
+ - Set line range = `payload.uc_section` (read only that PRD section)
16
+ - Proceed directly to the command-specific logic.
17
+ 3. If `$ARGUMENTS` is not JSON or `_agent_mode` is absent → continue to Step 1 (normal mode).
18
+
19
+ ## Step 0-B — Model Check
20
+
21
+ *Skip this step if `_agent_mode: true` (sub-agent — orchestrator already validated).*
22
+
23
+ Complex generation and review commands require strong reasoning.
24
+ Using a smaller model risks missed edge cases, incomplete spec analysis, and architecture violations.
25
+
26
+ Display and wait for response:
27
+
28
+ ```
29
+ ⚙️ MODEL CHECK
30
+ ──────────────────────────────────────────────────────────────────
31
+ Recommended : claude-opus-4 (or latest Opus model)
32
+ Why needed : Spec analysis, architecture review, code generation
33
+ require deep reasoning. Smaller models miss edge cases.
34
+
35
+ To switch in Claude Code:
36
+ • Settings → Model → select "claude-opus"
37
+ • or: /model → choose claude-opus
38
+
39
+ Running on claude-opus?
40
+ Y — yes, on claude-opus → proceed
41
+ S — skip check (I accept lower quality risk with current model)
42
+ ──────────────────────────────────────────────────────────────────
43
+ ```
44
+
45
+ - "Y" → proceed to Step 1.
46
+ - "S" → proceed to Step 1 (user accepts risk, add ⚠️ to final report).
47
+ - "N" or anything else → **STOP.** Output: "Please switch to claude-opus, then re-run this command."
48
+
49
+ ## Step 1 — Resolve Target File
50
+
51
+ 1. If `$ARGUMENTS` is provided and points to an existing file → use it directly as the target.
52
+ 2. If `$ARGUMENTS` is a **bare UC-ID / ticket ID / partial name** (no path) → resolve it to a file by globbing the feature-package layout. The `{prd-slug}` is **not known yet**, so use a `*` wildcard for that segment, and a recursive `**` under `bdd/` so the platform subfolders (`bdd/web/`, `bdd/app/`, `bdd/system/`) are all covered:
53
+ - **BDD commands** (target is a `.feature`): `{specs_dir}/{domain}/*/bdd/**/{UC-ID}*.feature` — or `{specs_dir}/*/*/bdd/**/{UC-ID}*.feature` if the domain is also unknown. If a platform/scope is implied by the command (e.g. a system tech-doc needs the `system/` BDD), prefer the match under that platform subfolder.
54
+ - **PRD commands** (target is `prd.md`): `{specs_dir}/{domain}/*/prd.md` (match the feature folder whose id corresponds), else `{specs_dir}/*/*/prd.md`.
55
+ - **tech-docs commands**: `{specs_dir}/{domain}/*/tech-docs/{UC-ID}*-tech-design*.md`.
56
+ - **design-spec commands**: `{specs_dir}/{domain}/*/design-spec/{TICKET-ID}*.md`.
57
+
58
+ Once a file matches: set it as the target **and** record `domain` + `prd_slug` from its path (per the extraction rule in `context-loader.md` Step 1 — `prd_slug` = first segment after `{specs_dir}/{domain}/`). Every path the command later reads or writes (sibling BDD/tech-docs/design-spec/trace) uses **that resolved `prd_slug`**, so all artifacts stay in one feature package. If several files match (e.g. multiple platforms), pick per the command's platform/scope or list them and ask.
59
+ 3. If `$ARGUMENTS` is empty or no match found:
60
+ - List files in the relevant directory for this command (e.g., `specs/*/*/prd.md` for PRD commands, `specs/*/*/bdd/**/*.feature` for BDD commands).
61
+ - Present the list to the user and ask: "Which file do you want to work with? (Enter number or filename)"
62
+ - Wait for user selection before continuing.
63
+
64
+ ## Step 2 — Execute Context Loader
65
+
66
+ Load all project context by following the procedure in `steps/context-loader.md`.
67
+ Store all loaded context in memory for use throughout this command session.
68
+
69
+ ## Step 3 — CHECKPOINT
70
+
71
+ After completing Steps 1 and 2, display a summary and wait for confirmation:
72
+
73
+ ```
74
+ CHECKPOINT
75
+ -----------
76
+ Target : {resolved file path}
77
+ Project : {project.name from project-context.yaml}
78
+ Tech stack : {language} / {framework}
79
+ Module : {module if set, else "not configured"}
80
+ Domains : {comma-separated domain list}
81
+
82
+ Proceed? (Y/N)
83
+ ```
84
+
85
+ Wait for explicit "Y" or "N" from the user before continuing.
86
+ - "Y" → proceed to the command-specific steps below.
87
+ - "N" → stop and ask what the user wants to change.
@@ -0,0 +1,100 @@
1
+ # Report Footer — Standard Command Output Format
2
+
3
+ Every command report must end with this standard footer section.
4
+
5
+ ## Status Badge
6
+
7
+ Choose one based on outcome:
8
+ - `✅ Complete` — all steps succeeded, no issues found
9
+ - `❌ Failed` — command could not complete due to a blocking error
10
+ - `⚠️ Warnings` — completed with non-blocking issues that should be reviewed
11
+
12
+ ## Output Artifacts
13
+
14
+ List every file created or modified by this command:
15
+ ```
16
+ Output Artifacts:
17
+ {created|updated} {file-path} ({brief description})
18
+ {created|updated} {file-path} ({brief description})
19
+ ```
20
+
21
+ If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
22
+
23
+ ## Pipeline Position
24
+
25
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
26
+ so the user always sees where this command sits in the end-to-end flow:
27
+
28
+ ```
29
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
30
+ ```
31
+
32
+ Find the current command in this phase legend and mark **its** phase in the map above:
33
+
34
+ | Phase | Commands |
35
+ |-------|----------|
36
+ | Discovery | `/define-product` |
37
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
38
+ | Design Spec | `/generate-design-spec` |
39
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
40
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
41
+ | Code | `/generate-code` · `/review-code` |
42
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
43
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
44
+ | Trace Audit | `/validate-traces` |
45
+
46
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
47
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
48
+
49
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
50
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
51
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
52
+
53
+ ## Next Command Suggestion
54
+
55
+ Suggest the logical next command based on workflow phase:
56
+
57
+ | Current command | Suggest next |
58
+ |-------------------------|-----------------------------------------------|
59
+ | /setup-ai-first | `/define-product` to start your first feature |
60
+ | /define-product | `/generate-prd {product-definition-file}` |
61
+ | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
62
+ | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
63
+ | /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
64
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
65
+ | /generate-bdd | `/review-context {feature-file}` to verify coverage |
66
+ | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
67
+ | /qc-analyze | `/qc-plan {UC-ID}` (resolve 🔴 blocker gaps first) |
68
+ | /qc-plan | `/qc-design-test {UC-ID}` |
69
+ | /qc-design-test | `/qc-review {UC-ID}` (test-case review) |
70
+ | /qc-review (test-case) | `/qc-run-test {UC-ID}` if APPROVED; fix TCs if NEEDS_FIX |
71
+ | /qc-run-test | `/qc-report {UC-ID}` then `/qc-review {UC-ID}` (script review) |
72
+ | /qc-review (script) | `/qc-report {UC-ID}` then create PR if APPROVED |
73
+ | /qc-report | `/validate-traces {UC-ID}` to refresh Living Docs (qc_status) |
74
+ | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
75
+ | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
76
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
77
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
78
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
79
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
80
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
81
+ | /dev-smoke-test | Create PR and link to ticket |
82
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
83
+ | /fix-bug | Create PR and link to ticket |
84
+ | /debug | `/fix-bug {ticket-id}` if fix needed |
85
+ | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
86
+ | /propose-scenario | Notify PO/Dev to review the proposal in `feedback/bdd-proposals/` |
87
+ | /learn | Continue working — lesson applies on next command |
88
+ | /sync | `/validate-traces` for full coverage; act on any `📥 tester feedback` surfaced |
89
+ | /update-framework | Review `git diff .agent/`, commit; `/sync` for project content |
90
+
91
+ Format the footer as:
92
+ ```
93
+ ---
94
+ Status : {badge}
95
+ {Output Artifacts block}
96
+ Pipeline : Discovery → PRD → [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
97
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
98
+ Next : {suggested command with example arguments}
99
+ ```
100
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
@@ -0,0 +1,138 @@
1
+ # Exhaustive Review Fan-Out + Completeness Convergence
2
+
3
+ **Why this exists:** A single-pass review never lists every issue at once — the model
4
+ stops at "enough" findings, so each later review round surfaces *new* problems
5
+ (whack-a-mole). This procedure forces the review to **converge in one command run**:
6
+ fan out across review dimensions in parallel, then loop a completeness critic until a
7
+ round produces nothing new, *before* writing the findings file.
8
+
9
+ The calling command supplies two things:
10
+ - **DIMENSIONS** — the list of review dimensions to fan out over
11
+ (`/refine-prd` → the 4 lenses; `/review-context` → the P-checks or B-checks).
12
+ - **FINDINGS SCHEMA** — the YAML shape each finding must follow (defined in the command).
13
+
14
+ > **Sub-agent mode bypass:** If Gate Step 0 set `_agent_mode: true`, this whole
15
+ > procedure is **skipped** — the orchestrator is already running one dimension/UC per
16
+ > sub-agent. Run the command's checks directly on the scoped section and return findings.
17
+
18
+ ---
19
+
20
+ ## Phase 1 — Parallel dimension scan
21
+
22
+ **How many sub-agents:** the agent *count* is not the completeness lever — breadth is
23
+ fixed by the DIMENSION taxonomy (adding agents to the same dimension just re-finds the
24
+ same issues), and *depth* is owned by the Phase 2 critic loop. Pick the **fan-out
25
+ granularity** by target size, reusing the `steps/spawn-agent.md` thresholds:
26
+
27
+ | Target size | Granularity | Agent count |
28
+ |-------------|-------------|-------------|
29
+ | ≤ 3 UCs **and** ≤ 300 lines | one agent per DIMENSION over the whole file | = number of dimensions |
30
+ | > 3 UCs **or** > 300 lines | one agent per **DIMENSION × UC-scope** (UCs + a PRD-global scope), batched to fit the agent cap | `dimensions × (UCs + 1)`, capped (see below) |
31
+
32
+ The larger granularity keeps each sub-agent's context small and its scan exhaustive on a
33
+ single UC — which is what prevents misses on big PRDs.
34
+
35
+ > **Global (non-UC) sections — required in `DIMENSION × UC` mode.** Per-UC agents only
36
+ > see one UC each, so PRD-wide sections that belong to no UC (scope, success metrics,
37
+ > problem statement, terminology, glossary, changelog) would go unscanned. Whenever you
38
+ > fan out per UC, also include a **"PRD-global"** scope (the non-UC sections, findings get
39
+ > `uc_id: ""`) alongside the UC list. So the natural agent count is `dimensions × (UCs + 1)`.
40
+ > (Not needed in the whole-file mode — there each agent already sees the global sections.)
41
+
42
+ ### Agent cap — batch UCs when the fan-out gets too wide
43
+
44
+ `dimensions × (UCs + 1)` can explode on large PRDs (e.g. 6 checks × (8 UCs + 1) = 54
45
+ agents). Cap the wave at **`AGENT_CAP = 12`** agents and batch UC scopes to fit:
46
+
47
+ 1. Build the scope list = `[UC1, UC2, …, UCn, PRD-global]` (length `UCs + 1`).
48
+ 2. Compute scopes-per-agent-bucket: `groups = max(1, floor(AGENT_CAP / dimensions))`.
49
+ - If `groups ≥ UCs + 1` → no batching needed, run one agent per `DIMENSION × scope`.
50
+ - Else split the scope list into `groups` contiguous buckets of roughly equal size
51
+ (keep `PRD-global` in its own bucket if it fits; otherwise append it to the last
52
+ bucket). Each agent then handles **one DIMENSION over one bucket of UCs**.
53
+ 3. Resulting wave size = `dimensions × groups ≤ AGENT_CAP`.
54
+
55
+ A batched agent reviews several UCs at once — still scoped far tighter than the whole
56
+ file, so coverage stays high. `AGENT_CAP` is the only knob; raise it if the host allows
57
+ more concurrency, lower it to save tokens. Whole-file mode (≤ 3 UCs) never hits the cap.
58
+
59
+ Spawn the chosen sub-agents using the Agent tool (send them in a single message so they
60
+ run concurrently). Each sub-agent gets a **fresh context window** and scans its scope
61
+ through its **one** dimension only — deeper coverage than one session juggling every
62
+ dimension at once (avoids lost-in-the-middle).
63
+
64
+ Sub-agent prompt template (fill the braces):
65
+
66
+ ```
67
+ You are a {DIMENSION_NAME} reviewer. Read the full target file at {target_file}.
68
+ Scope: review ONLY through the {DIMENSION_NAME} lens/check — {DIMENSION_DESCRIPTION}.
69
+ Be exhaustive: scan every section, every UC, every AC/BR/scenario. Do not stop early.
70
+ Project context (terminology, entities, architecture):
71
+ {slim_context — banned terms, canonical entities, layer order, domains}
72
+
73
+ Return a JSON array of findings, each:
74
+ { "dimension": "{DIMENSION_NAME}", "severity": "critical|major|minor",
75
+ "section": "...", "uc_id": "...", "quote": "<verbatim ≤120 chars>",
76
+ "finding": "...", "suggestion": "...", "auto_fixable": true|false }
77
+ Return [] if this dimension is clean. Return ONLY the JSON array.
78
+ ```
79
+
80
+ Collect every sub-agent's array into one consolidated list `ALL_FINDINGS`.
81
+
82
+ ---
83
+
84
+ ## Phase 2 — Completeness-critic convergence loop
85
+
86
+ This is the anti-whack-a-mole step. Repeat until **two consecutive rounds add zero new
87
+ findings**, or a hard cap of **3 rounds**, whichever comes first:
88
+
89
+ 1. Spawn one **completeness-critic** sub-agent with the Agent tool. Give it:
90
+ - the full target file (`{target_file}`),
91
+ - the current `ALL_FINDINGS` list (so it knows what is already captured),
92
+ - the same slim context.
93
+ Prompt it:
94
+ ```
95
+ Here is a document and a list of issues already found. Read the WHOLE document.
96
+ List ONLY real, additional issues NOT already in the list — gaps, ambiguities,
97
+ contradictions, missing edge/negative paths, coverage holes, terminology drift,
98
+ structural omissions, and any issue that a fix to an existing finding would expose.
99
+ Do NOT repeat anything already listed. Return the same finding JSON shape, or [] if
100
+ nothing new.
101
+ ```
102
+ 2. Append any genuinely new findings (not already in `ALL_FINDINGS`) to the list.
103
+ 3. If this round returned 0 new → increment the dry-round counter; else reset it to 0.
104
+ 4. Stop when dry-round counter reaches 2, or after 3 rounds total.
105
+
106
+ Record `convergence_rounds` (how many critic rounds ran) for the report.
107
+
108
+ ---
109
+
110
+ ## Phase 3 — Dedup, resolve conflicts, merge
111
+
112
+ Sub-agents run **blind to each other** (independence = diverse coverage). They never
113
+ talk or reconcile among themselves — all duplicate/conflict resolution happens **here in
114
+ the orchestrator**, where the full set is visible.
115
+
116
+ 1. **Deduplicate** `ALL_FINDINGS`: two findings are duplicates if they target the same
117
+ `section` + `uc_id` and describe the same underlying issue. Keep the one with the
118
+ richer `suggestion`; if they differ on severity, keep the **higher** severity.
119
+ 2. **Resolve conflicts** — group remaining findings by `section` + `uc_id` and check for
120
+ contradictions (two findings whose `suggestion`s cannot both be applied, or that
121
+ propose opposite fixes for the same spot):
122
+ - If the two suggestions can be **merged** into one coherent fix → merge them into a
123
+ single finding.
124
+ - If they are **mutually exclusive** → emit **one** finding that states both options
125
+ and set `auto_fixable: false` with `status: "needs_discussion"` (PRD) /
126
+ `status: "pending"` (review) so a human picks — never silently drop one side.
127
+ - If a finding is **invalidated** by another (e.g. a structural finding says a section
128
+ is missing, but another quotes content from it) → drop the invalid one.
129
+ 3. **Sort** by severity (critical → major → minor), then by `section` order in the file.
130
+ 4. **Assign stable IDs** `F001, F002, …` in that sorted order.
131
+ 5. Map each finding's `dimension` into the command's schema field
132
+ (`lens` for `/refine-prd`; `check_id` for `/review-context`).
133
+ 6. Write the **single** findings file in the FINDINGS SCHEMA the command defines.
134
+
135
+ In the command's final report, add one line:
136
+ ```
137
+ Convergence: {convergence_rounds} critic round(s) — findings file is complete; re-running should surface 0 new issues.
138
+ ```
@@ -0,0 +1,124 @@
1
+ # Sub-Agent Orchestration Pattern
2
+
3
+ Used by heavy commands when the target exceeds the complexity threshold.
4
+ The main session becomes a **lightweight orchestrator** — it only coordinates.
5
+ Each unit of work runs in its own sub-agent with a fresh context window.
6
+
7
+ ---
8
+
9
+ ## Complexity Thresholds
10
+
11
+ | Signal | Threshold | Action |
12
+ |--------|-----------|--------|
13
+ | UC count in PRD | > 3 UCs | spawn 1 agent per UC |
14
+ | PRD length | > 300 lines | spawn agents regardless of UC count |
15
+
16
+ If **either** threshold is exceeded → switch to orchestration mode.
17
+
18
+ ---
19
+
20
+ ## Orchestrator Steps (main session)
21
+
22
+ ### Step A — Build slim context
23
+
24
+ Extract only what sub-agents need — do NOT pass full CLAUDE.md or full business-dictionary:
25
+
26
+ ```json
27
+ {
28
+ "project_name": "{project.name}",
29
+ "tech_stack": {
30
+ "language": "{tech_stack.language}",
31
+ "framework": "{tech_stack.framework}",
32
+ "build_tool": "{tech_stack.build_tool}",
33
+ "test_framework": "{tech_stack.test_framework}",
34
+ "database": "{tech_stack.database}",
35
+ "module": "{tech_stack.module}"
36
+ },
37
+ "conventions": {
38
+ "build_command": "{conventions.build_command}",
39
+ "commit_format": "{conventions.commit_format}"
40
+ },
41
+ "paths": {
42
+ "specs_dir": "{paths.specs_dir}",
43
+ "trace_dir": "{paths.trace_dir}",
44
+ "tech_docs_dir": "{paths.tech_docs_dir}"
45
+ },
46
+ "architecture_summary": "<3-5 bullet points: layer order + key rules only>",
47
+ "domains": ["{domain1}", "{domain2}"],
48
+ "banned_terms": ["{term1}", "{term2}"]
49
+ }
50
+ ```
51
+
52
+ ### Step B — Extract UC list
53
+
54
+ Scan the target PRD for `#### {TICKET-ID}-UC{N}:` headings.
55
+ Build list: `[ { uc_id, uc_name, line_start, line_end } ]`
56
+
57
+ ### Step C — Announce plan
58
+
59
+ ```
60
+ High complexity detected — {N} UCs / {L} lines in {prd_file}
61
+ Spawning {N} sub-agents (1 per UC)...
62
+ Agent 1 → {TICKET-ID}-UC1: {UC name}
63
+ Agent 2 → {TICKET-ID}-UC2: {UC name}
64
+ ...
65
+ ```
66
+
67
+ ### Step D — Spawn one sub-agent per UC
68
+
69
+ Build payload and invoke Agent tool for each UC:
70
+
71
+ ```json
72
+ {
73
+ "_agent_mode": true,
74
+ "command": "generate-bdd",
75
+ "uc_id": "{TICKET-ID}-UC{N}",
76
+ "target_file": "{absolute path to PRD or feature file}",
77
+ "uc_section": { "line_start": {N}, "line_end": {N} },
78
+ "context": { "<slim context from Step A>" }
79
+ }
80
+ ```
81
+
82
+ > **Command scope**: Only `/generate-bdd` initiates orchestration mode. `/generate-code` and `/dev-gen-test` can run as sub-agents (they respect `_agent_mode: true` from Gate Step 0), but they do not spawn further sub-agents — their scope is already a single UC.
83
+
84
+ Serialize this JSON and pass as `$ARGUMENTS` when invoking the sub-agent command.
85
+
86
+ ### Step E — Collect and merge results
87
+
88
+ Each sub-agent returns:
89
+ ```json
90
+ {
91
+ "uc_id": "{TICKET-ID}-UC{N}",
92
+ "files_created": ["path/to/file1", "path/to/file2"],
93
+ "status": "success | error",
94
+ "errors": []
95
+ }
96
+ ```
97
+
98
+ Merge into a single report (follow report-footer.md format).
99
+ If any sub-agent errors → list them clearly and suggest re-run for that UC only.
100
+
101
+ ---
102
+
103
+ ## Sub-Agent Entry Point (called commands)
104
+
105
+ When `gate.md Step 0` detects `_agent_mode: true`:
106
+
107
+ 1. Parse full payload from `$ARGUMENTS`
108
+ 2. **Skip context-loader.md** — use `payload.context` directly
109
+ 3. **Scope to `payload.uc_id` only** — do not process other UCs in the file
110
+ 4. Read only the PRD section between `payload.uc_section.line_start` and `line_end`
111
+ 5. Execute the command's normal logic for this single UC
112
+ 6. Return structured result JSON (Step E format above)
113
+
114
+ ---
115
+
116
+ ## Context Window Savings
117
+
118
+ | Mode | What loads per session |
119
+ |------|------------------------|
120
+ | Single session (≤ 3 UC) | Full context + full PRD + all UCs |
121
+ | Orchestrator | Slim context + UC headings only |
122
+ | Each sub-agent | Slim context + **1 UC section only** |
123
+
124
+ The larger the PRD, the bigger the saving per sub-agent.
@@ -0,0 +1,26 @@
1
+ # Refresh Living Docs panel mirror *(local, umbrella mode)*
2
+
3
+ *Skip entirely in single-service mode (no `services` and no `setup.spec_source`) — there
4
+ the repo's own `.trace/` IS the panel location, so nothing to mirror.*
5
+
6
+ After updating the authoritative TSV(s) at `{paths.trace_dir}`:
7
+
8
+ **When `setup.spec_source` is set (consolidated trace — the common case):**
9
+ `{paths.trace_dir}` resolves to `{spec_source}/.trace` — the single authoritative location.
10
+ This command runs from `service_root`, so the write is **cross-repo into the spec submodule**;
11
+ commit/push the spec submodule for the trace update (same as `feedback/`).
12
+ 1. Resolve `panel_mirror = ./.trace` at the **current workspace root**.
13
+ 2. If `panel_mirror` resolves to a different path than `{paths.trace_dir}`, copy each
14
+ just-updated `{UC-ID}.tsv` → `{panel_mirror}/{UC-ID}.tsv` (create the dir; overwrite).
15
+ No per-service namespacing — there is one trace set; the owning service is carried in each
16
+ row's `@trace.service`.
17
+
18
+ **Legacy (no `spec_source` — per-service trace):**
19
+ Copy each just-updated `{UC-ID}.tsv` → `{panel_mirror}/{service-name}/{UC-ID}.tsv`
20
+ (namespaced by `active_service`).
21
+
22
+ This keeps the open workspace's Living Docs panel current **between syncs** — it is a
23
+ **local convenience mirror only**. The merged `trace-report.json` (canonical, in
24
+ `{spec_source}/.living-docs/`) is rebuilt by `/sync` or `/validate-traces`. For orchestrated
25
+ commands, do this once in the orchestrator after all sub-agents return — not inside each
26
+ sub-agent.
@@ -0,0 +1,113 @@
1
+ # §1. Project Overview
2
+
3
+ Project : {{PROJECT_NAME}}
4
+ Language : {{LANGUAGE}} # e.g., Java 17 / TypeScript / C# / Go
5
+ Framework : {{FRAMEWORK}} # e.g., Spring Boot 3.2 / Angular 17 / .NET 8
6
+ Build : {{BUILD_COMMAND}} # e.g., mvn clean install -DskipTests / dotnet build / ng build
7
+ Test : {{TEST_COMMAND}} # e.g., mvn test / dotnet test / ng test
8
+ Domains : {{COMMA_SEPARATED_DOMAINS}}
9
+
10
+ # §2. Architecture
11
+
12
+ style: "{{ARCH_STYLE}}" # e.g., Layered / Clean / Hexagonal / Component-based
13
+
14
+ layers: "{{LAYER_STACK}}"
15
+ # Examples:
16
+ # Java/Spring: Controller → Facade → Service → Repository
17
+ # .NET Clean: Presentation → Application → Domain → Infrastructure
18
+ # Angular: Component → Service → HTTP Client → Backend API
19
+ # Go: Handler → UseCase → Repository → Domain
20
+
21
+ rules:
22
+ - "{{ARCH_RULE_1}}" # e.g., Controllers must not contain business logic
23
+ - "{{ARCH_RULE_2}}" # e.g., Services own transaction boundaries
24
+ - "{{ARCH_RULE_3}}" # e.g., Repositories must not call services
25
+
26
+ # Layer dependency direction (inner layers must not depend on outer):
27
+ # {{OUTER_LAYER}} → {{MIDDLE_LAYER}} → {{INNER_LAYER}}
28
+
29
+ # §3. Coding Standards
30
+
31
+ naming:
32
+ classes: "{{CLASS_NAMING}}" # e.g., PascalCase / PascalCase+Suffix
33
+ methods: "{{METHOD_NAMING}}" # e.g., camelCase / PascalCase
34
+ packages: "{{PACKAGE_NAMING}}" # e.g., lowercase / lowercase.snake_case
35
+ files: "{{FILE_NAMING}}" # e.g., PascalCase.java / kebab-case.ts
36
+
37
+ patterns:
38
+ response_wrapper: "{{RESPONSE_WRAPPER}}" # e.g., ApiResponse<T> / Result<T> / IActionResult
39
+ mapping: "{{MAPPING_LIBRARY}}" # e.g., MapStruct / AutoMapper / manual
40
+ exception_base: "{{BASE_EXCEPTION}}" # e.g., ResourceNotFoundException / DomainException
41
+
42
+ forbidden:
43
+ - "Magic numbers — use named constants"
44
+ - "Debug print statements in production code"
45
+ - "{{PROJECT_SPECIFIC_FORBIDDEN_PATTERN}}"
46
+
47
+ # §4. API Conventions
48
+
49
+ versioning: "{{API_VERSIONING}}" # e.g., /v1/ prefix / header-based / query param
50
+ auth: "{{AUTH_MECHANISM}}" # e.g., JWT Bearer / OAuth2 / API Key
51
+
52
+ http_status:
53
+ get_list: 200 # paginated or full list
54
+ get_single: 200
55
+ create: 201
56
+ update: 200
57
+ delete: 204
58
+ bad_request: 400
59
+ unauthorized: 401
60
+ forbidden: 403
61
+ not_found: 404
62
+ server_error: 500
63
+
64
+ error_response_format: |
65
+ {
66
+ "code": "ERROR_CODE",
67
+ "message": "Human readable message",
68
+ "details": {} // optional field-level errors
69
+ }
70
+
71
+ # §5. Error Handling
72
+
73
+ not_found_exception: "{{NOT_FOUND_EXCEPTION_CLASS}}" # e.g., ResourceNotFoundException
74
+ validation_exception: "{{VALIDATION_EXCEPTION_CLASS}}" # e.g., ValidationException
75
+ domain_exception: "{{DOMAIN_EXCEPTION_CLASS}}" # e.g., DomainException / BusinessRuleViolationException
76
+
77
+ global_handler: "{{GLOBAL_EXCEPTION_HANDLER}}" # e.g., @ControllerAdvice / ExceptionHandlerMiddleware
78
+
79
+ rules:
80
+ - "Never swallow exceptions silently"
81
+ - "Log at error level with full stack trace for 5xx"
82
+ - "{{PROJECT_SPECIFIC_ERROR_RULE}}"
83
+
84
+ # §6. Testing Standards
85
+
86
+ unit_test_framework: "{{UNIT_TEST_FW}}" # e.g., JUnit 5 + Mockito / xUnit + Moq / Jest
87
+ integration_test_framework: "{{IT_TEST_FW}}" # e.g., Spring Boot Test / WebApplicationFactory
88
+
89
+ coverage_targets:
90
+ unit: "{{UNIT_COVERAGE_PCT}}%" # e.g., 80%
91
+ integration: "{{IT_COVERAGE_PCT}}%" # e.g., key flows covered
92
+
93
+ naming_pattern: "{{TEST_METHOD_NAMING}}" # e.g., methodName_whenCondition_shouldExpectation
94
+
95
+ rules:
96
+ - "Unit tests mock direct dependencies only"
97
+ - "Integration tests cover happy path + main error paths"
98
+ - "Every scenario in .feature must have a corresponding test"
99
+
100
+ # §7. Git Conventions
101
+
102
+ branch_feature: "feature/{{TICKET_PREFIX}}-{N}-{slug}"
103
+ branch_fix: "fix/{{TICKET_PREFIX}}-{N}-{slug}"
104
+ branch_chore: "chore/{slug}"
105
+
106
+ commit_feature: "feat({{TICKET_PREFIX}}-{N}): {description}"
107
+ commit_fix: "fix({{TICKET_PREFIX}}-{N}): {description}"
108
+ commit_chore: "chore: {description}"
109
+ commit_docs: "docs: {description}"
110
+
111
+ pr_title: "{{TICKET_PREFIX}}-{N}: {feature name}"
112
+ pr_requires_review: true
113
+ pr_branch_protection: "{{BASE_BRANCH}}" # e.g., main / develop