@anhth2/spec-driven-dev-plugin 0.9.2 → 0.11.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 (223) hide show
  1. package/commands/debug.md +50 -20
  2. package/commands/define-product.md +49 -19
  3. package/commands/{generate-tests.md → dev-gen-test.md} +85 -23
  4. package/commands/{generate-tests.tmpl → dev-gen-test.tmpl} +18 -4
  5. package/{core/commands/run-tests.md → commands/dev-run-test.md} +102 -21
  6. package/commands/{run-tests.tmpl → dev-run-test.tmpl} +35 -2
  7. package/commands/{smoke-test.md → dev-smoke-test.md} +54 -24
  8. package/commands/{smoke-test.tmpl → dev-smoke-test.tmpl} +5 -5
  9. package/commands/fix-bug.md +50 -20
  10. package/commands/generate-bdd.md +78 -21
  11. package/commands/generate-bdd.tmpl +11 -2
  12. package/commands/generate-code.md +123 -23
  13. package/commands/generate-code.tmpl +56 -4
  14. package/commands/generate-design-spec.md +142 -47
  15. package/commands/generate-design-spec.tmpl +93 -28
  16. package/commands/generate-prd.md +49 -19
  17. package/commands/generate-spec-manifest.md +49 -19
  18. package/commands/generate-tech-docs.md +50 -20
  19. package/commands/generate-tech-docs.tmpl +1 -1
  20. package/commands/learn.md +50 -20
  21. package/commands/propose-scenario.md +50 -20
  22. package/commands/propose-scenario.tmpl +1 -1
  23. package/commands/qc-analyze.md +514 -0
  24. package/commands/qc-analyze.tmpl +71 -0
  25. package/commands/qc-design-test.md +510 -0
  26. package/commands/qc-design-test.tmpl +67 -0
  27. package/commands/qc-plan.md +492 -0
  28. package/commands/qc-plan.tmpl +49 -0
  29. package/commands/qc-report.md +491 -0
  30. package/commands/qc-report.tmpl +48 -0
  31. package/commands/qc-review.md +496 -0
  32. package/commands/qc-review.tmpl +53 -0
  33. package/commands/qc-run-test.md +538 -0
  34. package/commands/qc-run-test.tmpl +77 -0
  35. package/commands/refine-prd.md +203 -24
  36. package/commands/refine-prd.tmpl +16 -5
  37. package/commands/report-bug.md +49 -19
  38. package/commands/review-code.md +51 -21
  39. package/commands/review-code.tmpl +1 -1
  40. package/commands/review-context.md +198 -20
  41. package/commands/review-context.tmpl +11 -1
  42. package/commands/review-tech-docs.md +49 -19
  43. package/commands/setup-ai-first.md +14 -7
  44. package/commands/sync.md +30 -20
  45. package/commands/sync.tmpl +16 -13
  46. package/commands/update-framework.md +14 -7
  47. package/commands/validate-traces.md +106 -45
  48. package/commands/validate-traces.tmpl +57 -26
  49. package/core/FRAMEWORK_VERSION +1 -1
  50. package/core/commands/debug.md +50 -20
  51. package/core/commands/define-product.md +49 -19
  52. package/core/commands/{generate-tests.md → dev-gen-test.md} +85 -23
  53. package/{commands/run-tests.md → core/commands/dev-run-test.md} +102 -21
  54. package/core/commands/{smoke-test.md → dev-smoke-test.md} +54 -24
  55. package/core/commands/fix-bug.md +50 -20
  56. package/core/commands/generate-bdd.md +78 -21
  57. package/core/commands/generate-code.md +123 -23
  58. package/core/commands/generate-design-spec.md +142 -47
  59. package/core/commands/generate-prd.md +49 -19
  60. package/core/commands/generate-spec-manifest.md +49 -19
  61. package/core/commands/generate-tech-docs.md +50 -20
  62. package/core/commands/learn.md +50 -20
  63. package/core/commands/propose-scenario.md +50 -20
  64. package/core/commands/qc-analyze.md +514 -0
  65. package/core/commands/qc-design-test.md +510 -0
  66. package/core/commands/qc-plan.md +492 -0
  67. package/core/commands/qc-report.md +491 -0
  68. package/core/commands/qc-review.md +496 -0
  69. package/core/commands/qc-run-test.md +538 -0
  70. package/core/commands/refine-prd.md +203 -24
  71. package/core/commands/report-bug.md +49 -19
  72. package/core/commands/review-code.md +51 -21
  73. package/core/commands/review-context.md +198 -20
  74. package/core/commands/review-tech-docs.md +49 -19
  75. package/core/commands/setup-ai-first.md +14 -7
  76. package/core/commands/sync.md +30 -20
  77. package/core/commands/update-framework.md +14 -7
  78. package/core/commands/validate-traces.md +106 -45
  79. package/core/modules/qc-playwright/stack-profile.yaml +65 -0
  80. package/core/skills/code/SKILL.md +63 -26
  81. package/core/skills/debug/SKILL.md +78 -34
  82. package/core/skills/design-spec/SKILL.md +49 -19
  83. package/core/skills/discovery/SKILL.md +49 -19
  84. package/core/skills/prd/SKILL.md +28 -14
  85. package/core/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  86. package/core/skills/qc/qa-analyst/acceptance-criteria.md +56 -0
  87. package/core/skills/qc/qa-analyst/business-rules.md +55 -0
  88. package/core/skills/qc/qa-analyst/data-flow.md +60 -0
  89. package/core/skills/qc/qa-analyst/spec-breakdown.md +57 -0
  90. package/core/skills/qc/qa-designer/e2e/journey.md +41 -0
  91. package/core/skills/qc/qa-designer/exploratory/charter.md +68 -0
  92. package/core/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  93. package/core/skills/qc/qa-designer/functional/api.md +45 -0
  94. package/core/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  95. package/core/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  96. package/core/skills/qc/qa-designer/integration/api.md +42 -0
  97. package/core/skills/qc/qa-designer/integration/db.md +39 -0
  98. package/core/skills/qc/qa-designer/integration/gui.md +40 -0
  99. package/core/skills/qc/qa-designer/integration/kafka.md +40 -0
  100. package/core/skills/qc/qa-designer/non-functional.md +40 -0
  101. package/core/skills/qc/qa-planner/test-plan.md +120 -0
  102. package/core/skills/qc/qa-reviewer/script/e2e.md +87 -0
  103. package/core/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  104. package/core/skills/qc/qa-reviewer/script/functional.md +101 -0
  105. package/core/skills/qc/qa-reviewer/script/integration.md +91 -0
  106. package/core/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  107. package/core/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  108. package/core/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  109. package/core/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  110. package/core/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  111. package/core/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  112. package/core/skills/qc/qa-runner/e2e.md +49 -0
  113. package/core/skills/qc/qa-runner/exploratory/session.md +36 -0
  114. package/core/skills/qc/qa-runner/functional/api.md +35 -0
  115. package/core/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  116. package/core/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  117. package/core/skills/qc/qa-runner/integration.md +47 -0
  118. package/core/skills/qc/qa-runner/non-functional.md +49 -0
  119. package/core/skills/qc/qa-runner/report/report.md +37 -0
  120. package/core/skills/setup-ai-first/SKILL.md +14 -7
  121. package/core/skills/spec/SKILL.md +28 -14
  122. package/core/skills/test/SKILL.md +121 -54
  123. package/core/steps/capture-lesson.md +1 -1
  124. package/core/steps/context-loader.md +35 -12
  125. package/core/steps/report-footer.md +14 -7
  126. package/core/steps/review-fanout.md +138 -0
  127. package/core/steps/spawn-agent.md +1 -1
  128. package/core/steps/trace-mirror.md +18 -0
  129. package/core/templates/design-spec.template.md +16 -8
  130. package/core/templates/project-context.yaml +8 -0
  131. package/docs/01-getting-started/README.md +19 -0
  132. package/docs/01-getting-started/core-concepts.md +102 -0
  133. package/docs/01-getting-started/installation.md +154 -0
  134. package/docs/01-getting-started/quickstart.md +85 -0
  135. package/docs/02-guides/README.md +27 -0
  136. package/docs/02-guides/developer/README.md +46 -0
  137. package/docs/02-guides/developer/bdd-and-trace.md +123 -0
  138. package/docs/02-guides/developer/commands.md +76 -0
  139. package/docs/02-guides/developer/pr-checklist.md +15 -0
  140. package/docs/02-guides/developer/scenarios.md +448 -0
  141. package/docs/02-guides/developer/workflow.md +59 -0
  142. package/docs/02-guides/product-owner/README.md +77 -0
  143. package/docs/02-guides/product-owner/commands.md +30 -0
  144. package/docs/02-guides/product-owner/handoff-checklist.md +42 -0
  145. package/docs/02-guides/product-owner/prd-writing-rules.md +45 -0
  146. package/docs/02-guides/product-owner/scenarios.md +357 -0
  147. package/docs/02-guides/qc-automation.md +92 -0
  148. package/docs/02-guides/tester/README.md +72 -0
  149. package/docs/02-guides/tester/bug-reporting.md +117 -0
  150. package/docs/02-guides/tester/reading-specs.md +79 -0
  151. package/docs/02-guides/tester/scenarios.md +186 -0
  152. package/docs/02-guides/tester/spec-manifest.md +124 -0
  153. package/docs/02-guides/tester/test-checklist.md +31 -0
  154. package/docs/02-guides/tester/workflow.md +79 -0
  155. package/docs/03-concepts/README.md +19 -0
  156. package/docs/03-concepts/architecture.md +243 -0
  157. package/docs/03-concepts/pipeline.md +249 -0
  158. package/docs/03-concepts/traceability.md +148 -0
  159. package/docs/04-operations/README.md +33 -0
  160. package/docs/04-operations/bug-flow.md +321 -0
  161. package/docs/04-operations/publishing.md +137 -0
  162. package/docs/04-operations/sync-and-update.md +328 -0
  163. package/docs/05-reference/README.md +29 -0
  164. package/docs/05-reference/commands.md +229 -0
  165. package/docs/05-reference/modules.md +110 -0
  166. package/docs/05-reference/trace-schema.md +146 -0
  167. package/docs/README.md +51 -0
  168. package/modules/qc-playwright/stack-profile.yaml +65 -0
  169. package/package.json +2 -2
  170. package/skills/code/SKILL.md +63 -26
  171. package/skills/debug/SKILL.md +78 -34
  172. package/skills/debug/SKILL.tmpl +1 -1
  173. package/skills/design-spec/SKILL.md +49 -19
  174. package/skills/discovery/SKILL.md +49 -19
  175. package/skills/prd/SKILL.md +28 -14
  176. package/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  177. package/skills/qc/qa-analyst/acceptance-criteria.md +56 -0
  178. package/skills/qc/qa-analyst/business-rules.md +55 -0
  179. package/skills/qc/qa-analyst/data-flow.md +60 -0
  180. package/skills/qc/qa-analyst/spec-breakdown.md +57 -0
  181. package/skills/qc/qa-designer/e2e/journey.md +41 -0
  182. package/skills/qc/qa-designer/exploratory/charter.md +68 -0
  183. package/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  184. package/skills/qc/qa-designer/functional/api.md +45 -0
  185. package/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  186. package/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  187. package/skills/qc/qa-designer/integration/api.md +42 -0
  188. package/skills/qc/qa-designer/integration/db.md +39 -0
  189. package/skills/qc/qa-designer/integration/gui.md +40 -0
  190. package/skills/qc/qa-designer/integration/kafka.md +40 -0
  191. package/skills/qc/qa-designer/non-functional.md +40 -0
  192. package/skills/qc/qa-planner/test-plan.md +120 -0
  193. package/skills/qc/qa-reviewer/script/e2e.md +87 -0
  194. package/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  195. package/skills/qc/qa-reviewer/script/functional.md +101 -0
  196. package/skills/qc/qa-reviewer/script/integration.md +91 -0
  197. package/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  198. package/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  199. package/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  200. package/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  201. package/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  202. package/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  203. package/skills/qc/qa-runner/e2e.md +49 -0
  204. package/skills/qc/qa-runner/exploratory/session.md +36 -0
  205. package/skills/qc/qa-runner/functional/api.md +35 -0
  206. package/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  207. package/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  208. package/skills/qc/qa-runner/integration.md +47 -0
  209. package/skills/qc/qa-runner/non-functional.md +49 -0
  210. package/skills/qc/qa-runner/report/report.md +37 -0
  211. package/skills/setup-ai-first/SKILL.md +14 -7
  212. package/skills/spec/SKILL.md +28 -14
  213. package/skills/test/SKILL.md +121 -54
  214. package/skills/test/SKILL.tmpl +9 -9
  215. package/steps/capture-lesson.md +1 -1
  216. package/steps/context-loader.md +35 -12
  217. package/steps/report-footer.md +14 -7
  218. package/steps/review-fanout.md +138 -0
  219. package/steps/spawn-agent.md +1 -1
  220. package/steps/trace-mirror.md +18 -0
  221. package/templates/design-spec.template.md +16 -8
  222. package/templates/project-context.yaml +8 -0
  223. package/ARCHITECTURE.md +0 -247
