@edupia-tutor/spec-driven-docs 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (339) hide show
  1. package/bin/build.js +230 -0
  2. package/bin/index.js +598 -0
  3. package/commands/debug.md +830 -0
  4. package/commands/debug.tmpl +257 -0
  5. package/commands/define-product.md +652 -0
  6. package/commands/define-product.tmpl +158 -0
  7. package/commands/dev-gen-test.md +1010 -0
  8. package/commands/dev-gen-test.tmpl +490 -0
  9. package/commands/dev-run-test.md +744 -0
  10. package/commands/dev-run-test.tmpl +224 -0
  11. package/commands/dev-smoke-test.md +711 -0
  12. package/commands/dev-smoke-test.tmpl +217 -0
  13. package/commands/fix-bug.md +744 -0
  14. package/commands/fix-bug.tmpl +171 -0
  15. package/commands/generate-bdd.md +1054 -0
  16. package/commands/generate-bdd.tmpl +534 -0
  17. package/commands/generate-code.md +869 -0
  18. package/commands/generate-code.tmpl +349 -0
  19. package/commands/generate-design-spec.md +958 -0
  20. package/commands/generate-design-spec.tmpl +464 -0
  21. package/commands/generate-prd.md +748 -0
  22. package/commands/generate-prd.tmpl +254 -0
  23. package/commands/generate-spec-manifest.md +658 -0
  24. package/commands/generate-spec-manifest.tmpl +164 -0
  25. package/commands/generate-tech-docs.md +849 -0
  26. package/commands/generate-tech-docs.tmpl +355 -0
  27. package/commands/learn.md +636 -0
  28. package/commands/learn.tmpl +63 -0
  29. package/commands/map-testids.md +575 -0
  30. package/commands/map-testids.tmpl +81 -0
  31. package/commands/propose-scenario.md +623 -0
  32. package/commands/propose-scenario.tmpl +129 -0
  33. package/commands/qc-analyze.md +580 -0
  34. package/commands/qc-analyze.tmpl +86 -0
  35. package/commands/qc-design-test.md +562 -0
  36. package/commands/qc-design-test.tmpl +68 -0
  37. package/commands/qc-plan.md +543 -0
  38. package/commands/qc-plan.tmpl +49 -0
  39. package/commands/qc-report.md +554 -0
  40. package/commands/qc-report.tmpl +60 -0
  41. package/commands/qc-review.md +547 -0
  42. package/commands/qc-review.tmpl +53 -0
  43. package/commands/qc-run-test.md +604 -0
  44. package/commands/qc-run-test.tmpl +84 -0
  45. package/commands/refine-prd.md +772 -0
  46. package/commands/refine-prd.tmpl +140 -0
  47. package/commands/report-bug.md +639 -0
  48. package/commands/report-bug.tmpl +145 -0
  49. package/commands/review-code.md +677 -0
  50. package/commands/review-code.tmpl +104 -0
  51. package/commands/review-context.md +1047 -0
  52. package/commands/review-context.tmpl +415 -0
  53. package/commands/review-tech-docs.md +811 -0
  54. package/commands/review-tech-docs.tmpl +317 -0
  55. package/commands/setup-ai-first.md +545 -0
  56. package/commands/setup-ai-first.tmpl +358 -0
  57. package/commands/sync.md +451 -0
  58. package/commands/sync.tmpl +351 -0
  59. package/commands/update-framework.md +251 -0
  60. package/commands/update-framework.tmpl +151 -0
  61. package/commands/validate-traces.md +842 -0
  62. package/commands/validate-traces.tmpl +348 -0
  63. package/core/FRAMEWORK_VERSION +1 -0
  64. package/core/commands/debug.md +830 -0
  65. package/core/commands/define-product.md +652 -0
  66. package/core/commands/dev-gen-test.md +1010 -0
  67. package/core/commands/dev-run-test.md +744 -0
  68. package/core/commands/dev-smoke-test.md +711 -0
  69. package/core/commands/fix-bug.md +744 -0
  70. package/core/commands/generate-bdd.md +1054 -0
  71. package/core/commands/generate-code.md +869 -0
  72. package/core/commands/generate-design-spec.md +958 -0
  73. package/core/commands/generate-prd.md +748 -0
  74. package/core/commands/generate-spec-manifest.md +658 -0
  75. package/core/commands/generate-tech-docs.md +849 -0
  76. package/core/commands/learn.md +636 -0
  77. package/core/commands/map-testids.md +575 -0
  78. package/core/commands/propose-scenario.md +623 -0
  79. package/core/commands/qc-analyze.md +580 -0
  80. package/core/commands/qc-design-test.md +562 -0
  81. package/core/commands/qc-plan.md +543 -0
  82. package/core/commands/qc-report.md +554 -0
  83. package/core/commands/qc-review.md +547 -0
  84. package/core/commands/qc-run-test.md +604 -0
  85. package/core/commands/refine-prd.md +772 -0
  86. package/core/commands/report-bug.md +639 -0
  87. package/core/commands/review-code.md +677 -0
  88. package/core/commands/review-context.md +1047 -0
  89. package/core/commands/review-tech-docs.md +811 -0
  90. package/core/commands/setup-ai-first.md +545 -0
  91. package/core/commands/sync.md +451 -0
  92. package/core/commands/update-framework.md +251 -0
  93. package/core/commands/validate-traces.md +842 -0
  94. package/core/hooks/data-guard.js +141 -0
  95. package/core/hooks/settings.json +18 -0
  96. package/core/modules/android-compose/module.yaml +13 -0
  97. package/core/modules/android-compose/stack-profile.yaml +57 -0
  98. package/core/modules/angular/architecture-snippets/component-patterns.md +187 -0
  99. package/core/modules/angular/module.yaml +6 -0
  100. package/core/modules/angular/stack-profile.yaml +38 -0
  101. package/core/modules/context-engineering/architecture-snippets/context-design.md +119 -0
  102. package/core/modules/context-engineering/module.yaml +9 -0
  103. package/core/modules/context-engineering/stack-profile.yaml +61 -0
  104. package/core/modules/dotnet/architecture-snippets/clean-arch.md +160 -0
  105. package/core/modules/dotnet/module.yaml +6 -0
  106. package/core/modules/dotnet/stack-profile.yaml +50 -0
  107. package/core/modules/flutter/module.yaml +14 -0
  108. package/core/modules/flutter/stack-profile.yaml +59 -0
  109. package/core/modules/golang/architecture-snippets/domain-layout.md +283 -0
  110. package/core/modules/golang/module.yaml +6 -0
  111. package/core/modules/golang/stack-profile.yaml +40 -0
  112. package/core/modules/ios-swiftui/module.yaml +13 -0
  113. package/core/modules/ios-swiftui/stack-profile.yaml +55 -0
  114. package/core/modules/java-spring/architecture-snippets/layered-arch.md +201 -0
  115. package/core/modules/java-spring/module.yaml +15 -0
  116. package/core/modules/java-spring/stack-profile.yaml +28 -0
  117. package/core/modules/nextjs/architecture-snippets/app-router-patterns.md +269 -0
  118. package/core/modules/nextjs/module.yaml +14 -0
  119. package/core/modules/nextjs/stack-profile.yaml +74 -0
  120. package/core/modules/nuxt/module.yaml +14 -0
  121. package/core/modules/nuxt/stack-profile.yaml +58 -0
  122. package/core/modules/php-laravel/architecture-snippets/service-repository.md +302 -0
  123. package/core/modules/php-laravel/module.yaml +15 -0
  124. package/core/modules/php-laravel/stack-profile.yaml +56 -0
  125. package/core/modules/qc-playwright/stack-profile.yaml +66 -0
  126. package/core/modules/react/architecture-snippets/hooks-query-patterns.md +254 -0
  127. package/core/modules/react/module.yaml +14 -0
  128. package/core/modules/react/stack-profile.yaml +63 -0
  129. package/core/modules/react-native/module.yaml +14 -0
  130. package/core/modules/react-native/stack-profile.yaml +56 -0
  131. package/core/modules/vue/module.yaml +14 -0
  132. package/core/modules/vue/stack-profile.yaml +65 -0
  133. package/core/rules/data-protection.md +80 -0
  134. package/core/rules/workflow.md +44 -0
  135. package/core/skills/code/SKILL.md +770 -0
  136. package/core/skills/debug/SKILL.md +869 -0
  137. package/core/skills/design-spec/SKILL.md +589 -0
  138. package/core/skills/discovery/SKILL.md +554 -0
  139. package/core/skills/prd/SKILL.md +562 -0
  140. package/core/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  141. package/core/skills/qc/qa-analyst/acceptance-criteria.md +60 -0
  142. package/core/skills/qc/qa-analyst/business-rules.md +59 -0
  143. package/core/skills/qc/qa-analyst/data-flow.md +64 -0
  144. package/core/skills/qc/qa-analyst/spec-breakdown.md +61 -0
  145. package/core/skills/qc/qa-designer/e2e/journey.md +41 -0
  146. package/core/skills/qc/qa-designer/exploratory/charter.md +68 -0
  147. package/core/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  148. package/core/skills/qc/qa-designer/functional/api.md +45 -0
  149. package/core/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  150. package/core/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  151. package/core/skills/qc/qa-designer/integration/api.md +42 -0
  152. package/core/skills/qc/qa-designer/integration/db.md +39 -0
  153. package/core/skills/qc/qa-designer/integration/gui.md +40 -0
  154. package/core/skills/qc/qa-designer/integration/kafka.md +40 -0
  155. package/core/skills/qc/qa-designer/non-functional.md +40 -0
  156. package/core/skills/qc/qa-planner/test-plan.md +120 -0
  157. package/core/skills/qc/qa-reviewer/script/e2e.md +87 -0
  158. package/core/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  159. package/core/skills/qc/qa-reviewer/script/functional.md +101 -0
  160. package/core/skills/qc/qa-reviewer/script/integration.md +91 -0
  161. package/core/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  162. package/core/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  163. package/core/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  164. package/core/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  165. package/core/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  166. package/core/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  167. package/core/skills/qc/qa-runner/e2e.md +49 -0
  168. package/core/skills/qc/qa-runner/exploratory/session.md +36 -0
  169. package/core/skills/qc/qa-runner/functional/api.md +35 -0
  170. package/core/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  171. package/core/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  172. package/core/skills/qc/qa-runner/integration.md +47 -0
  173. package/core/skills/qc/qa-runner/non-functional.md +49 -0
  174. package/core/skills/qc/qa-runner/report/report.md +37 -0
  175. package/core/skills/setup-ai-first/SKILL.md +216 -0
  176. package/core/skills/spec/SKILL.md +461 -0
  177. package/core/skills/test/SKILL.md +1297 -0
  178. package/core/steps/capture-lesson.md +79 -0
  179. package/core/steps/context-loader.md +307 -0
  180. package/core/steps/gate.md +87 -0
  181. package/core/steps/report-footer.md +100 -0
  182. package/core/steps/review-fanout.md +138 -0
  183. package/core/steps/spawn-agent.md +124 -0
  184. package/core/steps/trace-mirror.md +26 -0
  185. package/core/templates/architecture.template.md +113 -0
  186. package/core/templates/design-spec.template.md +217 -0
  187. package/core/templates/feature.template +259 -0
  188. package/core/templates/platform-guide.template.md +145 -0
  189. package/core/templates/prd.template.md +327 -0
  190. package/core/templates/product-definition.template.md +168 -0
  191. package/core/templates/project-context.yaml +161 -0
  192. package/docs/01-getting-started/README.md +19 -0
  193. package/docs/01-getting-started/core-concepts.md +102 -0
  194. package/docs/01-getting-started/installation.md +156 -0
  195. package/docs/01-getting-started/quickstart.md +85 -0
  196. package/docs/02-guides/README.md +26 -0
  197. package/docs/02-guides/developer/README.md +46 -0
  198. package/docs/02-guides/developer/bdd-and-trace.md +125 -0
  199. package/docs/02-guides/developer/commands.md +76 -0
  200. package/docs/02-guides/developer/pr-checklist.md +15 -0
  201. package/docs/02-guides/developer/scenarios.md +460 -0
  202. package/docs/02-guides/developer/workflow.md +121 -0
  203. package/docs/02-guides/product-owner/README.md +79 -0
  204. package/docs/02-guides/product-owner/commands.md +30 -0
  205. package/docs/02-guides/product-owner/handoff-checklist.md +42 -0
  206. package/docs/02-guides/product-owner/prd-writing-rules.md +45 -0
  207. package/docs/02-guides/product-owner/scenarios.md +436 -0
  208. package/docs/02-guides/tester/README.md +75 -0
  209. package/docs/02-guides/tester/bug-reporting.md +117 -0
  210. package/docs/02-guides/tester/qc-automation.md +165 -0
  211. package/docs/02-guides/tester/reading-specs.md +79 -0
  212. package/docs/02-guides/tester/scenarios.md +186 -0
  213. package/docs/02-guides/tester/spec-manifest.md +130 -0
  214. package/docs/02-guides/tester/test-checklist.md +31 -0
  215. package/docs/02-guides/tester/workflow.md +77 -0
  216. package/docs/03-concepts/README.md +19 -0
  217. package/docs/03-concepts/architecture.md +248 -0
  218. package/docs/03-concepts/pipeline.md +274 -0
  219. package/docs/03-concepts/traceability.md +149 -0
  220. package/docs/04-operations/README.md +33 -0
  221. package/docs/04-operations/bug-flow.md +362 -0
  222. package/docs/04-operations/publishing.md +137 -0
  223. package/docs/04-operations/sync-and-update.md +522 -0
  224. package/docs/05-reference/README.md +32 -0
  225. package/docs/05-reference/command-cheatsheet.md +147 -0
  226. package/docs/05-reference/commands.md +232 -0
  227. package/docs/05-reference/modules.md +110 -0
  228. package/docs/05-reference/trace-schema.md +153 -0
  229. package/docs/README.md +49 -0
  230. package/hooks/data-guard.js +141 -0
  231. package/hooks/settings.json +18 -0
  232. package/modules/android-compose/module.yaml +13 -0
  233. package/modules/android-compose/stack-profile.yaml +57 -0
  234. package/modules/angular/architecture-snippets/component-patterns.md +187 -0
  235. package/modules/angular/module.yaml +6 -0
  236. package/modules/angular/stack-profile.yaml +38 -0
  237. package/modules/context-engineering/architecture-snippets/context-design.md +119 -0
  238. package/modules/context-engineering/module.yaml +9 -0
  239. package/modules/context-engineering/stack-profile.yaml +61 -0
  240. package/modules/dotnet/architecture-snippets/clean-arch.md +160 -0
  241. package/modules/dotnet/module.yaml +6 -0
  242. package/modules/dotnet/stack-profile.yaml +50 -0
  243. package/modules/flutter/module.yaml +14 -0
  244. package/modules/flutter/stack-profile.yaml +59 -0
  245. package/modules/golang/architecture-snippets/domain-layout.md +283 -0
  246. package/modules/golang/module.yaml +6 -0
  247. package/modules/golang/stack-profile.yaml +40 -0
  248. package/modules/ios-swiftui/module.yaml +13 -0
  249. package/modules/ios-swiftui/stack-profile.yaml +55 -0
  250. package/modules/java-spring/architecture-snippets/layered-arch.md +201 -0
  251. package/modules/java-spring/module.yaml +15 -0
  252. package/modules/java-spring/stack-profile.yaml +28 -0
  253. package/modules/nextjs/architecture-snippets/app-router-patterns.md +269 -0
  254. package/modules/nextjs/module.yaml +14 -0
  255. package/modules/nextjs/stack-profile.yaml +74 -0
  256. package/modules/nuxt/module.yaml +14 -0
  257. package/modules/nuxt/stack-profile.yaml +58 -0
  258. package/modules/php-laravel/architecture-snippets/service-repository.md +302 -0
  259. package/modules/php-laravel/module.yaml +15 -0
  260. package/modules/php-laravel/stack-profile.yaml +56 -0
  261. package/modules/qc-playwright/stack-profile.yaml +66 -0
  262. package/modules/react/architecture-snippets/hooks-query-patterns.md +254 -0
  263. package/modules/react/module.yaml +14 -0
  264. package/modules/react/stack-profile.yaml +63 -0
  265. package/modules/react-native/module.yaml +14 -0
  266. package/modules/react-native/stack-profile.yaml +56 -0
  267. package/modules/vue/module.yaml +14 -0
  268. package/modules/vue/stack-profile.yaml +65 -0
  269. package/package.json +49 -0
  270. package/rules/data-protection.md +80 -0
  271. package/rules/workflow.md +44 -0
  272. package/scripts/init.sh +49 -0
  273. package/scripts/migrate-specs.js +256 -0
  274. package/scripts/upgrade.sh +94 -0
  275. package/skills/code/SKILL.md +770 -0
  276. package/skills/code/SKILL.tmpl +176 -0
  277. package/skills/debug/SKILL.md +869 -0
  278. package/skills/debug/SKILL.tmpl +262 -0
  279. package/skills/design-spec/SKILL.md +589 -0
  280. package/skills/design-spec/SKILL.tmpl +95 -0
  281. package/skills/discovery/SKILL.md +554 -0
  282. package/skills/discovery/SKILL.tmpl +147 -0
  283. package/skills/prd/SKILL.md +562 -0
  284. package/skills/prd/SKILL.tmpl +188 -0
  285. package/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  286. package/skills/qc/qa-analyst/acceptance-criteria.md +60 -0
  287. package/skills/qc/qa-analyst/business-rules.md +59 -0
  288. package/skills/qc/qa-analyst/data-flow.md +64 -0
  289. package/skills/qc/qa-analyst/spec-breakdown.md +61 -0
  290. package/skills/qc/qa-designer/e2e/journey.md +41 -0
  291. package/skills/qc/qa-designer/exploratory/charter.md +68 -0
  292. package/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  293. package/skills/qc/qa-designer/functional/api.md +45 -0
  294. package/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  295. package/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  296. package/skills/qc/qa-designer/integration/api.md +42 -0
  297. package/skills/qc/qa-designer/integration/db.md +39 -0
  298. package/skills/qc/qa-designer/integration/gui.md +40 -0
  299. package/skills/qc/qa-designer/integration/kafka.md +40 -0
  300. package/skills/qc/qa-designer/non-functional.md +40 -0
  301. package/skills/qc/qa-planner/test-plan.md +120 -0
  302. package/skills/qc/qa-reviewer/script/e2e.md +87 -0
  303. package/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  304. package/skills/qc/qa-reviewer/script/functional.md +101 -0
  305. package/skills/qc/qa-reviewer/script/integration.md +91 -0
  306. package/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  307. package/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  308. package/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  309. package/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  310. package/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  311. package/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  312. package/skills/qc/qa-runner/e2e.md +49 -0
  313. package/skills/qc/qa-runner/exploratory/session.md +36 -0
  314. package/skills/qc/qa-runner/functional/api.md +35 -0
  315. package/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  316. package/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  317. package/skills/qc/qa-runner/integration.md +47 -0
  318. package/skills/qc/qa-runner/non-functional.md +49 -0
  319. package/skills/qc/qa-runner/report/report.md +37 -0
  320. package/skills/setup-ai-first/SKILL.md +216 -0
  321. package/skills/setup-ai-first/SKILL.tmpl +116 -0
  322. package/skills/spec/SKILL.md +461 -0
  323. package/skills/spec/SKILL.tmpl +174 -0
  324. package/skills/test/SKILL.md +1297 -0
  325. package/skills/test/SKILL.tmpl +296 -0
  326. package/steps/capture-lesson.md +79 -0
  327. package/steps/context-loader.md +307 -0
  328. package/steps/gate.md +87 -0
  329. package/steps/report-footer.md +100 -0
  330. package/steps/review-fanout.md +138 -0
  331. package/steps/spawn-agent.md +124 -0
  332. package/steps/trace-mirror.md +26 -0
  333. package/templates/architecture.template.md +113 -0
  334. package/templates/design-spec.template.md +217 -0
  335. package/templates/feature.template +259 -0
  336. package/templates/platform-guide.template.md +145 -0
  337. package/templates/prd.template.md +327 -0
  338. package/templates/product-definition.template.md +168 -0
  339. package/templates/project-context.yaml +161 -0
