@anhth2/spec-driven-dev-plugin 0.10.0 → 0.12.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 (207) hide show
  1. package/commands/debug.md +43 -8
  2. package/commands/define-product.md +43 -8
  3. package/commands/dev-gen-test.md +44 -9
  4. package/commands/dev-gen-test.tmpl +1 -1
  5. package/commands/dev-run-test.md +48 -10
  6. package/commands/dev-run-test.tmpl +5 -2
  7. package/commands/dev-smoke-test.md +43 -8
  8. package/commands/fix-bug.md +79 -14
  9. package/commands/fix-bug.tmpl +36 -6
  10. package/commands/generate-bdd.md +49 -10
  11. package/commands/generate-bdd.tmpl +6 -2
  12. package/commands/generate-code.md +44 -9
  13. package/commands/generate-code.tmpl +1 -1
  14. package/commands/generate-design-spec.md +43 -8
  15. package/commands/generate-prd.md +43 -8
  16. package/commands/generate-spec-manifest.md +43 -8
  17. package/commands/generate-tech-docs.md +43 -8
  18. package/commands/learn.md +43 -8
  19. package/commands/propose-scenario.md +74 -19
  20. package/commands/propose-scenario.tmpl +31 -11
  21. package/commands/qc-analyze.md +534 -0
  22. package/commands/qc-analyze.tmpl +86 -0
  23. package/commands/qc-design-test.md +515 -0
  24. package/commands/qc-design-test.tmpl +67 -0
  25. package/commands/qc-plan.md +497 -0
  26. package/commands/qc-plan.tmpl +49 -0
  27. package/commands/qc-report.md +508 -0
  28. package/commands/qc-report.tmpl +60 -0
  29. package/commands/qc-review.md +501 -0
  30. package/commands/qc-review.tmpl +53 -0
  31. package/commands/qc-run-test.md +549 -0
  32. package/commands/qc-run-test.tmpl +83 -0
  33. package/commands/refine-prd.md +43 -8
  34. package/commands/report-bug.md +59 -10
  35. package/commands/report-bug.tmpl +16 -2
  36. package/commands/review-code.md +43 -8
  37. package/commands/review-context.md +43 -8
  38. package/commands/review-tech-docs.md +43 -8
  39. package/commands/setup-ai-first.md +7 -0
  40. package/commands/sync.md +19 -9
  41. package/commands/sync.tmpl +12 -9
  42. package/commands/update-framework.md +7 -0
  43. package/commands/validate-traces.md +67 -12
  44. package/commands/validate-traces.tmpl +24 -4
  45. package/core/FRAMEWORK_VERSION +1 -1
  46. package/core/commands/debug.md +43 -8
  47. package/core/commands/define-product.md +43 -8
  48. package/core/commands/dev-gen-test.md +44 -9
  49. package/core/commands/dev-run-test.md +48 -10
  50. package/core/commands/dev-smoke-test.md +43 -8
  51. package/core/commands/fix-bug.md +79 -14
  52. package/core/commands/generate-bdd.md +49 -10
  53. package/core/commands/generate-code.md +44 -9
  54. package/core/commands/generate-design-spec.md +43 -8
  55. package/core/commands/generate-prd.md +43 -8
  56. package/core/commands/generate-spec-manifest.md +43 -8
  57. package/core/commands/generate-tech-docs.md +43 -8
  58. package/core/commands/learn.md +43 -8
  59. package/core/commands/propose-scenario.md +74 -19
  60. package/core/commands/qc-analyze.md +534 -0
  61. package/core/commands/qc-design-test.md +515 -0
  62. package/core/commands/qc-plan.md +497 -0
  63. package/core/commands/qc-report.md +508 -0
  64. package/core/commands/qc-review.md +501 -0
  65. package/core/commands/qc-run-test.md +549 -0
  66. package/core/commands/refine-prd.md +43 -8
  67. package/core/commands/report-bug.md +59 -10
  68. package/core/commands/review-code.md +43 -8
  69. package/core/commands/review-context.md +43 -8
  70. package/core/commands/review-tech-docs.md +43 -8
  71. package/core/commands/setup-ai-first.md +7 -0
  72. package/core/commands/sync.md +19 -9
  73. package/core/commands/update-framework.md +7 -0
  74. package/core/commands/validate-traces.md +67 -12
  75. package/core/modules/qc-playwright/stack-profile.yaml +65 -0
  76. package/core/skills/code/SKILL.md +50 -8
  77. package/core/skills/debug/SKILL.md +57 -8
  78. package/core/skills/design-spec/SKILL.md +43 -8
  79. package/core/skills/discovery/SKILL.md +43 -8
  80. package/core/skills/prd/SKILL.md +14 -0
  81. package/core/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  82. package/core/skills/qc/qa-analyst/acceptance-criteria.md +60 -0
  83. package/core/skills/qc/qa-analyst/business-rules.md +59 -0
  84. package/core/skills/qc/qa-analyst/data-flow.md +64 -0
  85. package/core/skills/qc/qa-analyst/spec-breakdown.md +61 -0
  86. package/core/skills/qc/qa-designer/e2e/journey.md +41 -0
  87. package/core/skills/qc/qa-designer/exploratory/charter.md +68 -0
  88. package/core/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  89. package/core/skills/qc/qa-designer/functional/api.md +45 -0
  90. package/core/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  91. package/core/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  92. package/core/skills/qc/qa-designer/integration/api.md +42 -0
  93. package/core/skills/qc/qa-designer/integration/db.md +39 -0
  94. package/core/skills/qc/qa-designer/integration/gui.md +40 -0
  95. package/core/skills/qc/qa-designer/integration/kafka.md +40 -0
  96. package/core/skills/qc/qa-designer/non-functional.md +40 -0
  97. package/core/skills/qc/qa-planner/test-plan.md +120 -0
  98. package/core/skills/qc/qa-reviewer/script/e2e.md +87 -0
  99. package/core/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  100. package/core/skills/qc/qa-reviewer/script/functional.md +101 -0
  101. package/core/skills/qc/qa-reviewer/script/integration.md +91 -0
  102. package/core/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  103. package/core/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  104. package/core/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  105. package/core/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  106. package/core/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  107. package/core/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  108. package/core/skills/qc/qa-runner/e2e.md +49 -0
  109. package/core/skills/qc/qa-runner/exploratory/session.md +36 -0
  110. package/core/skills/qc/qa-runner/functional/api.md +35 -0
  111. package/core/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  112. package/core/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  113. package/core/skills/qc/qa-runner/integration.md +47 -0
  114. package/core/skills/qc/qa-runner/non-functional.md +49 -0
  115. package/core/skills/qc/qa-runner/report/report.md +37 -0
  116. package/core/skills/setup-ai-first/SKILL.md +7 -0
  117. package/core/skills/spec/SKILL.md +14 -0
  118. package/core/skills/test/SKILL.md +93 -16
  119. package/core/steps/context-loader.md +36 -8
  120. package/core/steps/report-footer.md +7 -0
  121. package/core/templates/project-context.yaml +27 -1
  122. package/docs/01-getting-started/README.md +19 -0
  123. package/docs/01-getting-started/core-concepts.md +102 -0
  124. package/docs/01-getting-started/installation.md +156 -0
  125. package/docs/01-getting-started/quickstart.md +85 -0
  126. package/docs/02-guides/README.md +27 -0
  127. package/docs/02-guides/developer/README.md +46 -0
  128. package/docs/02-guides/developer/bdd-and-trace.md +123 -0
  129. package/docs/02-guides/developer/commands.md +76 -0
  130. package/docs/02-guides/developer/pr-checklist.md +15 -0
  131. package/docs/02-guides/developer/scenarios.md +448 -0
  132. package/docs/02-guides/developer/workflow.md +61 -0
  133. package/docs/02-guides/product-owner/README.md +77 -0
  134. package/docs/02-guides/product-owner/commands.md +30 -0
  135. package/docs/02-guides/product-owner/handoff-checklist.md +42 -0
  136. package/docs/02-guides/product-owner/prd-writing-rules.md +45 -0
  137. package/docs/02-guides/product-owner/scenarios.md +357 -0
  138. package/docs/02-guides/qc-automation.md +157 -0
  139. package/docs/02-guides/tester/README.md +74 -0
  140. package/docs/02-guides/tester/bug-reporting.md +117 -0
  141. package/docs/02-guides/tester/reading-specs.md +79 -0
  142. package/docs/02-guides/tester/scenarios.md +186 -0
  143. package/docs/02-guides/tester/spec-manifest.md +124 -0
  144. package/docs/02-guides/tester/test-checklist.md +31 -0
  145. package/docs/02-guides/tester/workflow.md +80 -0
  146. package/docs/03-concepts/README.md +19 -0
  147. package/docs/03-concepts/architecture.md +245 -0
  148. package/docs/03-concepts/pipeline.md +262 -0
  149. package/docs/03-concepts/traceability.md +149 -0
  150. package/docs/04-operations/README.md +33 -0
  151. package/docs/04-operations/bug-flow.md +362 -0
  152. package/docs/04-operations/publishing.md +137 -0
  153. package/docs/04-operations/sync-and-update.md +365 -0
  154. package/docs/05-reference/README.md +29 -0
  155. package/docs/05-reference/commands.md +229 -0
  156. package/docs/05-reference/modules.md +110 -0
  157. package/docs/05-reference/trace-schema.md +152 -0
  158. package/docs/README.md +51 -0
  159. package/modules/qc-playwright/stack-profile.yaml +65 -0
  160. package/package.json +2 -2
  161. package/skills/code/SKILL.md +50 -8
  162. package/skills/debug/SKILL.md +57 -8
  163. package/skills/design-spec/SKILL.md +43 -8
  164. package/skills/discovery/SKILL.md +43 -8
  165. package/skills/prd/SKILL.md +14 -0
  166. package/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  167. package/skills/qc/qa-analyst/acceptance-criteria.md +60 -0
  168. package/skills/qc/qa-analyst/business-rules.md +59 -0
  169. package/skills/qc/qa-analyst/data-flow.md +64 -0
  170. package/skills/qc/qa-analyst/spec-breakdown.md +61 -0
  171. package/skills/qc/qa-designer/e2e/journey.md +41 -0
  172. package/skills/qc/qa-designer/exploratory/charter.md +68 -0
  173. package/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  174. package/skills/qc/qa-designer/functional/api.md +45 -0
  175. package/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  176. package/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  177. package/skills/qc/qa-designer/integration/api.md +42 -0
  178. package/skills/qc/qa-designer/integration/db.md +39 -0
  179. package/skills/qc/qa-designer/integration/gui.md +40 -0
  180. package/skills/qc/qa-designer/integration/kafka.md +40 -0
  181. package/skills/qc/qa-designer/non-functional.md +40 -0
  182. package/skills/qc/qa-planner/test-plan.md +120 -0
  183. package/skills/qc/qa-reviewer/script/e2e.md +87 -0
  184. package/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  185. package/skills/qc/qa-reviewer/script/functional.md +101 -0
  186. package/skills/qc/qa-reviewer/script/integration.md +91 -0
  187. package/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  188. package/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  189. package/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  190. package/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  191. package/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  192. package/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  193. package/skills/qc/qa-runner/e2e.md +49 -0
  194. package/skills/qc/qa-runner/exploratory/session.md +36 -0
  195. package/skills/qc/qa-runner/functional/api.md +35 -0
  196. package/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  197. package/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  198. package/skills/qc/qa-runner/integration.md +47 -0
  199. package/skills/qc/qa-runner/non-functional.md +49 -0
  200. package/skills/qc/qa-runner/report/report.md +37 -0
  201. package/skills/setup-ai-first/SKILL.md +7 -0
  202. package/skills/spec/SKILL.md +14 -0
  203. package/skills/test/SKILL.md +93 -16
  204. package/steps/context-loader.md +36 -8
  205. package/steps/report-footer.md +7 -0
  206. package/templates/project-context.yaml +27 -1
  207. package/ARCHITECTURE.md +0 -258
