@anhth2/spec-driven-dev-plugin 0.11.0 → 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 (173) hide show
  1. package/commands/debug.md +47 -7
  2. package/commands/define-product.md +47 -7
  3. package/commands/dev-gen-test.md +65 -17
  4. package/commands/dev-run-test.md +66 -18
  5. package/commands/dev-run-test.tmpl +1 -1
  6. package/commands/dev-smoke-test.md +47 -7
  7. package/commands/fix-bug.md +83 -13
  8. package/commands/fix-bug.tmpl +36 -6
  9. package/commands/generate-bdd.md +74 -21
  10. package/commands/generate-bdd.tmpl +9 -4
  11. package/commands/generate-code.md +118 -35
  12. package/commands/generate-code.tmpl +53 -18
  13. package/commands/generate-design-spec.md +47 -7
  14. package/commands/generate-prd.md +47 -7
  15. package/commands/generate-spec-manifest.md +47 -7
  16. package/commands/generate-tech-docs.md +234 -20
  17. package/commands/generate-tech-docs.tmpl +187 -13
  18. package/commands/learn.md +47 -7
  19. package/commands/map-testids.md +564 -0
  20. package/commands/map-testids.tmpl +81 -0
  21. package/commands/propose-scenario.md +78 -18
  22. package/commands/propose-scenario.tmpl +31 -11
  23. package/commands/qc-analyze.md +67 -12
  24. package/commands/qc-analyze.tmpl +20 -5
  25. package/commands/qc-design-test.md +51 -10
  26. package/commands/qc-design-test.tmpl +4 -3
  27. package/commands/qc-plan.md +50 -10
  28. package/commands/qc-plan.tmpl +3 -3
  29. package/commands/qc-report.md +60 -8
  30. package/commands/qc-report.tmpl +13 -1
  31. package/commands/qc-review.md +49 -9
  32. package/commands/qc-review.tmpl +2 -2
  33. package/commands/qc-run-test.md +75 -20
  34. package/commands/qc-run-test.tmpl +10 -3
  35. package/commands/refine-prd.md +47 -7
  36. package/commands/report-bug.md +63 -9
  37. package/commands/report-bug.tmpl +16 -2
  38. package/commands/review-code.md +47 -7
  39. package/commands/review-context.md +47 -7
  40. package/commands/review-tech-docs.md +50 -9
  41. package/commands/review-tech-docs.tmpl +3 -2
  42. package/commands/setup-ai-first.md +37 -4
  43. package/commands/setup-ai-first.tmpl +2 -2
  44. package/commands/sync.md +47 -11
  45. package/commands/sync.tmpl +12 -9
  46. package/commands/update-framework.md +35 -2
  47. package/commands/validate-traces.md +98 -40
  48. package/commands/validate-traces.tmpl +51 -33
  49. package/core/FRAMEWORK_VERSION +1 -1
  50. package/core/commands/debug.md +47 -7
  51. package/core/commands/define-product.md +47 -7
  52. package/core/commands/dev-gen-test.md +65 -17
  53. package/core/commands/dev-run-test.md +66 -18
  54. package/core/commands/dev-smoke-test.md +47 -7
  55. package/core/commands/fix-bug.md +83 -13
  56. package/core/commands/generate-bdd.md +74 -21
  57. package/core/commands/generate-code.md +118 -35
  58. package/core/commands/generate-design-spec.md +47 -7
  59. package/core/commands/generate-prd.md +47 -7
  60. package/core/commands/generate-spec-manifest.md +47 -7
  61. package/core/commands/generate-tech-docs.md +234 -20
  62. package/core/commands/learn.md +47 -7
  63. package/core/commands/map-testids.md +564 -0
  64. package/core/commands/propose-scenario.md +78 -18
  65. package/core/commands/qc-analyze.md +67 -12
  66. package/core/commands/qc-design-test.md +51 -10
  67. package/core/commands/qc-plan.md +50 -10
  68. package/core/commands/qc-report.md +60 -8
  69. package/core/commands/qc-review.md +49 -9
  70. package/core/commands/qc-run-test.md +75 -20
  71. package/core/commands/refine-prd.md +47 -7
  72. package/core/commands/report-bug.md +63 -9
  73. package/core/commands/review-code.md +47 -7
  74. package/core/commands/review-context.md +47 -7
  75. package/core/commands/review-tech-docs.md +50 -9
  76. package/core/commands/setup-ai-first.md +37 -4
  77. package/core/commands/sync.md +47 -11
  78. package/core/commands/update-framework.md +35 -2
  79. package/core/commands/validate-traces.md +98 -40
  80. package/core/modules/qc-playwright/stack-profile.yaml +4 -3
  81. package/core/skills/code/SKILL.md +82 -9
  82. package/core/skills/debug/SKILL.md +117 -11
  83. package/core/skills/design-spec/SKILL.md +47 -7
  84. package/core/skills/discovery/SKILL.md +47 -7
  85. package/core/skills/prd/SKILL.md +70 -4
  86. package/core/skills/qc/qa-analyst/acceptance-criteria.md +5 -1
  87. package/core/skills/qc/qa-analyst/business-rules.md +6 -2
  88. package/core/skills/qc/qa-analyst/data-flow.md +6 -2
  89. package/core/skills/qc/qa-analyst/spec-breakdown.md +7 -3
  90. package/core/skills/qc/qa-designer/e2e/journey.md +1 -1
  91. package/core/skills/qc/qa-designer/exploratory/charter.md +2 -2
  92. package/core/skills/qc/qa-designer/exploratory/explore-to-functional.md +1 -1
  93. package/core/skills/qc/qa-designer/functional/api.md +1 -1
  94. package/core/skills/qc/qa-designer/functional/gui-feature.md +1 -1
  95. package/core/skills/qc/qa-designer/functional/gui-screen.md +1 -1
  96. package/core/skills/qc/qa-designer/integration/api.md +1 -1
  97. package/core/skills/qc/qa-designer/integration/db.md +1 -1
  98. package/core/skills/qc/qa-designer/integration/gui.md +1 -1
  99. package/core/skills/qc/qa-designer/integration/kafka.md +1 -1
  100. package/core/skills/qc/qa-designer/non-functional.md +1 -1
  101. package/core/skills/qc/qa-planner/test-plan.md +4 -4
  102. package/core/skills/qc/qa-runner/exploratory/session.md +2 -2
  103. package/core/skills/setup-ai-first/SKILL.md +35 -2
  104. package/core/skills/spec/SKILL.md +70 -4
  105. package/core/skills/test/SKILL.md +129 -16
  106. package/core/steps/context-loader.md +12 -5
  107. package/core/steps/report-footer.md +35 -2
  108. package/core/steps/trace-mirror.md +18 -10
  109. package/core/templates/project-context.yaml +27 -6
  110. package/docs/01-getting-started/core-concepts.md +7 -7
  111. package/docs/01-getting-started/installation.md +4 -2
  112. package/docs/01-getting-started/quickstart.md +1 -1
  113. package/docs/02-guides/README.md +1 -2
  114. package/docs/02-guides/developer/README.md +1 -1
  115. package/docs/02-guides/developer/bdd-and-trace.md +10 -8
  116. package/docs/02-guides/developer/commands.md +4 -4
  117. package/docs/02-guides/developer/scenarios.md +26 -14
  118. package/docs/02-guides/developer/workflow.md +81 -19
  119. package/docs/02-guides/product-owner/README.md +6 -4
  120. package/docs/02-guides/product-owner/commands.md +1 -1
  121. package/docs/02-guides/product-owner/scenarios.md +80 -1
  122. package/docs/02-guides/tester/README.md +13 -10
  123. package/docs/02-guides/tester/bug-reporting.md +2 -2
  124. package/docs/02-guides/tester/qc-automation.md +165 -0
  125. package/docs/02-guides/tester/reading-specs.md +4 -4
  126. package/docs/02-guides/tester/scenarios.md +5 -5
  127. package/docs/02-guides/tester/spec-manifest.md +17 -12
  128. package/docs/02-guides/tester/test-checklist.md +3 -3
  129. package/docs/02-guides/tester/workflow.md +12 -14
  130. package/docs/03-concepts/architecture.md +7 -4
  131. package/docs/03-concepts/pipeline.md +37 -12
  132. package/docs/03-concepts/traceability.md +19 -18
  133. package/docs/04-operations/README.md +1 -1
  134. package/docs/04-operations/bug-flow.md +46 -5
  135. package/docs/04-operations/sync-and-update.md +186 -24
  136. package/docs/05-reference/README.md +3 -0
  137. package/docs/05-reference/command-cheatsheet.md +147 -0
  138. package/docs/05-reference/commands.md +73 -70
  139. package/docs/05-reference/modules.md +4 -4
  140. package/docs/05-reference/trace-schema.md +23 -16
  141. package/docs/README.md +3 -5
  142. package/modules/qc-playwright/stack-profile.yaml +4 -3
  143. package/package.json +1 -1
  144. package/skills/code/SKILL.md +82 -9
  145. package/skills/debug/SKILL.md +117 -11
  146. package/skills/design-spec/SKILL.md +47 -7
  147. package/skills/discovery/SKILL.md +47 -7
  148. package/skills/prd/SKILL.md +70 -4
  149. package/skills/qc/qa-analyst/acceptance-criteria.md +5 -1
  150. package/skills/qc/qa-analyst/business-rules.md +6 -2
  151. package/skills/qc/qa-analyst/data-flow.md +6 -2
  152. package/skills/qc/qa-analyst/spec-breakdown.md +7 -3
  153. package/skills/qc/qa-designer/e2e/journey.md +1 -1
  154. package/skills/qc/qa-designer/exploratory/charter.md +2 -2
  155. package/skills/qc/qa-designer/exploratory/explore-to-functional.md +1 -1
  156. package/skills/qc/qa-designer/functional/api.md +1 -1
  157. package/skills/qc/qa-designer/functional/gui-feature.md +1 -1
  158. package/skills/qc/qa-designer/functional/gui-screen.md +1 -1
  159. package/skills/qc/qa-designer/integration/api.md +1 -1
  160. package/skills/qc/qa-designer/integration/db.md +1 -1
  161. package/skills/qc/qa-designer/integration/gui.md +1 -1
  162. package/skills/qc/qa-designer/integration/kafka.md +1 -1
  163. package/skills/qc/qa-designer/non-functional.md +1 -1
  164. package/skills/qc/qa-planner/test-plan.md +4 -4
  165. package/skills/qc/qa-runner/exploratory/session.md +2 -2
  166. package/skills/setup-ai-first/SKILL.md +35 -2
  167. package/skills/spec/SKILL.md +70 -4
  168. package/skills/test/SKILL.md +129 -16
  169. package/steps/context-loader.md +12 -5
  170. package/steps/report-footer.md +35 -2
  171. package/steps/trace-mirror.md +18 -10
  172. package/templates/project-context.yaml +27 -6
  173. package/docs/02-guides/qc-automation.md +0 -92
