@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
@@ -1,7 +1,8 @@
1
- # /propose-scenario — Propose a New BDD Scenario (Tester-Facing)
1
+ # /propose-scenario — Propose a New BDD Scenario (Tester & QC-Facing)
2
2
 
3
- For **testers** who discover an edge case not covered by existing BDD. Drafts a Gherkin scenario
4
- into a **proposals area** for PO/Dev to review and promote.
3
+ For **testers and QC** who discover an edge case not covered by existing BDD (e.g. a `DOC_GAPS`
4
+ missing-coverage gap from `/qc-analyze`). Drafts a Gherkin scenario into a **proposals area** for
5
+ PO/Dev to review and promote.
5
6
 
6
7
  **Does NOT edit the canonical `.feature` file.** BDD is owned by PO/Dev — this command only writes
7
8
  a proposal. Promotion into the real BDD is a PO/Dev action.
@@ -134,6 +135,8 @@ Read `.agent/project-context.yaml`. Extract and store:
134
135
  - `paths.specs_dir` → BDD specs root
135
136
  - `paths.prd_dir` → PRD documents root
136
137
  - `paths.refinement_dir` → findings/review output dir
138
+ - `paths.qc_dir` → QC automation artifacts root (visible top-level, one subfolder per UC: `{qc_dir}/{UC-ID}/`)
139
+ - `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)
137
140
  - `paths.product_definitions_dir` → product definitions root
138
141
  - `paths.domain_knowledge_dir` → domain knowledge root
139
142
  - `paths.business_dictionary` → path to business-dictionary.md
@@ -146,6 +149,8 @@ If `paths` section is absent, use these defaults:
146
149
  - `specs_dir` = `specs/bdd`
147
150
  - `prd_dir` = `specs/prd`
148
151
  - `refinement_dir` = `.agent/review`
152
+ - `qc_dir` = `docs`
153
+ - `qc_skills_dir` = `.agent/skills/qc`
149
154
  - `product_definitions_dir` = `specs/product-definition`
150
155
  - `domain_knowledge_dir` = `specs/domain-knowledge`
151
156
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
@@ -171,7 +176,7 @@ If `services` section is present:
171
176
  - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
172
177
 
173
178
  **2. Route to service** — if active domain matches a key in `services`:
174
- - Override `paths.specs_dir` → `services.{domain}.specs_dir`
179
+ - 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.
175
180
  - 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.
176
181
  - Store `active_service` = `services.{domain}.path`
177
182
  - Store `active_service_module` = `services.{domain}.module`
@@ -182,6 +187,7 @@ If `services` section is present:
182
187
  - Set `active_service = unresolved`
183
188
 
184
189
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
190
+ - 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`.)*
185
191
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
186
192
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
187
193
  - 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.)*
@@ -190,8 +196,10 @@ If `services` section is present:
190
196
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
191
197
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
192
198
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
199
+ - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
200
+ - 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`.)*
193
201
 
194
- > **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.
202
+ > **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.
195
203
 
196
204
  ---
197
205
 
@@ -211,12 +219,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
211
219
  |----------|--------|
212
220
  | `conventions.test_command` | service's `conventions.test_command` |
213
221
  | `conventions.build_command` | service's `conventions.build_command` |
214
- | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` default: `{active_service}/.trace` |
215
- | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
222
+ | `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`). |
223
+ | `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. |
216
224
 
217
225
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
218
226
  - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
219
- - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
227
+ - **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/`).
220
228
 
221
229
  **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).
222
230
 
@@ -410,15 +418,28 @@ A BDD scenario must trace to a PRD acceptance criterion. Determine which case ap
410
418
  → This is a coverage gap. Proceed to draft the scenario (Step 3), mapped to that AC.
411
419
 
412
420
  **Case B — behavior is NOT in any AC** (genuinely new requirement):