@@ -0,0 +1,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
@@ -0,0 +1,217 @@
1
+ # {TICKET-ID} {Feature Name} — Design Spec [{Platform}]
2
+
3
+ <!--
4
+ Template này được sử dụng bởi /generate-design-spec.
5
+ Platform = web | app | app-ios | app-android
6
+
7
+ PLATFORM SECTIONS:
8
+ - Section 3A + 4A: chỉ dành cho web (react/nextjs/vue/angular). Xóa C khi dùng cho web.
9
+ - Section 3C + 4B: chỉ dành cho app (flutter/react-native/ios/android). Xóa A+B khi dùng cho app.
10
+
11
+ COMPONENT MAPPING (bắt buộc):
12
+ - Mọi component trong Component Inventory PHẢI được map với figma-components/{module}.md
13
+ - ✅ Matched → dùng Code Component và Import Path từ catalog
14
+ - ⚠️ TODO → đánh dấu [TODO — chưa implement]
15
+ - ❌ Chưa có → đánh dấu [NEW — cần confirm với designer]
16
+
17
+ FIGMA LINKS (bắt buộc mỗi màn):
18
+ - Mỗi screen PHẢI có link Figma node-level (URL chứa ?node-id=...) — lấy bằng
19
+ right-click frame → "Copy link to selection". Đây là link AI đọc được qua Figma MCP.
20
+ - Link file trần (không có node-id) KHÔNG hợp lệ — AI không định vị được frame.
21
+ - Screen chưa có design → đánh dấu ❌ Missing; spec giữ Status "draft", chặn sign-off
22
+ và /generate-bdd cho tới khi đủ link.
23
+
24
+ SCREEN STATES (bắt buộc mỗi màn):
25
+ - Tối thiểu: default, loading, error
26
+ - Thêm "empty" nếu màn có thể hiển thị trạng thái không có dữ liệu
27
+ - Thêm "success" nếu action tạo ra trạng thái xác nhận riêng biệt
28
+ -->
29
+
30
+ ---
31
+
32
+ ## Metadata
33
+
34
+ | Field | Value |
35
+ |--------------------|---------------------------------------------------------------|
36
+ | **Spec ID** | {TICKET-ID}-DS-{platform} |
37
+ | **Version** | 1.0 |
38
+ | **Status** | draft / approved |
39
+ | **Platform** | {web \| app \| app-ios \| app-android} |
40
+ | **Module** | {active_module} |
41
+ | **Service** | {active_service} |
42
+ | **Domain** | {domain} |
43
+ | **Business PRD** | [{TICKET-ID}](./{TICKET-ID}-slug.md) |
44
+ | **Figma** | {feature file link} ({linked}/{N} frames linked) |
45
+ | **Author** | {PO name or "AI-assisted"} |
46
+ | **Created** | {YYYY-MM-DD} |
47
+ | **Updated** | {YYYY-MM-DD} |
48
+
49
+ ---
50
+
51
+ # 1. Screen Inventory
52
+
53
+ | # | Screen Name | Entry Point | Figma Frame (node-level link) | Notes |
54
+ |---|-------------|-------------|-------------------------------|-------|
55
+ | 1 | {Screen 1} | {how user arrives} | [Frame]({node-level url}) | |
56
+ | 2 | {Screen 2} | {entry point} | ❌ Missing — add node-id link | |
57
+
58
+ ---
59
+
60
+ # 2. Screen Specs
61
+
62
+ ## Screen 1: {Screen Name}
63
+
64
+ **Figma**: [{Frame name}]({figma_frame_url})
65
+
66
+ ### Layout
67
+
68
+ {Grid / max-width / padding / spacing — reference design tokens where applicable}
69
+
70
+ ### Component Inventory
71
+
72
+ | Component (Figma) | Code Component | Import Path | States | Notes |
73
+ |------------------------|----------------|------------------------|---------------------------------|---------|
74
+ | {Figma/Button/Primary} | Button | @/components/ui/Button | default, loading, disabled | |
75
+ | {Figma/Input/Text} | TextInput | @/components/ui/Input | default, focus, error, disabled | |
76
+
77
+ ### Screen States
78
+
79
+ | State | Trigger | UI Behavior |
80
+ |-----------|----------------------------------|----------------------------------------------------------|
81
+ | default | Screen loaded, data available | {Describe full rendered appearance} |
82
+ | loading | API call in flight | {Skeleton / spinner position and style} |
83
+ | error | API failure / validation error | {Toast / inline error / error screen + recovery CTA} |
84
+ | empty | No data returned | {Illustration + CTA — e.g., "No items yet. Add one →"} |
85
+ | success | Action completed (if applicable) | {Confirmation toast / navigation / visual change} |
86
+
87
+ ### Actions & Navigation
88
+
89
+ | Action | Trigger | Result |
90
+ |-----------------|---------------------------|---------------------------------------------------|
91
+ | {Action name} | Tap/click {element} | Navigate to {Screen N} / Open {Modal name} |
92
+ | {Back/Cancel} | Back gesture / button | Return to {previous screen} without saving |
93
+
94
+ ---
95
+
96
+ <!-- Repeat ## Screen N for each additional screen -->
97
+
98
+ ---
99
+
100
+ # 3. Interaction Patterns
101
+
102
+ <!-- === WEB ONLY — delete this section for app === -->
103
+
104
+ ## A. Responsive Behavior *(web)*
105
+
106
+ | Breakpoint | Width | Layout Changes |
107
+ |------------|------------|---------------------------------------------|
108
+ | Mobile | < 768px | {Single column, bottom nav, full-width CTA} |
109
+ | Tablet | 768–1279px | {2-col grid, sidebar collapsed} |
110
+ | Desktop | ≥ 1280px | {Full layout, max-width 1440px} |
111
+
112
+ ## B. Hover / Focus / Keyboard *(web)*
113
+
114
+ | Element | Hover | Focus | Keyboard |
115
+ |----------------|-------------------------------|---------------------------------|---------------|
116
+ | Primary button | Background → {color.hover} | Outline 2px {color.focus} | Enter / Space |
117
+ | Text input | Border → {color.border.hover} | Border → {color.primary} | Tab to focus |
118
+
119
+ <!-- === APP ONLY — delete sections A+B for app === -->
120
+
121
+ ## C. Gestures & Navigation *(app)*
122
+
123
+ | Gesture | Screen / Element | Behavior |
124
+ |----------------------|---------------------|---------------------------------------------|
125
+ | Back gesture | All screens | {Return / show "Discard changes?" dialog} |
126
+ | Pull-to-refresh | {Screen names} | Refresh data, spinner at top |
127
+ | Swipe left on row | {List item} | Reveal {Delete / Archive} action |
128
+
129
+ ### Navigation Stack *(app)*
130
+
131
+ ```
132
+ {e.g., BottomTab(Home) → ListPage → DetailPage → EditPage}
133
+ ```
134
+
135
+ ### Platform Conventions *(app)*
136
+
137
+ | Aspect | iOS | Android |
138
+ |------------------|-------------------------------------------|-------------------------------------|
139
+ | Navigation bar | Back button top-left, title centered | Up arrow, title left-aligned |
140
+ | Bottom sheet | UISheetPresentation, grabber visible | BottomSheet, drag handle |
141
+ | Dialog | Actions right-aligned | Actions left-aligned |
142
+
143
+ ---
144
+
145
+ # 4. Platform Considerations
146
+
147
+ <!-- === WEB ONLY === -->
148
+
149
+ ## A. Accessibility *(web)*
150
+
151
+ - [ ] All interactive elements reachable by Tab key — no keyboard traps
152
+ - [ ] Focus trap inside modals
153
+ - [ ] Icon-only buttons have `aria-label`
154
+ - [ ] Dynamic content announces via `aria-live`
155
+ - [ ] WCAG AA contrast: text ≥ 4.5:1, large text ≥ 3:1
156
+ - [ ] Form inputs have visible labels (not placeholder-only)
157
+
158
+ <!-- === APP ONLY === -->
159
+
160
+ ## B. Device & OS *(app)*
161
+
162
+ - [ ] Safe area insets applied (top + bottom) on all screens
163
+ - [ ] Minimum touch target: 44×44pt (iOS) / 48×48dp (Android)
164
+ - [ ] Tested on 375pt (iPhone SE) and 360dp (small Android)
165
+ - [ ] Deep link: `{scheme}://{host}/{path}` → {screen name}
166
+ - [ ] Permissions: {Camera / Location / Notification} — rationale copy TBD
167
+ - [ ] Offline: {screen name} shows cached data + banner; {action} disabled with tooltip
168
+ - [ ] Dark mode tested — no hardcoded colors
169
+
170
+ ---
171
+
172
+ # 5. AC-UI — Design Acceptance Criteria
173
+
174
+ > Reviewed and signed off by **PO + Designer** before BDD generation.
175
+ > Complements business-level AC in [Business PRD](./{TICKET-ID}-slug.md).
176
+
177
+ | ID | Acceptance Criterion | Verified by |
178
+ |--------|--------------------------------------------------------------------------|-----------------|
179
+ | AC-UI1 | All screens match approved Figma frames within design-system tolerances | Designer |
180
+ | AC-UI2 | Loading state appears within 200ms of any API call initiation | QA |
181
+ | AC-UI3 | All error messages are visible, descriptive, and include a recovery CTA | PO |
182
+ | AC-UI4 | Empty states include illustration and call-to-action | PO + Designer |
183
+ | AC-UI5 | {Platform-specific criterion} | QA |
184
+
185
+ ---
186
+
187
+ # Appendix
188
+
189
+ ## Figma Summary
190
+
191
+ | Screen | Figma Frame (node-level) | Link / Fetch Status |
192
+ |------------|--------------------------|--------------------------------|
193
+ | {Screen 1} | [Link]({node-level url}) | ✅ Linked & fetched |
194
+ | {Screen 2} | — | ❌ Missing — no node-id link |
195
+
196
+ ## Design Tokens Referenced
197
+
198
+ | Token | Value | Used in |
199
+ |-------------------|----------|----------------------------|
200
+ | `color.primary` | {#hex} | Buttons, links |
201
+ | `spacing.md` | {16px} | Standard vertical gap |
202
+
203
+ ## References
204
+
205
+ - [{TICKET-ID}](./{TICKET-ID}-slug.md) — Business PRD
206
+
207
+ ## AI Assumptions
208
+
209
+ - {Assumption — [AI DRAFT]}
210
+
211
+ ---
212
+
213
+ ## Changelog
214
+
215
+ | Version | Date | Changes |
216
+ |---------|--------------|-----------------|
217
+ | 1.0 | {YYYY-MM-DD} | Initial version |