@@ -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`
@@ -73,7 +77,7 @@ If `services` section is present:
73
77
  - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
74
78
 
75
79
  **2. Route to service** — if active domain matches a key in `services`:
76
- - Override `paths.specs_dir` → `services.{domain}.specs_dir`
80
+ - Override `paths.specs_dir` → `services.{domain}.specs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, ALL BDD (web/app/**system**) is a shared cross-team artifact → leave `specs_dir` for step 4 to route to the spec repo; do NOT pin it per-service here.
77
81
  - 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
82
  - Store `active_service` = `services.{domain}.path`
79
83
  - Store `active_service_module` = `services.{domain}.module`
@@ -84,6 +88,7 @@ If `services` section is present:
84
88
  - Set `active_service = unresolved`
85
89
 
86
90
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
91
+ - Override `paths.specs_dir` → `{spec_source}/specs/bdd` — **always when `spec_source` is set.** All BDD (web/app/**system**) lives in the shared spec repo so every umbrella (FE/App/BE) reads the same scenarios; the FE tech-design gate + `/generate-code --phase=ui`/`--phase=integration` resolve the `system/` BDD here. *(Per-service `specs/bdd` only when there is no `spec_source`.)*
87
92
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
88
93
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
89
94
  - 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.)*
@@ -92,8 +97,10 @@ If `services` section is present:
92
97
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
93
98
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
94
99
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
100
+ - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
101
+ - Override `paths.trace_dir` → `{spec_source}/.trace` — **always when `spec_source` is set.** Trace TSVs are consolidated in the spec repo (single authoritative location, no per-service split) so the PM/PO has one place to manage status. Code-side commands (`/generate-code`, `/dev-run-test`, `/qc-run-test`) run from `service_root` but **write their trace row into `{spec_source}/.trace`** — like they already push `feedback/` there. *(Per-service `.trace` only when there is no `spec_source`.)*
95
102
 
96
- > **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.
103
+ > **Why under `spec_source`:** PRD, design-spec, domain knowledge, **all BDD (web/app/system)**, the **API contract (tech-docs)**, tester feedback, **and the `.trace/` coverage state** are all **cross-team artifacts** — they live in the **shared spec repo** so every umbrella (FE/App/BE) and the PM read one source via `/sync`. The service submodule holds only **code** (+ build/test tooling). `.trace/` and `feedback/` are the dev/QC **write areas** in the spec repo (the PRD/BDD/design-spec/tech-docs there stay read-only for dev/QC only PO edits those). In single-service mode (no `spec_source`), everything defaults under the repo root — still one repo.
97
104
 
98
105
  ---
99
106
 
@@ -113,12 +120,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
113
120
  |----------|--------|
114
121
  | `conventions.test_command` | service's `conventions.test_command` |
115
122
  | `conventions.build_command` | service's `conventions.build_command` |
116
- | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` default: `{active_service}/.trace` |
117
- | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
123
+ | `paths.trace_dir` | **If `spec_source` is set → keep the Step 4 spec-repo route (`{spec_source}/.trace`); ignore any service-level `trace_dir`.** Only when there is no `spec_source`: `{active_service}/{service paths.trace_dir}` (default `{active_service}/.trace`). |
124
+ | `paths.specs_dir` | **If `spec_source` is set → keep the Step 4 spec-repo route (`{spec_source}/specs/bdd`); ignore any service-level `specs_dir`** (BDD is cross-team, never per-service in this mode). Only when there is no `spec_source`: `{active_service}/{service paths.specs_dir}` if set, else the Step 1.5 override. |
118
125
 
119
126
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
120
127
  - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
121
- - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
128
+ - **Source/test files** are written relative to `service_root`; **trace TSVs** are written to `{paths.trace_dir}` (the spec repo when `spec_source` is set — a cross-repo write, committed/pushed to the spec submodule like `feedback/`).
122
129
 
123
130
  **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).
124
131
 
@@ -20,6 +20,36 @@ Output Artifacts:
20
20
 
21
21
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
22
22
 
23
+ ## Pipeline Position
24
+
25
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
26
+ so the user always sees where this command sits in the end-to-end flow:
27
+
28
+ ```
29
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
30
+ ```
31
+
32
+ Find the current command in this phase legend and mark **its** phase in the map above:
33
+
34
+ | Phase | Commands |
35
+ |-------|----------|
36
+ | Discovery | `/define-product` |
37
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
38
+ | Design Spec | `/generate-design-spec` |
39
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
40
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
41
+ | Code | `/generate-code` · `/review-code` |
42
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
43
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
44
+ | Trace Audit | `/validate-traces` |
45
+
46
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
47
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
48
+
49
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
50
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
51
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
52
+
23
53
  ## Next Command Suggestion
24
54
 
25
55
  Suggest the logical next command based on workflow phase:
@@ -61,7 +91,10 @@ Suggest the logical next command based on workflow phase:
61
91
  Format the footer as:
62
92
  ```
63
93
  ---
64
- Status : {badge}
94
+ Status : {badge}
65
95
  {Output Artifacts block}
66
- Next : {suggested command with example arguments}
96
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
97
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
98
+ Next : {suggested command with example arguments}
67
99
  ```
100
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
@@ -1,18 +1,26 @@
1
1
  # Refresh Living Docs panel mirror *(local, umbrella mode)*
2
2
 
3
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.*
4
+ the repo's own `.trace/` IS the panel location, so nothing to mirror.*
5
5
 
6
- After updating the authoritative service TSV(s) at `{paths.trace_dir}`:
6
+ After updating the authoritative TSV(s) at `{paths.trace_dir}`:
7
7
 
8
- 1. Resolve `panel_mirror = ./.trace` at the **current workspace root** (where this command runs).
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**.
9
13
  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}`.
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`).
12
21
 
13
22
  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.
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.
@@ -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
@@ -93,19 +111,22 @@ domains:
93
111
  # mode: umbrella # "umbrella" | "single" (default: single)
94
112
  # spec_source: "{{SPEC_SUBMODULE_PATH}}" # path to PO spec submodule, e.g. "free-trial-specs"
95
113
  #
96
- # When spec_source is set, context-loader auto-derives:
114
+ # When spec_source is set, context-loader auto-derives (ALL specs live in the spec repo;
115
+ # service submodules hold only code + .trace/):
116
+ # specs_dir → {spec_source}/specs/bdd # ALL BDD (web/app/system) — cross-team
97
117
  # prd_dir → {spec_source}/specs/prd
98
118
  # design_spec_dir → {spec_source}/specs/design-spec
99
- # tech_docs_dir → {spec_source}/specs/tech-docs # shared API contract (per-service tech_docs_dir below wins in multi-service)
119
+ # tech_docs_dir → {spec_source}/specs/tech-docs # BE API contract + FE tech-design
100
120
  # domain_knowledge_dir → {spec_source}/specs/domain-knowledge
101
121
  # (You can still override these manually in paths: section below.)
102
122
  #
103
123
  # services: # domain → service submodule routing
104
124
  # {{DOMAIN_1}}: # must match @trace.domain in PRD files
105
- # path: "{{SERVICE_SUBMODULE_DIR}}" # relative path to service submodule
125
+ # path: "{{SERVICE_SUBMODULE_DIR}}" # relative path to service submodule (code + .trace/)
106
126
  # module: "{{STACK_MODULE}}" # e.g., java-spring, nextjs, flutter
107
- # specs_dir: "{{SERVICE_SUBMODULE_DIR}}/specs/bdd"
108
- # tech_docs_dir: "{{SERVICE_SUBMODULE_DIR}}/specs/tech-docs"
127
+ # # NOTE: with spec_source set, BDD + tech-docs are cross-team and live in the spec repo —
128
+ # # do NOT pin per-service specs_dir / tech_docs_dir here (they would be ignored).
129
+ # # Per-service specs_dir / tech_docs_dir apply ONLY when there is no spec_source.
109
130
  #
110
131
  # IMPORTANT — per-service CLAUDE.md:
111
132
  # Each service submodule should have its OWN CLAUDE.md ({path}/CLAUDE.md) defining its
@@ -51,11 +51,11 @@ Mỗi artifact link tới artifact khác qua `@trace.*` tags:
51
51
  ```
52
52
  product-definition.md
53
53
  └─► PRD.md (Service, Module trong metadata)
54
- └─► {UC-ID}.feature (@trace.service, @trace.module, @trace.prd_version)
55
- └─► tech-design.md (@trace.bdd_version)
56
- └─► src/ code (@trace.implements, @trace.prd_version, @trace.bdd_version)
57
- └─► src/test/ (@trace.verifies, @trace.service)
58
- └─► .trace/{UC-ID}.tsv (drift tracking)
54
+ └─► specs/bdd/{domain}/{web|app|system}/{UC-ID}.feature (@trace.prd_version)
55
+ └─► specs/tech-docs/{domain}/{UC-ID}-tech-design*.md (@trace.bdd_version)
56
+ └─► src/ code — service submodule (@trace.implements)
57
+ └─► src/test/ (@trace.verifies)
58
+ ════► {spec_source}/.trace/{UC-ID}.tsv — authoritative ở SPEC repo (drift tracking)
59
59
  ```
60
60
 
61
61
  `/validate-traces {domain}` đọc các `.trace/{UC-ID}.tsv` và báo cáo:
@@ -92,8 +92,8 @@ my-project-umbrella/ ← mở Claude Code ở đây
92
92
  └── web-app/ ← submodule: FE app
93
93
  ```
94
94
 
95
- - **Spec module** (`{spec_source}/`): chứa PRD, Design Spec, tech-docs (API contract) — shared để mọi umbrella đọc cùng contract. Report canonical của Living Docs cũng sinh tại `{spec_source}/.living-docs/`.
96
- - **Routing:** context-loader đọc `@trace.domain` từ PRD → tra trong `services` config → route BDD/code vào đúng service submodule. PRD phải có `@trace.domain` khớp một key trong `services`.
95
+ - **Spec module** (`{spec_source}/`): chứa PRD, Design Spec, **ALL BDD (web/app/system)**, tech-docs (BE API contract + FE tech-design), domain-knowledge, feedback — shared để mọi umbrella đọc cùng nguồn. Report canonical của Living Docs cũng sinh tại `{spec_source}/.living-docs/`.
96
+ - **Routing:** context-loader đọc `@trace.domain` từ PRD → tra trong `services` config → route **code** vào đúng service submodule; **BDD + tech-docs + specs + `.trace/` + feedback** đều ở spec module (cross-team, một chỗ cho PM). PRD phải có `@trace.domain` khớp một key trong `services`.
97
97
 
98
98
  Setup umbrella đầy đủ, file ownership, two-layer commit, multi-platform → [Operations › Sync & Update §4 Umbrella mode](../04-operations/sync-and-update.md#4-umbrella-mode--git-submodule).
99
99
 
@@ -89,6 +89,8 @@ git diff .agent/ && git add .agent/ && git commit -m "chore: upgrade framework"
89
89
  ```
90
90
 
91
91
  > Chỉ upgrade framework command files. `project-context.yaml`, `CLAUDE.md`, domain-knowledge, và `.trace/` không bao giờ bị ghi đè. Để sync *content* của project (submodule code/specs) dùng `/sync`.
92
+ >
93
+ > ⚠️ **QC skills & upgrade:** `--init` / `upgrade.sh` ghi đè **toàn bộ** `.agent/` — **gồm cả** `.agent/skills/qc/`. Nếu QC chỉnh skills trực tiếp trong `.agent/skills/qc/`, các thay đổi đó **mất** khi upgrade. Để giữ an toàn, trỏ `paths.qc_skills_dir` ra một repo/submodule QC **ngoài** `.agent/` (vd `qc-base/.claude/skills`) — upgrade không bao giờ chạm tới đó. Chi tiết: [../02-guides/tester/qc-automation.md#skill-sourcing--upgrade-safety](../02-guides/tester/qc-automation.md#skill-sourcing--upgrade-safety).
92
94
 
93
95
  ## QC automation stack (tùy chọn)
94
96
 
@@ -102,7 +104,7 @@ pip install pytest-playwright
102
104
  python3 -m playwright install
103
105
  ```
104
106
 
105
- `qc-playwright` = Python + pytest-playwright + Page Object (output: Playwright Trace + pytest-html). Chi tiết pipeline: [../02-guides/qc-automation.md](../02-guides/qc-automation.md).
107
+ `qc-playwright` = Python + pytest-playwright + Page Object (output: Playwright Trace + pytest-html). Chi tiết pipeline: [../02-guides/tester/qc-automation.md](../02-guides/tester/qc-automation.md).
106
108
 
107
109
  ## VS Code extension (khuyến nghị)
108
110
 
@@ -130,7 +132,7 @@ Mở Review Board: sidebar panel (Activity Bar), hoặc right-click file `*-find
130
132
  Đọc `.trace/*.tsv` — dashboard traceability health toàn project.
131
133
 
132
134
  - Stat cards: PRDs, Use Cases, Scenarios, Code Cov%, Test Cov%, Drift, Gap.
133
- - Drill-down: PRD → UC → per-scenario table (Spec ver, Gen ver, Code, Tests, `dev_selftest`, `qc_status`, Status).
135
+ - Drill-down: PRD → UC → per-scenario table (Spec ver, Gen ver, Code, Tests, `dev_selftest`, `qc_status`, Waiting on, Status). *Waiting on* = `qc_owner` + `qc_blocked_by` (chờ dev → `BUG-{id}` / chờ PO → `GAP-{id}`).
134
136
  - Status badges: ✅ OK · ⚠️ DRIFT · 🔴 GAP · — UNTRACKED. Filter + search + live reload.
135
137
 
136
138
  Mở: `Ctrl+Shift+P` → **"Spec Driven Dev: Open Living Documentation"**. Mở được cả ở umbrella root lẫn trong một service submodule riêng lẻ. Nếu trống, chạy `/generate-bdd` cho ≥1 feature để tạo file `.trace/{UC-ID}.tsv` đầu tiên.
@@ -80,6 +80,6 @@ Mỗi review command ghi findings vào `.agent/review/*-findings.yaml`. Mở **R
80
80
  ## Bước tiếp theo
81
81
 
82
82
  - Hiểu khái niệm phía sau pipeline → [core-concepts.md](core-concepts.md).
83
- - QC suite chính thức (`/qc-analyze → /qc-plan → /qc-design-test → /qc-review → /qc-run-test → /qc-report`) → [../02-guides/qc-automation.md](../02-guides/qc-automation.md).
83
+ - QC suite chính thức (`/qc-analyze → /qc-plan → /qc-design-test → /qc-review → /qc-run-test → /qc-report`) → [../02-guides/tester/qc-automation.md](../02-guides/tester/qc-automation.md).
84
84
  - Role guides, scenarios thực tế, multi-repo/umbrella → [../02-guides](../02-guides) và [../03-concepts](../03-concepts).
85
85
  - Full command reference → [../05-reference](../05-reference).
@@ -10,8 +10,7 @@ Mỗi role trong framework spec-driven-dev có một guide riêng: vai trò, com
10
10
  |---|---|---|
11
11
  | [Product Owner / BA](product-owner/README.md) | PO, BA | Viết PRD platform-agnostic, generate Design Spec + BDD, handoff cho dev team |
12
12
  | [Developer (FE / BE / App)](developer/README.md) | Dev | Đọc PRD + BDD từ spec submodule, generate tech-docs + code, dev self-check, trace system |
13
- | [Tester / QA](tester/README.md) | QA, Tester | Spec-manifest, đọc spec chain, viết test cases, `/report-bug` + `/propose-scenario` |
14
- | [QC Automation](qc-automation.md) | QC | Pipeline `/qc-*` 6 bước, `qc_status` chính thức, stack module `qc-playwright` |
13
+ | [Tester / QA](tester/README.md) | QA / Tester / QC | Spec-manifest, đọc spec chain, viết test cases, `/report-bug` + `/propose-scenario`, và chương **[QC Automation](tester/qc-automation.md)** (pipeline `/qc-*` 6 bước, `qc_status`, stack `qc-playwright`) — **một role duy nhất** |
15
14
  | Designer | Designer, UX | Tham gia giai đoạn Design Spec — sign-off màn hình + component trước khi PO gen BDD. Chưa có guide riêng; xem [Product Owner › Design Spec](product-owner/scenarios.md#tình-huống-3--tạo-design-spec-và-bdd-sau-khi-prd-approved) để biết điểm giao. |
16
15
 
17
16
  ## Phân biệt nhanh hai luồng test
@@ -43,4 +43,4 @@ PO/BA Dev
43
43
 
44
44
  ---
45
45
 
46
- *Xem thêm:* [Product Owner Guide](../product-owner/README.md) · [Tester Guide](../tester/README.md) · [QC Automation Guide](../qc-automation.md) · [Concepts › Traceability](../../03-concepts/traceability.md) · [Reference › Commands](../../05-reference/commands.md)
46
+ *Xem thêm:* [Product Owner Guide](../product-owner/README.md) · [Tester Guide](../tester/README.md) · [chương QC Automation](../tester/qc-automation.md) · [Concepts › Traceability](../../03-concepts/traceability.md) · [Reference › Commands](../../05-reference/commands.md)
@@ -70,11 +70,13 @@ Framework dùng metadata `@trace.*` để liên kết PRD → BDD → Code. (Chi
70
70
  ### Ví dụ trace chain hoàn chỉnh
71
71
 
72
72
  ```
73
- specs/prd/auth/FT-001-login.md ← @trace.domain: auth, @trace.status: approved
73
+ specs/prd/auth/FT-001-login.md ← @trace.domain: auth, @trace.status: approved
74
74
 
75
- specs/bdd/auth/FT-001-login.feature ← @trace.prd: FT-001, @trace.module: AuthService
75
+ specs/bdd/auth/system/FT-001-UC1-login.feature ← @trace.prd: FT-001 · web/app/system riêng (system tổng hợp từ web+app)
76
76
 
77
- src/auth/auth.service.ts ← // @trace.bdd: FT-001-UC1-SC1
77
+ src/auth/auth.service.ts ← // @trace.bdd: FT-001-UC1-SC1 (service submodule)
78
+
79
+ {spec_source}/.trace/FT-001.tsv ← coverage/drift — authoritative ở SPEC repo
78
80
  ```
79
81
 
80
82
  ### Khi nào chạy /validate-traces?
@@ -93,7 +95,7 @@ src/auth/auth.service.ts ← // @trace.bdd: FT-001-UC1-SC1
93
95
  **Lưu ý khi dùng umbrella (submodule):**
94
96
  ```
95
97
  Vấn đề: Living Docs panel mở ở umbrella root (hoặc một service submodule đơn lẻ) → nếu không có mirror local → TRỐNG.
96
- TSV authoritative nằm committed trong từng service submodule: user-service/.trace/, order-service/.trace/
98
+ TSV authoritative nằm committed MỘT chỗ spec repo: {spec_source}/.trace/
97
99
 
98
100
  Giải pháp: /validate-traces (hoặc /sync) regenerate canonical trace-report.json + TSV mirror
99
101
  trong SPEC MODULE tại {spec_source}/.living-docs/ (gitignored), đồng thời ghi
@@ -102,13 +104,13 @@ Giải pháp: /validate-traces (hoặc /sync) regenerate canonical trace-report.
102
104
 
103
105
  Lệnh chạy sau mỗi session:
104
106
  /validate-traces
105
- → Reads .trace/*.tsv authoritative (committed) trong từng service: user-service/.trace/, order-service/.trace/, ...
106
- → Writes canonical trace-report.json + TSV mirror → {spec_source}/.living-docs/ (gitignored, regenerated bởi /sync hoặc /validate-traces)
107
- → Writes panel mirror → ./.trace của workspace hiện tại (non-empty khi mở single service)
107
+ → Reads .trace/*.tsv authoritative (committed) MỘT chỗ: {spec_source}/.trace/ (mỗi row mang @trace.service)
108
+ → Writes trace-report.json → {spec_source}/.living-docs/ (gitignored, regenerated bởi /sync hoặc /validate-traces)
109
+ → Writes panel mirror → ./.trace của workspace hiện tại (non-empty khi mở repo lẻ)
108
110
  → Living Docs panel cập nhật ngay
109
111
  ```
110
112
 
111
- > **Authoritative vs mirror:** per-service `.trace/*.tsv` vẫn được **commit** trong từng service (nguồn sự thật). `{spec_source}/.living-docs/` và `./.trace` chỉ là mirror gitignored, regenerated bởi `/sync` hoặc `/validate-traces`.
113
+ > **Authoritative vs mirror:** `.trace/*.tsv` được **commit** spec repo `{spec_source}/.trace/` (nguồn sự thật, một chỗ). `{spec_source}/.living-docs/` và `./.trace` chỉ là mirror gitignored, regenerated bởi `/sync` hoặc `/validate-traces`.
112
114
 
113
115
  Thêm `.living-docs/` (spec module) và umbrella/workspace `.trace/` mirror vào `.gitignore`:
114
116
  ```
@@ -7,9 +7,9 @@
7
7
  | `/sync` `[spec-branch]` | **One-command setup hoặc update** — git pull + submodule sync + Living Docs refresh. Truyền branch để override branch spec submodule (vd `/sync develop`) | **Mỗi sáng trước khi bắt đầu work** |
8
8
  | `/update-framework` | Nâng cấp **bản thân framework** (`.agent/commands/`, steps/, modules/) từ npm | Khi có version framework mới — không đụng project-context/CLAUDE.md |
9
9
  | `/review-context {prd-file}` | Đọc + xác nhận PRD + BDD đủ rõ trước khi code — fan-out review dimension thành sub-agent song song + completeness-critic loop, findings file đầy đủ ngay trong 1 lần chạy | **Bước đầu tiên** khi nhận PRD mới |
10
- | `/generate-tech-docs {prd-file}` | Sinh Tech Docs (API, DB schema, sequence diagram) | Sau khi đọc BDD từ spec submodule |
10
+ | `/generate-tech-docs {feature-file}` | **Platform-aware.** BE (`system`): API contract (endpoints, DB, caching). FE/App (`web`/`app`): client design (components, state, API-integration map theo BE contract, routing) — **GATED**: cần System BDD + BE contract approved trước, nếu thiếu sẽ HALT | BE: sau khi đọc System BDD. FE: sau `--phase=ui`, khi BE contract đã approved |
11
11
  | `/generate-code {bdd-file}` | Sinh code — BE hoặc FE khi API đã sẵn sàng | Sau khi tech docs `approved` |
12
- | `/generate-code {bdd-file} --phase=ui` | FE: gen UI + mock adapter (BE chưa ready) | Ngay sau khi đọc BDD |
12
+ | `/generate-code {bdd-file} --phase=ui` | FE: gen UI + mock adapter. Mock **shape** từ BE contract nếu có (chuẩn) → else infer từ System BDD + warn (`mock_source=contract\|system-bdd`); fixture values luôn từ System BDD | Ngay sau khi đọc BDD (BE chưa cần deploy API) |
13
13
  | `/generate-code {bdd-file} --phase=integration` | FE: wire API thật thay mock | Sau khi sign-off gate `approved` |
14
14
  | `/dev-gen-test {bdd-file}` | **Dev self-check** — sinh test cases từ BDD để dev tự verify code mình vừa gen (KHÔNG phải bộ test chính thức của QC/dev-team) | Song song hoặc sau generate-code |
15
15
  | `/review-code {file}` | Review code theo 4 lens (Security/Perf/Arch/Test) | Trước khi tạo PR |
@@ -21,7 +21,7 @@
21
21
  | `/validate-traces` | Kiểm tra toàn bộ trace chain còn hợp lệ | Sau refactor hoặc khi PRD update |
22
22
  | `/learn {text}` | Ghi lại lỗi AI hay lặp thành guardrail | Khi AI lặp lại lỗi mà bạn không muốn nó tái diễn |
23
23
 
24
- > **Dev self-check vs QC chính thức:** `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` (ghi `dev_selftest`) chỉ là **smoke self-check của riêng dev**. Bộ QC chính thức giờ là native pipeline `/qc-analyze → /qc-plan → /qc-design-test → /qc-review → /qc-run-test → /qc-report` — **do QC chạy, không phải việc của dev** — và ghi `qc_status` riêng. Chi tiết: [QC Automation Guide](../qc-automation.md).
24
+ > **Dev self-check vs QC chính thức:** `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` (ghi `dev_selftest`) chỉ là **smoke self-check của riêng dev**. Bộ QC chính thức giờ là native pipeline `/qc-analyze → /qc-plan → /qc-design-test → /qc-review → /qc-run-test → /qc-report` — **do QC chạy, không phải việc của dev** — và ghi `qc_status` riêng. Chi tiết: [chương QC Automation](../tester/qc-automation.md).
25
25
 
26
26
  > Danh mục đầy đủ mọi command: [Reference › Commands](../../05-reference/commands.md).
27
27
 
@@ -56,7 +56,7 @@ Dev hành động theo phân loại:
56
56
  - **Scenario proposal map vào AC sẵn có** → thêm scenario vào `.feature` (hoặc `/generate-bdd` lại), rồi `/generate-code` + `/dev-gen-test`
57
57
  - **Proposal là yêu cầu mới (PRD change request)** → chuyển PO sửa PRD trước
58
58
 
59
- > Bug reports có thể đến từ hai nguồn: Tester dùng `/report-bug` trực tiếp, **hoặc** từ kết quả QC automation (`qc_status: fail` trong `.trace/*.tsv` → tester chạy `/report-bug` → `/sync` → dev thấy tại đây). Cả hai đều dùng cùng luồng `/fix-bug`.
59
+ > Bug reports có thể đến từ hai nguồn: Tester dùng `/report-bug` trực tiếp, **hoặc** từ kết quả QC automation (`qc_status: fail` trong `.trace/*.tsv` → QC (hoặc tester) chạy `/report-bug` → `/sync` → dev thấy tại đây). Cả hai đều dùng cùng luồng `/fix-bug`.
60
60
 
61
61
  > Tester chỉ *đề xuất* trong `feedback/` — dev/PO mới đưa vào BDD chính thức. Giữ đúng ownership.
62
62
 
@@ -67,6 +67,13 @@ Feature: User Authentication — System Contract
67
67
  ```
68
68
  BE dev dùng System BDD để: thiết kế API endpoint + response schema (`/generate-tech-docs`) · generate code skeleton (`/generate-code`) · viết integration tests (`/dev-gen-test`).
69
69
 
70
+ > **Đọc annotation `@system.resolution:` ở header (nếu có).** Khi web & app kỳ vọng response khác nhau, PO đã chốt cách giải quyết lúc gen System BDD — build contract đúng kiểu đó, **đừng tự đổi**:
71
+ > - `union` → trả tất cả field cho mọi client (`{ token, redirect_url, user_profile }`).
72
+ > - `platform-hint` → đọc header `X-Platform: web|app`, tailor response (System BDD dùng `Scenario Outline` + Examples).
73
+ > - `separate-endpoints` → mỗi platform một endpoint (`/auth/login/web` · `/auth/login/app`).
74
+ >
75
+ > Thấy resolution bất hợp lý, hoặc cần field chưa có trong contract → phản hồi PO (contract decision), đừng sửa System BDD trực tiếp. Bối cảnh: [PO › Tình huống 12](../product-owner/scenarios.md#tình-huống-12--system-bdd-synthesis-outside-in--xử-lý-cross-platform-conflict).
76
+
70
77
  ## Tình huống 3: Đọc Web/App BDD (FE/App dev)
71
78
 
72
79
  **Bối cảnh:** FE dev nhận thông báo BDD web đã sẵn sàng tại `specs/bdd/auth/web/`.
@@ -89,7 +96,7 @@ Scenario: Account locked — countdown shown
89
96
  ```
90
97
  FE dev dùng Web BDD để:
91
98
  1. Thiết kế component spec + API integration plan (`/generate-tech-docs`)
92
- 2. Gen UI + mock adapter từ System BDD contract (`/generate-code --phase=ui`) → Mock adapter trả về fixture data đúng với BDD `Then` clauses → Tester test toàn bộ FE flow ngay, không cần chờ BE
99
+ 2. Gen UI + mock adapter (`/generate-code --phase=ui`) — mock **shape** từ BE contract nếu có, else System BDD + warn → Mock adapter trả về fixture data đúng với BDD `Then` clauses → Tester test toàn bộ FE flow ngay, không cần chờ BE
93
100
  3. [Trong khi đó — tham gia review API contract, sign-off T7 gate]
94
101
  4. Khi sign-off done → wire real API (`/generate-code --phase=integration`)
95
102
  5. Viết E2E tests với Playwright/Cypress (`/dev-gen-test`)
@@ -179,7 +186,7 @@ Severity : Major
179
186
 
180
187
  Spec context:
181
188
  PRD : specs/prd/auth/FT-001-login.md (v1.0)
182
- BDD : free-trial-be/specs/bdd/auth/FT-001-login.feature
189
+ BDD : free-trial-specs/specs/bdd/auth/system/FT-001-login.feature
183
190
  → Scenario: "Lock account after 5 failed attempts"
184
191
  Tech Doc : free-trial-specs/specs/tech-docs/auth/FT-001-auth-api.md
185
192
 
@@ -206,7 +213,7 @@ Chạy:
206
213
  ```
207
214
  /fix-bug "BUG-20260605-003: FT-001-UC2-BR3 — account not locked after 5 failures
208
215
  PRD: specs/prd/auth/FT-001-login.md
209
- BDD: free-trial-be/specs/bdd/auth/FT-001-login.feature"
216
+ BDD: free-trial-specs/specs/bdd/auth/system/FT-001-login.feature"
210
217
  ```
211
218
  Agent sẽ: đọc BDD scenario được chỉ định · tìm code implement scenario đó (theo `@trace.bdd`) · so sánh logic thực tế vs spec · propose fix có giải thích.
212
219
 
@@ -337,7 +344,7 @@ code . ← hoặc claude .
337
344
 
338
345
  # 4. Framework tự detect umbrella mode từ project-context.yaml
339
346
  # Khi chạy /review-context với PRD có @trace.domain: be
340
- # → tự động route tới mass-product-be/specs/bdd/
347
+ # → CODE route tới mass-product-be/ · BDD đọc từ spec repo mass-product-spec/specs/bdd/ (spec_source set)
341
348
  ```
342
349
 
343
350
  **Update hằng ngày — cũng chỉ 1 lệnh:**
@@ -356,13 +363,14 @@ services:
356
363
  be:
357
364
  path: "mass-product-be"
358
365
  module: "NestJS"
359
- specs_dir: "mass-product-be/specs/bdd"
366
+ # specs_dir KHÔNG khai khi spec_source set — BDD đọc từ spec repo, không per-service
360
367
  web:
361
368
  path: "mass-product-web"
362
369
  module: "NextJS"
363
- specs_dir: "mass-product-web/specs/bdd"
364
370
  ```
365
371
 
372
+ > **BDD (specs_dir):** không khai trong `services` khi có `spec_source`. Tất cả BDD (web/app/system) nằm ở `{spec_source}/specs/bdd` (vd `mass-product-spec/specs/bdd`) — context-loader tự route `specs_dir` về đó; mọi `specs_dir` per-service đều bị **bỏ qua**. Per-service `specs_dir` **chỉ** dùng khi KHÔNG có `spec_source`.
373
+ >
366
374
  > **Tech-docs (API contract):** không khai trong `services`. Khi `setup.spec_source` được set, BE tech-design (API contract) **LUÔN** nằm tại `{spec_source}/specs/tech-docs` (vd `mass-product-spec/specs/tech-docs`) — context-loader tự route `tech_docs_dir` về đó. BE generate xong → commit + push lên spec repo; FE/App đọc qua `/sync` + `/generate-code --phase=integration`. Per-service tech-docs **chỉ** khi KHÔNG có `spec_source`.
367
375
  >
368
376
  > **Bắt buộc:** Mỗi service submodule cũng cần file `.agent/project-context.yaml` riêng. Framework đọc file này (context-loader Step 1.6) để lấy đúng `test_command` và `build_command` khi `/dev-run-test` hoặc `/dev-gen-test` chạy từ umbrella root.
@@ -402,21 +410,25 @@ Khi `/dev-run-test` chạy từ umbrella root cho một UC thuộc domain `be`:
402
410
  2. Step 1.6 load `mass-product-be/.agent/project-context.yaml` → `test_command = "npm test"`
403
411
  3. Lệnh test chạy: `cd mass-product-be && npm test`
404
412
 
405
- **Commit 2 lớp (bắt buộc):**
413
+ **BDD + trace ở spec repo (1 tầng); code ở service (2 tầng):**
406
414
  ```bash
407
- # Lớp 1: Commit trong service submodule
408
- cd mass-product-be
409
- git add specs/bdd/auth/FT-001-login.feature
415
+ # BDD (.feature) + trace (.tsv) → SPEC repo (1 tầng khi spec_source set)
416
+ cd mass-product-specs
417
+ git add specs/bdd/auth/FT-001-login.feature .trace/FT-001.tsv
410
418
  git commit -m "feat(bdd): add login BDD scenarios — FT-001"
411
- git push origin feature/ft-001-login
419
+ git push
412
420
 
413
- # Lớp 2: Update pointer tại umbrella
421
+ # Code service submodule (commit 2 lớp)
422
+ cd ../mass-product-be
423
+ git add src/
424
+ git commit -m "feat(FT-001): login implementation"
425
+ git push origin feature/ft-001-login
414
426
  cd .. ← về umbrella root
415
427
  git add mass-product-be
416
- git commit -m "chore: update mass-product-be submodule pointer — FT-001 BDD"
428
+ git commit -m "chore: update mass-product-be submodule pointer — FT-001"
417
429
  git push
418
430
  ```
419
- **Không commit lớp 2 → umbrella repo vẫn trỏ về commit cũ của service.**
431
+ **Không commit lớp 2 (pointer) → umbrella repo vẫn trỏ về commit cũ của service.**
420
432
 
421
433
  ## Tình huống 8: Validate traces trước khi tạo PR lớn
422
434