413
- STOP. A scenario here would have nothing to trace to. Do **not** draft it as a BDD proposal.
414
- Instead output a **PRD change request** for the PO:
421
+ Do **not** draft a BDD proposal (a scenario would have nothing to trace to). Instead **write a
422
+ PRD change request file** so the PO actually sees it on `/sync` (do not just print it):
423
+
424
+ Write to `{paths.prd_change_requests_dir}/{UC-ID}-{slug}.md` (resolved to
425
+ `{spec_source}/feedback/prd-change-requests/` in umbrella mode; create dir if needed):
415
426
  ```
416
- ⚠️ Not covered by any PRD AC this is a new requirement, not a coverage gap.
417
- Route to PO: add/extend an AC in {prd_path}, then re-run /generate-bdd.
418
- Requested behavior: {description}
419
- Suggested AC: "{draft AC text}"
427
+ # PRD Change Request{UC-ID}: {short title}
428
+
429
+ > ⚠️ New requirement found in test — NOT covered by any PRD AC (not a coverage gap).
430
+ | Field | Value |
431
+ |---|---|
432
+ | UC / Ticket | {UC-ID} |
433
+ | PRD | {prd_path} (v{prd_version}) |
434
+ | Source | {BUG-ID if any | tester/QC observation} |
435
+ | Requested by | tester/QC |
436
+ | Status | Open |
437
+
438
+ **Requested behavior:** {description}
439
+ **Suggested AC (draft for PO):** "{draft AC text}"
440
+ **Route to PO:** add/extend an AC in {prd_path} → `/refine-prd` → re-run `/generate-bdd` → dev `/generate-code`.
420
441
  ```
421
- Then end (no proposal file written for BDD).
442
+ Then go to Step 5 (handoff applies to this file too). Skip Step 3–4 (no BDD scenario for Case B).
422
443
 
423
444
  If unsure which case → show the AC list and ask the tester which AC this maps to, or confirm it's new.
424
445
 
@@ -447,7 +468,13 @@ git push # → PO/Dev see it on their next /sync
447
468
  ```
448
469
 
449
470
  - No push rights to the spec repo → open a PR / MR instead. Print this fallback.
450
- - For a **PRD change request** (Case B), the same handoff applies — commit the request doc so the PO sees it.
471
+ - For a **PRD change request** (Case B), commit the request file instead:
472
+ ```bash
473
+ cd {spec_source}
474
+ git add feedback/prd-change-requests/{UC-ID}-{slug}.md
475
+ git commit -m "qa(prd-change): {UC-ID} — {title}"
476
+ git push
477
+ ```
451
478
 
452
479
  > PO/Dev are notified through their normal routine: `/sync` lists newly-pulled proposals.
453
480
 
@@ -477,6 +504,36 @@ Output Artifacts:
477
504
 
478
505
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
479
506
 
507
+ ## Pipeline Position
508
+
509
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
510
+ so the user always sees where this command sits in the end-to-end flow:
511
+
512
+ ```
513
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
514
+ ```
515
+
516
+ Find the current command in this phase legend and mark **its** phase in the map above:
517
+
518
+ | Phase | Commands |
519
+ |-------|----------|
520
+ | Discovery | `/define-product` |
521
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
522
+ | Design Spec | `/generate-design-spec` |
523
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
524
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
525
+ | Code | `/generate-code` · `/review-code` |
526
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
527
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
528
+ | Trace Audit | `/validate-traces` |
529
+
530
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
531
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
532
+
533
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
534
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
535
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
536
+
480
537
  ## Next Command Suggestion
481
538
 
482
539
  Suggest the logical next command based on workflow phase:
@@ -518,10 +575,13 @@ Suggest the logical next command based on workflow phase:
518
575
  Format the footer as:
519
576
  ```
520
577
  ---
521
- Status : {badge}
578
+ Status : {badge}
522
579
  {Output Artifacts block}