@@ -74,7 +74,7 @@ If `services` section is present:
74
74
 
75
75
  **2. Route to service** — if active domain matches a key in `services`:
76
76
  - Override `paths.specs_dir` → `services.{domain}.specs_dir`
77
- - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
77
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, the tech-design (API contract) is a cross-team artifact and must live in the shared spec repo (handled in step 4), so leave `tech_docs_dir` for step 4 to route — do NOT pin it per-service here.
78
78
  - Store `active_service` = `services.{domain}.path`
79
79
  - Store `active_service_module` = `services.{domain}.module`
80
80
  - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
@@ -86,7 +86,7 @@ If `services` section is present:
86
86
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
87
87
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
88
88
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
89
- - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **only if step 2 did not already route it to a service** (multi-service umbrellas keep per-service tech-docs). This publishes the BE-authored API contract into the shared spec repo so FE/App can read it via the spec submodule at `/generate-code --phase=integration`.
89
+ - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **always when `spec_source` is set** (step 2 no longer pins tech-docs per-service in this case). The tech-design IS the cross-team API contract: BE authors it here, and FE/App read it from the same spec submodule at `/generate-code --phase=integration`. *(Per-service tech-docs only happen when there is no `spec_source` — a pure multi-service BE repo with no shared spec module.)*
90
90
  - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