@@ -36,6 +36,8 @@ Read `.agent/project-context.yaml`. Extract and store:
36
36
  - `paths.specs_dir` → BDD specs root
37
37
  - `paths.prd_dir` → PRD documents root
38
38
  - `paths.refinement_dir` → findings/review output dir
39
+ - `paths.qc_dir` → QC automation artifacts root (visible top-level, one subfolder per UC: `{qc_dir}/{UC-ID}/`)
40
+ - `paths.qc_skills_dir` → where qc-* commands load QC skills from (default bundled `.agent/skills/qc`; override to the QC team's own repo/submodule so framework upgrade won't overwrite them)
39
41
  - `paths.product_definitions_dir` → product definitions root
40
42
  - `paths.domain_knowledge_dir` → domain knowledge root
41
43
  - `paths.business_dictionary` → path to business-dictionary.md
@@ -48,6 +50,8 @@ If `paths` section is absent, use these defaults:
48
50
  - `specs_dir` = `specs/bdd`
49
51
  - `prd_dir` = `specs/prd`
50
52
  - `refinement_dir` = `.agent/review`
53
+ - `qc_dir` = `docs`
54
+ - `qc_skills_dir` = `.agent/skills/qc`
51
55
  - `product_definitions_dir` = `specs/product-definition`