523
- Next : {suggested command with example arguments}
580
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
581
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
582
+ Next : {suggested command with example arguments}
524
583
  ```
584
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
525
585
 
526
586
 
527
587
  ```
@@ -133,6 +133,8 @@ Read `.agent/project-context.yaml`. Extract and store:
133
133
  - `paths.specs_dir` → BDD specs root
134
134
  - `paths.prd_dir` → PRD documents root
135
135
  - `paths.refinement_dir` → findings/review output dir
136
+ - `paths.qc_dir` → QC automation artifacts root (visible top-level, one subfolder per UC: `{qc_dir}/{UC-ID}/`)
137
+ - `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)
136
138
  - `paths.product_definitions_dir` → product definitions root
137
139
  - `paths.domain_knowledge_dir` → domain knowledge root
138
140
  - `paths.business_dictionary` → path to business-dictionary.md
@@ -145,6 +147,8 @@ If `paths` section is absent, use these defaults:
145
147
  - `specs_dir` = `specs/bdd`
146
148
  - `prd_dir` = `specs/prd`
147
149
  - `refinement_dir` = `.agent/review`
150
+ - `qc_dir` = `docs`
151
+ - `qc_skills_dir` = `.agent/skills/qc`
148
152
  - `product_definitions_dir` = `specs/product-definition`
149
153
  - `domain_knowledge_dir` = `specs/domain-knowledge`
150
154
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
@@ -170,7 +174,7 @@ If `services` section is present:
170
174
  - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
171
175
 
172
176
  **2. Route to service** — if active domain matches a key in `services`:
173
- - Override `paths.specs_dir` → `services.{domain}.specs_dir`
177
+ - 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.
174
178
  - 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.
175
179
  - Store `active_service` = `services.{domain}.path`
176
180
  - Store `active_service_module` = `services.{domain}.module`
@@ -181,6 +185,7 @@ If `services` section is present:
181
185
  - Set `active_service = unresolved`
182
186
 
183
187
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
188
+ - 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`.)*
184
189
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
185
190
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
186
191
  - 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.)*
@@ -189,8 +194,10 @@ If `services` section is present:
189
194
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
190
195
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
191
196
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
197
+ - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
198
+ - 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`.)*
192
199
 
193
- > **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.
200
+ > **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.
194
201
 
195
202
  ---
196
203
 
@@ -210,12 +217,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
210
217
  |----------|--------|
211
218
  | `conventions.test_command` | service's `conventions.test_command` |
212
219
  | `conventions.build_command` | service's `conventions.build_command` |
213
- | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` default: `{active_service}/.trace` |
214
- | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
220
+ | `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`). |
221
+ | `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. |
215
222
 
216
223
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
217
224
  - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
218
- - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
225
+ - **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/`).
219
226
 
220
227
  **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).
221
228
 
@@ -405,7 +412,7 @@ Boundary vs `/qc-plan`: you answer *"what is the requirement?"*; qc-plan answers
405
412
  the risk, what to ask dev?"*. When something is ambiguous/missing, record it as a gap and
406
413
  hand off to qc-plan — never invent an answer.
407
414
 
408
- ## Skills (`skills/qc/qa-analyst/`)
415
+ ## Skills (`{paths.qc_skills_dir}/qa-analyst/`)
409
416
 
410
417
  Load only the file for the step you are doing (each is self-contained):
411
418
  - `spec-breakdown.md` — break a spec/PRD/user story into structure.
@@ -424,15 +431,29 @@ tests with `@trace.verifies` and write `qc_status` per scenario.
424
431
 
425
432
  ## DOC_GAPS (mandatory)
426
433
 
427
- Always produce a gaps file following `skills/qc/qa-analyst/DOC_GAPS.template.md`:
434
+ Always produce a gaps file following `{paths.qc_skills_dir}/qa-analyst/DOC_GAPS.template.md`:
428
435
  - Each gap `GAP-xx`, classified MISSING / AMBIGUOUS / CONTRADICTORY / ASSUMPTION / OPEN QUESTION, with severity (🔴 Blocker → 🟢 Low) and the affected function/BR/AC.