91
91
  - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
92
92
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
@@ -117,7 +117,7 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
117
117
  | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
118
118
 
119
119
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
120
- - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
120
+ - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
121
121
  - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
122
122
 
123
123
  **4. If service config not found** — keep umbrella defaults, still set `service_root = {active_service}` (path anchor is always needed even without a config override).
@@ -132,19 +132,41 @@ If the file does not exist → skip silently.
132
132
 
133
133
  ---
134
134
 
135
- ## Step 3 — [CRITICAL] Load CLAUDE.md
135
+ ## Step 3 — [CRITICAL] Load CLAUDE.md (layered: root + service overlay)
136
136
 
137
137
  *This is the highest-priority context — it defines HOW to write code and documents for this project.*
138
138
 
139
- Read `CLAUDE.md`. Extract and store:
139
+ CLAUDE.md is loaded in **two layers** so umbrella-wide rules and service-specific
140
+ architecture/coding standards compose correctly. The agent always sits at the umbrella
141
+ root, but the implementation code lives in a service submodule with its OWN stack,
142
+ architecture, and conventions — so the service's CLAUDE.md must win for code generation.
143
+
144
+ **Layer 1 — [BASE] Root CLAUDE.md (umbrella-wide).**
145
+ Read `CLAUDE.md` at the repo root. Treat its contents as the **shared baseline** for the
146
+ whole umbrella — git conventions, data-protection posture, cross-cutting rules, and (in
147
+ single-service mode) the project's only architecture + coding standards.
148
+
149
+ **Layer 2 — [OVERLAY] Service CLAUDE.md (umbrella mode only).**
150
+ *Run only if `service_root` was set in Step 1.6 (i.e. a real service was routed to).*
151
+ Read `{service_root}/CLAUDE.md`. This file defines the architecture + coding standards of
152
+ the **actual stack being implemented** (e.g. `user-service` = java-spring, `web` = nextjs).
153
+ Overlay it on top of Layer 1: **on any conflict, the service value WINS** for architecture,
154
+ coding standards, and error handling. Layer-1 values that the service does not redefine
155
+ (e.g. git conventions, banned patterns shared org-wide) remain in effect.
156
+
157
+ From the **merged** result, extract and store:
140
158
 