52
56
  - `domain_knowledge_dir` = `specs/domain-knowledge`
53
57
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
@@ -92,6 +96,7 @@ If `services` section is present:
92
96
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
93
97
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
94
98
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
99
+ - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
95
100
 
96
101
  > **Why under `spec_source`:** PRD, design-spec, domain knowledge, the **API contract (tech-docs)**, and tester feedback are all **cross-team artifacts** — they must live in the **shared spec repo** so every umbrella (FE/App/BE) reads the same source via `/sync`. Tech-docs specifically: BE authors the tech-design (API contract), commits + pushes it into the spec submodule (2-layer commit), and FE/App pull it on their next `/sync` to wire the real API in `/generate-code --phase=integration`. In single-service mode (no `spec_source`), these default under the repo root — still shared, same repo.
97
102
 
@@ -132,19 +137,41 @@ If the file does not exist → skip silently.
132
137
 
133
138
  ---
134
139
 
135
- ## Step 3 — [CRITICAL] Load CLAUDE.md
140
+ ## Step 3 — [CRITICAL] Load CLAUDE.md (layered: root + service overlay)
136
141
 
137
142
  *This is the highest-priority context — it defines HOW to write code and documents for this project.*
138
143
 
139
- Read `CLAUDE.md`. Extract and store:
144
+ CLAUDE.md is loaded in **two layers** so umbrella-wide rules and service-specific
145
+ architecture/coding standards compose correctly. The agent always sits at the umbrella
146
+ root, but the implementation code lives in a service submodule with its OWN stack,
147
+ architecture, and conventions — so the service's CLAUDE.md must win for code generation.
148
+
149
+ **Layer 1 — [BASE] Root CLAUDE.md (umbrella-wide).**
150
+ Read `CLAUDE.md` at the repo root. Treat its contents as the **shared baseline** for the
151
+ whole umbrella — git conventions, data-protection posture, cross-cutting rules, and (in
152
+ single-service mode) the project's only architecture + coding standards.
153
+
154
+ **Layer 2 — [OVERLAY] Service CLAUDE.md (umbrella mode only).**
155
+ *Run only if `service_root` was set in Step 1.6 (i.e. a real service was routed to).*
156
+ Read `{service_root}/CLAUDE.md`. This file defines the architecture + coding standards of
157
+ the **actual stack being implemented** (e.g. `user-service` = java-spring, `web` = nextjs).
158
+ Overlay it on top of Layer 1: **on any conflict, the service value WINS** for architecture,
159
+ coding standards, and error handling. Layer-1 values that the service does not redefine
160
+ (e.g. git conventions, banned patterns shared org-wide) remain in effect.
161
+
162
+ From the **merged** result, extract and store:
140
163
 