429
436
  - Never fabricate answers; mark assumptions as `ASSUMPTION` for PO/dev to confirm.
430
437
  - Any `🔴 Blocker` still `Open` ⇒ the UC is not ready for qc-design-test — hand off to qc-plan.
438
+ - **Push genuine SPEC defects to the PO (not just keep them local).** A blocker that is a real
439
+ flaw in the official spec — `AMBIGUOUS` / `CONTRADICTORY` / `MISSING` in PRD/BDD — must reach
440
+ the PO via the feedback flow, not sit only in `DOC_GAPS.md`: file `/report-bug {UC-ID} {desc}`
441
+ (its BUG_FLOW classifies PRD vs BDD), or `/propose-scenario {UC-ID}` if the gap is missing test
442
+ coverage. `ASSUMPTION` / `OPEN QUESTION` gaps are confirmed via qc-plan's questions-for-dev — not filed as bugs.
431
443
 
432
444
  ## Output
433
445
 
434
- Write the analysis artifacts under `{paths.refinement_dir}/qc/{UC-ID}/` (requirement
435
- breakdown, BR table, data-flow, AC list with SC mapping, and `DOC_GAPS.md`).
446
+ Write **exactly TWO files** under `{paths.qc_dir}/{UC-ID}/` — do **not** split the analysis
447
+ into one-file-per-step (no separate spec-breakdown / business-rules / data-flow / AC files):
448
+
449
+ 1. **`{paths.qc_dir}/{UC-ID}/REQUIREMENT_ANALYSIS.md`** — the single consolidated analysis.
450
+ Sections in order: requirement breakdown → business-rule table (`BR-xx`) → data-flow →
451
+ acceptance-criteria (`AC-xx`), each `BR`/`AC` mapped to its owning `{UC-ID}-SC{N}`.
452
+ 2. **`{paths.qc_dir}/{UC-ID}/DOC_GAPS.md`** — the gaps file (per `{paths.qc_skills_dir}/qa-analyst/DOC_GAPS.template.md`).
453
+
454
+ `{paths.qc_dir}` is a VISIBLE top-level folder in the QC repo (default `docs/`, **not** the
455
+ hidden `.agent/review/`) so the QC team can open and process the output easily. The official
456
+ spec stays in the PO spec submodule — do not write analysis there.
436
457
 
437
458
  ## Report
438
459
 
@@ -458,6 +479,36 @@ Output Artifacts:
458
479
 
459
480
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
460
481
 
482
+ ## Pipeline Position
483
+
484
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
485
+ so the user always sees where this command sits in the end-to-end flow:
486
+
487
+ ```
488
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
489
+ ```
490
+
491
+ Find the current command in this phase legend and mark **its** phase in the map above:
492
+
493
+ | Phase | Commands |
494
+ |-------|----------|
495
+ | Discovery | `/define-product` |
496
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
497
+ | Design Spec | `/generate-design-spec` |
498
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
499
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
500
+ | Code | `/generate-code` · `/review-code` |
501
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
502
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
503
+ | Trace Audit | `/validate-traces` |
504
+
505
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
506
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
507
+
508
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
509
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
510
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
511
+
461
512
  ## Next Command Suggestion
462
513
 
463
514
  Suggest the logical next command based on workflow phase:
@@ -499,15 +550,19 @@ Suggest the logical next command based on workflow phase:
499
550
  Format the footer as:
500
551
  ```
501
552
  ---
502
- Status : {badge}
553
+ Status : {badge}
503
554
  {Output Artifacts block}
504
- Next : {suggested command with example arguments}
555
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
556
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
557
+ Next : {suggested command with example arguments}
505
558
  ```
559
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
506
560
 
507
561
 