141
159
  - **§1 Project Overview** → project name, language, framework, build/test commands, domains
142
- - **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules
143
- - **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns
144
- - **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name
145
- - **§7 Git Conventions** → branch naming pattern, commit message format
160
+ - **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules — *service overlay wins*
161
+ - **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns — *service overlay wins*
162
+ - **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name — *service overlay wins*
163
+ - **§7 Git Conventions** → branch naming pattern, commit message format — *root baseline unless service redefines*
146
164
 
147
- If `CLAUDE.md` does not exist → note it as missing and continue with project-context.yaml data only.
165
+ **Resolution rules:**
166
+ - If both layers exist → merge as above; record `claude_md_source = root + {service_root}`.
167
+ - If only the service overlay exists (no root CLAUDE.md) → use the service file alone; `claude_md_source = {service_root}`.
168
+ - If `service_root` is set but `{service_root}/CLAUDE.md` is **missing** → fall back to root CLAUDE.md and flag ⚠️ in the Step 7 recap (the service has no architecture/coding-standards definition — code generation will use umbrella defaults, which may be the wrong stack).
169
+ - If neither exists → note CLAUDE.md as missing and continue with project-context.yaml data only.
148
170
 
149
171
  ---
150
172
 
@@ -210,7 +232,7 @@ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
210
232
 