141
164
  - **§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
165
+ - **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules — *service overlay wins*
166
+ - **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns — *service overlay wins*
167
+ - **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name — *service overlay wins*
168
+ - **§7 Git Conventions** → branch naming pattern, commit message format — *root baseline unless service redefines*
146
169
 
147
- If `CLAUDE.md` does not exist → note it as missing and continue with project-context.yaml data only.
170
+ **Resolution rules:**
171
+ - If both layers exist → merge as above; record `claude_md_source = root + {service_root}`.
172
+ - If only the service overlay exists (no root CLAUDE.md) → use the service file alone; `claude_md_source = {service_root}`.
173
+ - 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).
174
+ - If neither exists → note CLAUDE.md as missing and continue with project-context.yaml data only.
148
175
 
149
176
  ---
150
177
 
@@ -244,7 +271,8 @@ Output exactly this block:
244
271
  [CTX LOADED]
245
272
  Stack : {language} / {framework} / {database}
246
273
  Platform : {active_module} ({platform_type})
247
- Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
274
+ Layers : {layer order from merged CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
275
+ CLAUDE.md : {root + {service_root} | {service_root} only | root only | ⚠️ service overlay MISSING — using root | missing}
248
276
  Ticket : {ticket_prefix}-
249
277
  Dict : {loaded — N canonical terms, M banned terms | missing}
250
278
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
@@ -34,6 +34,13 @@ 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
46
  | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
@@ -36,6 +36,21 @@ paths:
36
36
  prd_template: "specs/templates/prd.template.md"
37
37
  refinement_dir: ".agent/review"
38
38
 
39
+ # QC's OWN analysis/design working docs (qc-analyze/plan/design-test outputs:
40
+ # REQUIREMENT_ANALYSIS.md, DOC_GAPS.md, TEST_PLAN.md, test-cases/*.Test.md).
41
+ # One subfolder per UC: {qc_dir}/{UC-ID}/. Default "docs" (the QC team's own
42
+ # convention), VISIBLE — not hidden under .agent/. NOTE: specs (PRD / .feature /
43
+ # design-spec) are NOT here — they come from the PO spec submodule (spec_source).
44
+ qc_dir: "docs"
45
+
46
+ # WHERE the qc-* commands LOAD their skills from (qa-analyst / qa-designer / qa-planner
47
+ # / qa-reviewer / qa-runner + DOC_GAPS.template.md). Default = the framework-bundled
48
+ # copy at .agent/skills/qc (works standalone). The QC team OWNS these skills in their
49
+ # canonical repo (ai-automation-qc-base) — point this at that repo/submodule (e.g.
50
+ # "qc-base/.claude/skills") so the skills evolve INDEPENDENTLY and are NOT overwritten
51
+ # by framework upgrade (--init / upgrade.sh rewrite only .agent/, never this path).
52
+ qc_skills_dir: ".agent/skills/qc"
53
+
39
54
  # Product Definitions
40
55
  product_definitions_dir: "specs/product-definition"
41
56
  product_definition_template: "specs/templates/product-definition.template.md"
@@ -61,11 +76,14 @@ paths:
61
76
  # Trace
62
77
  trace_dir: ".trace"
63
78
 
64
- # Tester feedback (written by /report-bug and /propose-scenario).
79
+ # Tester / QC feedback (written by /report-bug and /propose-scenario).
65
80
  # These live in the SHARED spec repo so PO/Dev see them on their next /sync.
66
81
  # In umbrella mode, context-loader auto-resolves them under {spec_source}/feedback/.
67
82
  bug_reports_dir: "feedback/bug-reports"
68
83
  bdd_proposals_dir: "feedback/bdd-proposals"
84
+ # PRD change requests (new requirement found in test, not covered by any AC) —
85
+ # written by /propose-scenario Case B so the PO can add/extend an AC then re-/generate-bdd.
86
+ prd_change_requests_dir: "feedback/prd-change-requests"
69
87
 
70
88
  tech_stack:
71
89
  language: "{{LANGUAGE}}" # e.g., Java 17 / TypeScript / C# / Go
@@ -106,6 +124,14 @@ domains:
106
124
  # module: "{{STACK_MODULE}}" # e.g., java-spring, nextjs, flutter
107
125
  # specs_dir: "{{SERVICE_SUBMODULE_DIR}}/specs/bdd"
108
126
  # tech_docs_dir: "{{SERVICE_SUBMODULE_DIR}}/specs/tech-docs"
127
+ #
128
+ # IMPORTANT — per-service CLAUDE.md:
129
+ # Each service submodule should have its OWN CLAUDE.md ({path}/CLAUDE.md) defining its
130
+ # architecture + coding standards for ITS stack. context-loader loads CLAUDE.md in two
131
+ # layers: root CLAUDE.md (umbrella-wide shared rules) + {service}/CLAUDE.md (overlay,
132
+ # wins on conflict for architecture/coding-standards). The agent sits at the umbrella
133
+ # root, so without a service CLAUDE.md, code generation falls back to umbrella defaults
134
+ # (likely the wrong stack). Generate one per service via /setup-ai-first inside each.
109
135
  # {{DOMAIN_2}}:
110
136
  # path: "{{SERVICE_2_DIR}}"
111
137
  # module: "{{STACK_MODULE}}"
package/ARCHITECTURE.md DELETED
@@ -1,258 +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 / DEV-CHECK DEBUG │
54
- │ /define-product /generate-prd /generate-code /fix-bug │
55
- │ /refine-prd /dev-gen-test /debug │
56
- │ /generate-bdd /dev-run-test /validate- │
57
- │ /generate-tech-docs /dev-smoke-test traces │
58
- │ /review-code /setup-ai-first │
59
- │ │
60
- │ Lưu ý: /dev-gen-test, /dev-run-test, /dev-smoke-test là dev │
61
- │ self-check / smoke (dev tự kiểm code của mình), KHÔNG phải bộ │
62
- │ test QC chính thức — QC là một flow riêng chạy sau. │
63
- └──────────────────────────────────────────────────────────────────────┘
64
-
65
- ┌──────────────────────────────────────────────────────────────────────┐
66
- │ LAYER 5 — OUTPUT (artifacts in consumer proj) │
67
- │ │
68
- │ Spec module (cross-team, via {spec_source}): │
69
- │ specs/product-definition/ specs/prd/ specs/bdd/ │
70
- │ specs/tech-docs/ (API contract) .living-docs/ (gitignored) │
71
- │ Service submodule (per-service): │
72
- │ src/ .trace/*.tsv (authoritative, committed) .agent/review/ │
73
- └──────────────────────────────────────────────────────────────────────┘
74
- ```
75
-
76
- ---
77
-
78
- ## Data Flow — Một command chạy như thế nào
79
-
80
- ```
81
- User types: /generate-bdd specs/prd/payment/PAY-01.md
82
-
83
-
84
- [L0] data-guard.js checks tool calls in real-time
85
- → nếu AI cố đọc .env / *.key → BLOCK + warn
86
-
87
-
88
- [L1] commands/generate-bdd.md được Claude đọc
89
- (assembled từ generate-bdd.tmpl + injected steps)
90
-
91
-
92
- [L2] gate.md → resolve file path từ $ARGUMENTS
93
- context-loader.md → đọc project-context.yaml, CLAUDE.md,
94
- rules/data-protection.md,
95
- modules/{stack}/stack-profile.yaml
96
-
97
-
98
- [L3] Claude biết: tech_stack, domains, architecture rules,
99
- sensitive files to avoid, stack-specific patterns
100
-
101
-
102
- [L4] generate-bdd logic:
103
- → đọc PRD → extract UC/BR/AC
104
- → apply BDD rules R1-R10
105
- → viết specs/bdd/{domain}/{UC-ID}.feature
106
-
107
-
108
- [L5] Output: specs/bdd/payment/PAY-01-UC1.feature
109
- ```
110
-
111
- ---
112
-
113
- ## Build System
114
-
115
- ```
116
- Source (committed to git) Build output (gitignored)
117
- ────────────────────────── ─────────────────────────
118
- commands/*.tmpl ──┐
119
- skills/**/SKILL.tmpl ──┤ node bin/build.js → commands/*.md
120
- steps/*.md (shared) ──┘ skills/**/SKILL.md
121
-
122
- Trigger:
123
- npm run build ← manual
124
- prepublishOnly hook ← auto before npm publish
125
- bin/index.js install ← auto when user runs npx
126
- ```
127
-
128
- ---
129
-
130
- ## Module Plug-in System
131
-
132
- ```
133
- Available modules (modules/):
134
- java-spring, angular, react, nextjs,
135
- dotnet, golang, php-laravel, context-engineering
136
-
137
- Usage:
138
- npx @anhth2/spec-driven-dev-plugin --module java-spring
139
- └─ copies modules/java-spring/ → consumer/.agent/modules/java-spring/
140
-
141
- At runtime, context-loader.md reads:
142
- .agent/modules/{tech_stack.module}/stack-profile.yaml
143
- .agent/modules/{tech_stack.module}/architecture-snippets/
144
- ```
145
-
146
- ---
147
-
148
- ## Hook System — Data Protection
149
-
150
- ```
151
- Consumer project setup:
152
- .claude/settings.json ← registers hook (provided as template)
153
- hooks/data-guard.js ← copied from this package on install
154
-
155
- Runtime:
156
- Every tool use (Read, Write, Edit, Bash)
157
-
158
-
159
- data-guard.js checks:
160
- .env* / *.key / *.pem / *secret* / *password* / *credential*
161
- application-prod.* / appsettings.Production.*
162
-
163
- safe → allow blocked → exit(2) + warn user
164
- ```
165
-
166
- ---
167
-
168
- ## Future — Sub-Agent Pattern (v2 roadmap)
169
-
170
- Khi một số command quá nặng cho single context window:
171
-
172
- ```
173
- Main session (orchestrator — lightweight, chỉ coordinate)
174
-
175
- ├─ spawn spec-agent ──→ /refine-prd analysis (own context window)
176
- │ └─ returns: findings.yaml
177
-
178
- ├─ spawn codegen-agent ──→ /generate-code UC1 (own context window)
179
- │ └─ returns: src/ changes
180
-
181
- └─ spawn test-agent ──→ /dev-gen-test UC1 (own context window)
182
- └─ returns: dev self-check test files (smoke, không phải QC)
183
-
184
- Benefits:
185
- - Main session không bị bloat bởi large file reads
186
- - Mỗi agent focus vào 1 task, ít hallucination hơn
187
- - Parallel execution cho multiple UCs
188
-
189
- Implementation path:
190
- 1. Tạo steps/spawn-agent.md — pattern + handoff payload format
191
- 2. Tạo commands/orchestrate-feature.tmpl — top-level orchestrator
192
- 3. Sub-agent commands nhận input qua $ARGUMENTS (JSON payload)
193
- ```
194
-
195
- ---
196
-
197
- ## Directory Map
198
-
199
- ```
200
- spec-driven-dev/
201
- ├── ARCHITECTURE.md ← Đọc đây trước ◀◀◀
202
- ├── bin/
203
- │ ├── build.js ← assembles *.tmpl → *.md
204
- │ └── index.js ← npm installer + hook installer
205
- ├── commands/
206
- │ └── *.tmpl ← slash commands (23 commands)
207
- ├── hooks/
208
- │ ├── data-guard.js ← PreToolUse sensitive file protection
209
- │ └── settings.json ← hook registration template
210
- ├── modules/
211
- │ └── {stack}/ ← 8 stacks: java-spring, angular, react,
212
- │ ├── module.yaml nextjs, dotnet, golang, php-laravel,
213
- │ ├── stack-profile.yaml context-engineering
214
- │ └── architecture-snippets/
215
- ├── rules/
216
- │ ├── data-protection.md ← what AI must NEVER read/write
217
- │ └── workflow.md ← general AI behavior rules
218
- ├── skills/
219
- │ └── {name}/SKILL.tmpl ← Claude plugin skills (8 skills)
220
- ├── steps/
221
- │ ├── gate.md ← shared: file resolve + checkpoint
222
- │ ├── context-loader.md ← shared: load all project context
223
- │ ├── spawn-agent.md ← shared: sub-agent orchestration
224
- │ ├── capture-lesson.md ← shared: record a guardrail (/learn etc.)
225
- │ └── report-footer.md ← shared: standard output format
226
- └── templates/
227
- ├── project-context.yaml ← consumer project config template
228
- ├── architecture.template.md
229
- └── platform-guide.template.md
230
- ```
231
-
232
- > 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)** is a **cross-team artifact**: khi `setup.spec_source` được set, tech-docs LUÔN route về `{spec_source}/specs/tech-docs/` (giống PRD / design-spec / domain-knowledge), KHÔNG per-service — để FE/App đọc contract qua spec submodule ở `/generate-code --phase=integration`. Chỉ khi không có `spec_source` thì tech-docs mới nằm per-service.
233
-
234
- > **Living Docs / trace data location**: `.trace/*.tsv` của mỗi service là **authoritative** và được commit trong chính SERVICE submodule. Canonical report của Living Docs (`trace-report.json` + bản TSV mirror đã namespaced) được sinh vào SPEC MODULE tại `{spec_source}/.living-docs/` (gitignored) bởi `/sync` hoặc `/validate-traces`. Ngoài ra một panel mirror cục bộ tại `./.trace` của workspace hiện tại cũng được ghi để VS Code panel resolve được data ngay cả khi mở bên trong một service submodule (không chỉ ở umbrella root). Lý do: spec module được mount vào mọi umbrella/service workspace, nên nó là nơi chung, luôn resolve được cho cross-team dashboard.
235
- >
236
- > Trace TSV schema có thêm 2 cột `dev_selftest` (pass/fail/not_run) và `dev_selftest_at`, được set bởi `/dev-run-test` và surface trong Living Docs report như tín hiệu **dev self-check** (không phải coverage QC chính thức).
237
-
238
- ---
239
-
240
- ## Maintenance Guide
241
-
242
- | Muốn thay đổi gì | Sửa file nào |
243
- |------------------|-------------|
244
- | Logic của 1 command cụ thể | `commands/{name}.tmpl` |
245
- | Logic của 1 skill cụ thể | `skills/{name}/SKILL.tmpl` |
246
- | Gate / checkpoint pattern | `steps/gate.md` |
247
- | Context loading | `steps/context-loader.md` |
248
- | Report format | `steps/report-footer.md` |
249
- | Sensitive file patterns | `hooks/data-guard.js` + `rules/data-protection.md` |
250
- | Stack-specific rules | `modules/{stack}/stack-profile.yaml` |
251
- | Project setup template | `templates/project-context.yaml` |
252
- | Build system | `bin/build.js` |
253
- | Installer | `bin/index.js` |
254
-
255
- Sau khi sửa bất kỳ `.tmpl` hoặc `steps/*.md`:
256
- ```bash
257
- npm run build # regenerate tất cả *.md
258
- ```