508
562
  ```
509
563
  /qc-analyze Complete — {UC-ID}
510
- Gaps: {N} ({blockers} blocker)
564
+ Files: {paths.qc_dir}/{UC-ID}/REQUIREMENT_ANALYSIS.md + DOC_GAPS.md (2 files)
565
+ Gaps: {N} ({blockers} blocker) ← spec-defect blocker? → /report-bug {UC-ID} | coverage gap → /propose-scenario {UC-ID}
511
566
  SC mapping: {M} BR/AC mapped to {K} scenarios
512
567
  Next: /qc-plan {UC-ID} ← risk / what-if / questions-for-dev
513
568
  (resolve 🔴 Blocker gaps with PO/Dev first)
@@ -92,7 +92,7 @@ Wait for explicit "Y" or "N" from the user before continuing.
92
92
  - "N" → stop and ask what the user wants to change.
93
93
 
94
94
 
95
- *Note: For this command, the target in Step 1 is a UC-ID. Read the qc-analyze + qc-plan outputs from `{paths.refinement_dir}/qc/{UC-ID}/` and the official `.feature` (with `@trace.scenario` per scenario).*
95
+ *Note: For this command, the target in Step 1 is a UC-ID. Read the qc-analyze + qc-plan outputs (`REQUIREMENT_ANALYSIS.md`, `DOC_GAPS.md`, `TEST_PLAN.md`) from `{paths.qc_dir}/{UC-ID}/` and the official `.feature` (with `@trace.scenario` per scenario). For GUI layers, also read the FE tech-design §2b **Test Selectors** table at `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design-{platform}.md` (if present) — the stable test-ids QC will locate by.*
96
96
 
97
97
  ## Context
98
98
  # Context Loader — Load All Project Context
@@ -133,6 +133,8 @@ Read `.agent/project-context.yaml`. Extract and store:
133
133
  - `paths.specs_dir` → BDD specs root
134
134
  - `paths.prd_dir` → PRD documents root
135
135
  - `paths.refinement_dir` → findings/review output dir
136
+ - `paths.qc_dir` → QC automation artifacts root (visible top-level, one subfolder per UC: `{qc_dir}/{UC-ID}/`)
137
+ - `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)
136
138
  - `paths.product_definitions_dir` → product definitions root
137
139
  - `paths.domain_knowledge_dir` → domain knowledge root
138
140
  - `paths.business_dictionary` → path to business-dictionary.md
@@ -145,6 +147,8 @@ If `paths` section is absent, use these defaults:
145
147
  - `specs_dir` = `specs/bdd`
146
148
  - `prd_dir` = `specs/prd`
147
149
  - `refinement_dir` = `.agent/review`
150
+ - `qc_dir` = `docs`
151
+ - `qc_skills_dir` = `.agent/skills/qc`
148
152
  - `product_definitions_dir` = `specs/product-definition`
149
153
  - `domain_knowledge_dir` = `specs/domain-knowledge`
150
154
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
@@ -170,7 +174,7 @@ If `services` section is present:
170
174
  - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
171
175
 
172
176
  **2. Route to service** — if active domain matches a key in `services`:
173
- - Override `paths.specs_dir` → `services.{domain}.specs_dir`
177
+ - 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.
174
178
  - 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.
175
179
  - Store `active_service` = `services.{domain}.path`
176
180
  - Store `active_service_module` = `services.{domain}.module`
@@ -181,6 +185,7 @@ If `services` section is present:
181
185
  - Set `active_service = unresolved`
182
186
 
183
187
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
188
+ - 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`.)*
184
189
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
185
190
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
186
191
  - 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.)*
@@ -189,8 +194,10 @@ If `services` section is present:
189
194
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
190
195
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
191
196
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
197
+ - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
198
+ - 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`.)*
192
199
 
193
- > **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.
200
+ > **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.
194
201
 
195
202
  ---
196
203
 