211
233
  If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
212
234
 
213
- These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (generate-tests, debug, fix-bug, smoke-test).
235
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (dev-gen-test, debug, fix-bug, dev-smoke-test).
214
236
 
215
237
  ---
216
238
 
@@ -244,7 +266,8 @@ Output exactly this block:
244
266
  [CTX LOADED]
245
267
  Stack : {language} / {framework} / {database}
246
268
  Platform : {active_module} ({platform_type})
247
- Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
269
+ Layers : {layer order from merged CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
270
+ CLAUDE.md : {root + {service_root} | {service_root} only | root only | ⚠️ service overlay MISSING — using root | missing}
248
271
  Ticket : {ticket_prefix}-
249
272
  Dict : {loaded — N canonical terms, M banned terms | missing}
250
273
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
@@ -34,15 +34,22 @@ Suggest the logical next command based on workflow phase:
34
34
  | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
35
35
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
36
36
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
37
+ | /qc-analyze | `/qc-plan {UC-ID}` (resolve 🔴 blocker gaps first) |
38
+ | /qc-plan | `/qc-design-test {UC-ID}` |
39
+ | /qc-design-test | `/qc-review {UC-ID}` (test-case review) |
40
+ | /qc-review (test-case) | `/qc-run-test {UC-ID}` if APPROVED; fix TCs if NEEDS_FIX |
41
+ | /qc-run-test | `/qc-report {UC-ID}` then `/qc-review {UC-ID}` (script review) |
42
+ | /qc-review (script) | `/qc-report {UC-ID}` then create PR if APPROVED |
43
+ | /qc-report | `/validate-traces {UC-ID}` to refresh Living Docs (qc_status) |
37
44
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
38
45
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
39
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
40
- | /generate-tests | `/run-tests {UC-ID}` |
41
- | /run-tests (passing) | `/review-code {UC-ID}` |
42
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
43
- | /review-code | `/smoke-test {UC-ID}` or create PR |
44
- | /smoke-test | Create PR and link to ticket |
45
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
46
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
47
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
48
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
49
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
50
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
51
+ | /dev-smoke-test | Create PR and link to ticket |
52
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
46
53
  | /fix-bug | Create PR and link to ticket |
47
54
  | /debug | `/fix-bug {ticket-id}` if fix needed |
48
55
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -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
+ ```
@@ -80,7 +80,7 @@ Build payload and invoke Agent tool for each UC:
80
80
  }
81
81
  ```
82
82
 
83
- > **Command scope**: Only `/generate-bdd` initiates orchestration mode. `/generate-code` and `/generate-tests` 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
+ > **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.
84
84
 
85
85
  Serialize this JSON and pass as `$ARGUMENTS` when invoking the sub-agent command.
86
86
 
@@ -0,0 +1,18 @@
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 service `.trace/` IS the panel location, so nothing to mirror.*
5
+
6
+ After updating the authoritative service TSV(s) at `{paths.trace_dir}`:
7
+
8
+ 1. Resolve `panel_mirror = ./.trace` at the **current workspace root** (where this command runs).
9
+ 2. If `panel_mirror` resolves to a different path than `{paths.trace_dir}`, copy each
10
+ just-updated `{UC-ID}.tsv` → `{panel_mirror}/{service-name}/{UC-ID}.tsv`
11
+ (create the dir; overwrite). Use `active_service` for `{service-name}`.
12
+
13
+ This keeps the open workspace's Living Docs panel current **between syncs** — it is a
14
+ **local convenience mirror only**. The *canonical* report in the spec module
15
+ (`{spec_source}/.living-docs/`) and the merged `trace-report.json` are rebuilt by
16
+ `/sync` or `/validate-traces` (those need every service's data, so a single per-UC
17
+ command cannot produce them). For orchestrated commands, do this once in the orchestrator
18
+ after all sub-agents return — not inside each sub-agent.
@@ -14,6 +14,13 @@
14
14
  - ⚠️ TODO → đánh dấu [TODO — chưa implement]
15
15
  - ❌ Chưa có → đánh dấu [NEW — cần confirm với designer]
16
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
+
17
24
  SCREEN STATES (bắt buộc mỗi màn):
18
25
  - Tối thiểu: default, loading, error
19
26
  - Thêm "empty" nếu màn có thể hiển thị trạng thái không có dữ liệu
@@ -34,7 +41,7 @@
34
41
  | **Service** | {active_service} |
35
42
  | **Domain** | {domain} |
36
43
  | **Business PRD** | [{TICKET-ID}](./{TICKET-ID}-slug.md) |
37
- | **Figma** | {figma_url or TBD} |
44
+ | **Figma** | {feature file link} ({linked}/{N} frames linked) |
38
45
  | **Author** | {PO name or "AI-assisted"} |
39
46
  | **Created** | {YYYY-MM-DD} |
40
47
  | **Updated** | {YYYY-MM-DD} |
@@ -43,10 +50,10 @@
43
50
 
44
51
  # 1. Screen Inventory
45
52
 
46
- | # | Screen Name | Entry Point | Figma Frame | Notes |
47
- |---|-------------|-------------|-------------|-------|
48
- | 1 | {Screen 1} | {how user arrives} | [Frame]({figma_url}) | |
49
- | 2 | {Screen 2} | {entry point} | [Frame]({figma_url}) | |
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 | |
50
57
 
51
58
  ---
52
59
 
@@ -181,9 +188,10 @@
181
188
 
182
189
  ## Figma Summary
183
190
 
184
- | Screen | Figma Frame | Status |
185
- |------------|----------------------|--------------------------------|
186
- | {Screen 1} | [Link]({url}) | ✅ Ready / ⏳ WIP / ❌ Missing |
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 |
187
195
 
188
196
  ## Design Tokens Referenced
189
197
 
@@ -106,6 +106,14 @@ domains:
106
106
  # module: "{{STACK_MODULE}}" # e.g., java-spring, nextjs, flutter
107
107
  # specs_dir: "{{SERVICE_SUBMODULE_DIR}}/specs/bdd"
108
108
  # tech_docs_dir: "{{SERVICE_SUBMODULE_DIR}}/specs/tech-docs"
109
+ #
110
+ # IMPORTANT — per-service CLAUDE.md:
111
+ # Each service submodule should have its OWN CLAUDE.md ({path}/CLAUDE.md) defining its
112
+ # architecture + coding standards for ITS stack. context-loader loads CLAUDE.md in two
113
+ # layers: root CLAUDE.md (umbrella-wide shared rules) + {service}/CLAUDE.md (overlay,
114
+ # wins on conflict for architecture/coding-standards). The agent sits at the umbrella
115
+ # root, so without a service CLAUDE.md, code generation falls back to umbrella defaults
116
+ # (likely the wrong stack). Generate one per service via /setup-ai-first inside each.
109
117
  # {{DOMAIN_2}}:
110
118
  # path: "{{SERVICE_2_DIR}}"
111
119
  # module: "{{STACK_MODULE}}"
package/ARCHITECTURE.md DELETED
@@ -1,247 +0,0 @@
1
- # Framework Architecture
2
-
3
- > **Nguyên tắc**: Nhìn file này để hiểu toàn bộ framework trước khi đọc bất kỳ file chi tiết nào.
4
-
5
- ---
6
-
7
- ## Layer Diagram
8
-
9
- ```
10
- ╔══════════════════════════════════════════════════════════════════════╗
11
- ║ SPEC-DRIVEN DEV FRAMEWORK v0.3 ║
12
- ╚══════════════════════════════════════════════════════════════════════╝
13
-
14
- ┌──────────────────────────────────────────────────────────────────────┐
15
- │ LAYER 0 — PROTECTION (luôn chạy trước) │
16
- │ │
17
- │ hooks/data-guard.js → PreToolUse hook: chặn đọc file nhạy cảm │
18
- │ rules/data-protection.md → Quy tắc declarative cho AI agent │
19
- └──────────────────────────────────────────────────────────────────────┘
20
- │ safe ↓ blocked → ✋ STOP
21
- ┌──────────────────────────────────────────────────────────────────────┐
22
- │ LAYER 1 — ENTRY POINT (user trigger) │
23
- │ │
24
- │ commands/*.tmpl skills/*/SKILL.tmpl │
25
- │ (slash commands) (auto-trigger by description match) │
26
- │ /generate-bdd detect: "tạo BDD", "sinh feature" │
27
- │ /generate-code detect: "viết code", "implement" │
28
- └──────────────────────────────────────────────────────────────────────┘
29
- │ both built by bin/build.js
30
- ┌──────────────────────────────────────────────────────────────────────┐
31
- │ LAYER 2 — SHARED STEPS (DRY, injected) │
32
- │ │
33
- │ steps/gate.md → resolve target file + CHECKPOINT │
34
- │ steps/context-loader.md → load project config + rules │
35
- │ steps/report-footer.md → standard output format │
36
- │ │
37
- │ Injected at build time via {{include:steps/X.md}} │
38
- │ Source: *.tmpl → Output: *.md (gitignored) │
39
- └──────────────────────────────────────────────────────────────────────┘
40
- │ context loaded
41
- ┌──────────────────────────────────────────────────────────────────────┐
42
- │ LAYER 3 — PROJECT CONTEXT (read from consumer project) │
43
- │ │
44
- │ .agent/project-context.yaml → paths, tech_stack, domains │
45
- │ CLAUDE.md → architecture, coding standards │
46
- │ rules/data-protection.md → what AI must never access │
47
- │ .agent/modules/{stack}/ → stack rules (plug-in, optional) │
48
- └──────────────────────────────────────────────────────────────────────┘
49
- │ context-aware
50
- ┌──────────────────────────────────────────────────────────────────────┐
51
- │ LAYER 4 — EXECUTION (command logic) │
52
- │ │
53
- │ DISCOVERY PRD / BDD CODE / TEST DEBUG │
54
- │ /define-product /generate-prd /generate-code /fix-bug │
55
- │ /refine-prd /generate-tests /debug │
56
- │ /generate-bdd /run-tests /validate- │
57
- │ /generate-tech-docs /smoke-test traces │
58
- │ /review-code /setup-ai-first │
59
- └──────────────────────────────────────────────────────────────────────┘
60
-
61
- ┌──────────────────────────────────────────────────────────────────────┐
62
- │ LAYER 5 — OUTPUT (artifacts in consumer proj) │
63
- │ │
64
- │ specs/product-definition/ specs/prd/ specs/bdd/ │
65
- │ tech-docs/ src/ .trace/ .agent/review/ │
66
- └──────────────────────────────────────────────────────────────────────┘
67
- ```
68
-
69
- ---
70
-
71
- ## Data Flow — Một command chạy như thế nào
72
-
73
- ```
74
- User types: /generate-bdd specs/prd/payment/PAY-01.md
75
-
76
-
77
- [L0] data-guard.js checks tool calls in real-time
78
- → nếu AI cố đọc .env / *.key → BLOCK + warn
79
-
80
-
81
- [L1] commands/generate-bdd.md được Claude đọc
82
- (assembled từ generate-bdd.tmpl + injected steps)
83
-
84
-
85
- [L2] gate.md → resolve file path từ $ARGUMENTS
86
- context-loader.md → đọc project-context.yaml, CLAUDE.md,
87
- rules/data-protection.md,
88
- modules/{stack}/stack-profile.yaml
89
-
90
-
91
- [L3] Claude biết: tech_stack, domains, architecture rules,
92
- sensitive files to avoid, stack-specific patterns
93
-
94
-
95
- [L4] generate-bdd logic:
96
- → đọc PRD → extract UC/BR/AC
97
- → apply BDD rules R1-R10
98
- → viết specs/bdd/{domain}/{UC-ID}.feature
99
-
100
-
101
- [L5] Output: specs/bdd/payment/PAY-01-UC1.feature
102
- ```
103
-
104
- ---
105
-
106
- ## Build System
107
-
108
- ```
109
- Source (committed to git) Build output (gitignored)
110
- ────────────────────────── ─────────────────────────
111
- commands/*.tmpl ──┐
112
- skills/**/SKILL.tmpl ──┤ node bin/build.js → commands/*.md
113
- steps/*.md (shared) ──┘ skills/**/SKILL.md
114
-
115
- Trigger:
116
- npm run build ← manual
117
- prepublishOnly hook ← auto before npm publish
118
- bin/index.js install ← auto when user runs npx
119
- ```
120
-
121
- ---
122
-
123
- ## Module Plug-in System
124
-
125
- ```
126
- Available modules (modules/):
127
- java-spring, angular, react, nextjs,
128
- dotnet, golang, php-laravel, context-engineering
129
-
130
- Usage:
131
- npx @anhth2/spec-driven-dev-plugin --module java-spring
132
- └─ copies modules/java-spring/ → consumer/.agent/modules/java-spring/
133
-
134
- At runtime, context-loader.md reads:
135
- .agent/modules/{tech_stack.module}/stack-profile.yaml
136
- .agent/modules/{tech_stack.module}/architecture-snippets/
137
- ```
138
-
139
- ---
140
-
141
- ## Hook System — Data Protection
142
-
143
- ```
144
- Consumer project setup:
145
- .claude/settings.json ← registers hook (provided as template)
146
- hooks/data-guard.js ← copied from this package on install
147
-
148
- Runtime:
149
- Every tool use (Read, Write, Edit, Bash)
150
-
151
-
152
- data-guard.js checks:
153
- .env* / *.key / *.pem / *secret* / *password* / *credential*
154
- application-prod.* / appsettings.Production.*
155
-
156
- safe → allow blocked → exit(2) + warn user
157
- ```
158
-
159
- ---
160
-
161
- ## Future — Sub-Agent Pattern (v2 roadmap)
162
-
163
- Khi một số command quá nặng cho single context window:
164
-
165
- ```
166
- Main session (orchestrator — lightweight, chỉ coordinate)
167
-
168
- ├─ spawn spec-agent ──→ /refine-prd analysis (own context window)
169
- │ └─ returns: findings.yaml
170
-
171
- ├─ spawn codegen-agent ──→ /generate-code UC1 (own context window)
172
- │ └─ returns: src/ changes
173
-
174
- └─ spawn test-agent ──→ /generate-tests UC1 (own context window)
175
- └─ returns: test files
176
-
177
- Benefits:
178
- - Main session không bị bloat bởi large file reads
179
- - Mỗi agent focus vào 1 task, ít hallucination hơn
180
- - Parallel execution cho multiple UCs
181
-
182
- Implementation path:
183
- 1. Tạo steps/spawn-agent.md — pattern + handoff payload format
184
- 2. Tạo commands/orchestrate-feature.tmpl — top-level orchestrator
185
- 3. Sub-agent commands nhận input qua $ARGUMENTS (JSON payload)
186
- ```
187
-
188
- ---
189
-
190
- ## Directory Map
191
-
192
- ```
193
- spec-driven-dev/
194
- ├── ARCHITECTURE.md ← Đọc đây trước ◀◀◀
195
- ├── bin/
196
- │ ├── build.js ← assembles *.tmpl → *.md
197
- │ └── index.js ← npm installer + hook installer
198
- ├── commands/
199
- │ └── *.tmpl ← slash commands (23 commands)
200
- ├── hooks/
201
- │ ├── data-guard.js ← PreToolUse sensitive file protection
202
- │ └── settings.json ← hook registration template
203
- ├── modules/
204
- │ └── {stack}/ ← 8 stacks: java-spring, angular, react,
205
- │ ├── module.yaml nextjs, dotnet, golang, php-laravel,
206
- │ ├── stack-profile.yaml context-engineering
207
- │ └── architecture-snippets/
208
- ├── rules/
209
- │ ├── data-protection.md ← what AI must NEVER read/write
210
- │ └── workflow.md ← general AI behavior rules
211
- ├── skills/
212
- │ └── {name}/SKILL.tmpl ← Claude plugin skills (8 skills)
213
- ├── steps/
214
- │ ├── gate.md ← shared: file resolve + checkpoint
215
- │ ├── context-loader.md ← shared: load all project context
216
- │ ├── spawn-agent.md ← shared: sub-agent orchestration
217
- │ ├── capture-lesson.md ← shared: record a guardrail (/learn etc.)
218
- │ └── report-footer.md ← shared: standard output format
219
- └── templates/
220
- ├── project-context.yaml ← consumer project config template
221
- ├── architecture.template.md
222
- └── platform-guide.template.md
223
- ```
224
-
225
- > Build output (gitignored): `commands/*.md`, `skills/**/SKILL.md`, and `core/` (the distributable copied into a consumer's `.agent/` by `--init`). Consumer-side tester artifacts live in the shared spec repo under `feedback/bug-reports/` and `feedback/bdd-proposals/`. In umbrella mode the **API contract (tech-docs)** also lives in the shared spec repo (`{spec_source}/specs/tech-docs/`) so BE and FE/App read the same contract via the spec submodule.
226
-
227
- ---
228
-
229
- ## Maintenance Guide
230
-
231
- | Muốn thay đổi gì | Sửa file nào |
232
- |------------------|-------------|
233
- | Logic của 1 command cụ thể | `commands/{name}.tmpl` |
234
- | Logic của 1 skill cụ thể | `skills/{name}/SKILL.tmpl` |
235
- | Gate / checkpoint pattern | `steps/gate.md` |
236
- | Context loading | `steps/context-loader.md` |
237
- | Report format | `steps/report-footer.md` |
238
- | Sensitive file patterns | `hooks/data-guard.js` + `rules/data-protection.md` |
239
- | Stack-specific rules | `modules/{stack}/stack-profile.yaml` |
240
- | Project setup template | `templates/project-context.yaml` |
241
- | Build system | `bin/build.js` |
242
- | Installer | `bin/index.js` |
243
-
244
- Sau khi sửa bất kỳ `.tmpl` hoặc `steps/*.md`:
245
- ```bash
246
- npm run build # regenerate tất cả *.md
247
- ```