@@ -210,12 +217,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
210
217
  |----------|--------|
211
218
  | `conventions.test_command` | service's `conventions.test_command` |
212
219
  | `conventions.build_command` | service's `conventions.build_command` |
213
- | `paths.trace_dir` | `{active_service}/{service paths.trace_dir}` default: `{active_service}/.trace` |
214
- | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
220
+ | `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`). |
221
+ | `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. |
215
222
 
216
223
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
217
224
  - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
218
- - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
225
+ - **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/`).
219
226
 
220
227
  **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).
221
228
 
@@ -400,7 +407,7 @@ You are the **QC Designer** — stage 3. Produce/maintain test-case Markdown fil
400
407
  (`.Test.md`) from the analyzed requirement + plan. Output feeds qc-run-test (Python) and
401
408
  qc-review. You do **not** write Python.
402
409
 
403
- ## Skills — pick the layer, load ONE file (`skills/qc/qa-designer/`)
410
+ ## Skills — pick the layer, load ONE file (`{paths.qc_skills_dir}/qa-designer/`)
404
411
 
405
412
  | Layer | File |
406
413
  |---|---|
@@ -418,6 +425,7 @@ qc-review. You do **not** write Python.
418
425
  - TC ID `TC_<FEATURE>_<NNN>`; split happy/negative; one assertion concern per TC; concrete expected values.
419
426
  - Priority `P0/P1/P2`; Tags (`smoke regression happy-path negative ui …`); Status `Draft → In Progress → Pass/Fail/Skip`.
420
427
  - A TC blocked by a gap is still written + marked `🚫 Block: GAP-xx`.
428
+ - **Reference test-ids, not visual cues.** For each GUI step that acts on an element, cite the stable test-id from the FE tech-design §2b table (e.g. "click `ft001-login-submit-btn`") so qc-run-test builds the locator from the contract. If an actionable element has no test-id in §2b, note it (qc-run-test will fall back to a slower role/text locator).
421
429
  - End-of-file: Trace matrix + blocked-TC table.
422
430
 
423
431
  ## Trace mapping (mandatory)
@@ -429,7 +437,7 @@ qc-run-test write `qc_status` per scenario.
429
437
 
430
438
  ## Output
431
439
 
432
- Write `.Test.md` files under `{paths.refinement_dir}/qc/{UC-ID}/test-cases/`.
440
+ Write `.Test.md` files under `{paths.qc_dir}/{UC-ID}/test-cases/`.
433
441
 
434
442
  ## Report
435
443
 
@@ -455,6 +463,36 @@ Output Artifacts:
455
463
 
456
464
  If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
457
465
 
466
+ ## Pipeline Position
467
+
468
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
469
+ so the user always sees where this command sits in the end-to-end flow:
470
+
471
+ ```
472
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
473
+ ```
474
+
475
+ Find the current command in this phase legend and mark **its** phase in the map above:
476
+
477
+ | Phase | Commands |
478
+ |-------|----------|
479
+ | Discovery | `/define-product` |
480
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
481
+ | Design Spec | `/generate-design-spec` |
482
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
483
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
484
+ | Code | `/generate-code` · `/review-code` |
485
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
486
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
487
+ | Trace Audit | `/validate-traces` |
488
+
489
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
490
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
491
+
492
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
493
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
494
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
495
+
458
496
  ## Next Command Suggestion
459
497
 
460
498
  Suggest the logical next command based on workflow phase:
@@ -496,10 +534,13 @@ Suggest the logical next command based on workflow phase:
496
534
  Format the footer as:
497
535
  ```
498
536
  ---
499
- Status : {badge}
537
+ Status : {badge}
500
538
  {Output Artifacts block}
501
- Next : {suggested command with example arguments}
539
+ Pipeline : Discovery PRD [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
540
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
541
+ Next : {suggested command with example arguments}
502
542
  ```
543
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
503
544
 
504
545
 
505
546
  ```