@anhth2/spec-driven-dev-plugin 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/commands/debug.md +5 -0
  2. package/commands/define-product.md +5 -0
  3. package/commands/dev-gen-test.md +5 -0
  4. package/commands/dev-run-test.md +5 -0
  5. package/commands/dev-smoke-test.md +5 -0
  6. package/commands/fix-bug.md +41 -6
  7. package/commands/fix-bug.tmpl +36 -6
  8. package/commands/generate-bdd.md +9 -2
  9. package/commands/generate-bdd.tmpl +4 -2
  10. package/commands/generate-code.md +5 -0
  11. package/commands/generate-design-spec.md +5 -0
  12. package/commands/generate-prd.md +5 -0
  13. package/commands/generate-spec-manifest.md +5 -0
  14. package/commands/generate-tech-docs.md +5 -0
  15. package/commands/learn.md +5 -0
  16. package/commands/propose-scenario.md +36 -11
  17. package/commands/propose-scenario.tmpl +31 -11
  18. package/commands/qc-analyze.md +25 -5
  19. package/commands/qc-analyze.tmpl +20 -5
  20. package/commands/qc-design-test.md +8 -3
  21. package/commands/qc-design-test.tmpl +3 -3
  22. package/commands/qc-plan.md +8 -3
  23. package/commands/qc-plan.tmpl +3 -3
  24. package/commands/qc-report.md +18 -1
  25. package/commands/qc-report.tmpl +13 -1
  26. package/commands/qc-review.md +7 -2
  27. package/commands/qc-review.tmpl +2 -2
  28. package/commands/qc-run-test.md +13 -2
  29. package/commands/qc-run-test.tmpl +8 -2
  30. package/commands/refine-prd.md +5 -0
  31. package/commands/report-bug.md +21 -2
  32. package/commands/report-bug.tmpl +16 -2
  33. package/commands/review-code.md +5 -0
  34. package/commands/review-context.md +5 -0
  35. package/commands/review-tech-docs.md +5 -0
  36. package/commands/sync.md +12 -9
  37. package/commands/sync.tmpl +12 -9
  38. package/commands/validate-traces.md +15 -2
  39. package/commands/validate-traces.tmpl +10 -2
  40. package/core/FRAMEWORK_VERSION +1 -1
  41. package/core/commands/debug.md +5 -0
  42. package/core/commands/define-product.md +5 -0
  43. package/core/commands/dev-gen-test.md +5 -0
  44. package/core/commands/dev-run-test.md +5 -0
  45. package/core/commands/dev-smoke-test.md +5 -0
  46. package/core/commands/fix-bug.md +41 -6
  47. package/core/commands/generate-bdd.md +9 -2
  48. package/core/commands/generate-code.md +5 -0
  49. package/core/commands/generate-design-spec.md +5 -0
  50. package/core/commands/generate-prd.md +5 -0
  51. package/core/commands/generate-spec-manifest.md +5 -0
  52. package/core/commands/generate-tech-docs.md +5 -0
  53. package/core/commands/learn.md +5 -0
  54. package/core/commands/propose-scenario.md +36 -11
  55. package/core/commands/qc-analyze.md +25 -5
  56. package/core/commands/qc-design-test.md +8 -3
  57. package/core/commands/qc-plan.md +8 -3
  58. package/core/commands/qc-report.md +18 -1
  59. package/core/commands/qc-review.md +7 -2
  60. package/core/commands/qc-run-test.md +13 -2
  61. package/core/commands/refine-prd.md +5 -0
  62. package/core/commands/report-bug.md +21 -2
  63. package/core/commands/review-code.md +5 -0
  64. package/core/commands/review-context.md +5 -0
  65. package/core/commands/review-tech-docs.md +5 -0
  66. package/core/commands/sync.md +12 -9
  67. package/core/commands/validate-traces.md +15 -2
  68. package/core/modules/qc-playwright/stack-profile.yaml +3 -3
  69. package/core/skills/code/SKILL.md +5 -0
  70. package/core/skills/debug/SKILL.md +5 -0
  71. package/core/skills/design-spec/SKILL.md +5 -0
  72. package/core/skills/discovery/SKILL.md +5 -0
  73. package/core/skills/qc/qa-analyst/acceptance-criteria.md +5 -1
  74. package/core/skills/qc/qa-analyst/business-rules.md +6 -2
  75. package/core/skills/qc/qa-analyst/data-flow.md +6 -2
  76. package/core/skills/qc/qa-analyst/spec-breakdown.md +7 -3
  77. package/core/skills/qc/qa-designer/e2e/journey.md +1 -1
  78. package/core/skills/qc/qa-designer/exploratory/charter.md +2 -2
  79. package/core/skills/qc/qa-designer/exploratory/explore-to-functional.md +1 -1
  80. package/core/skills/qc/qa-designer/functional/api.md +1 -1
  81. package/core/skills/qc/qa-designer/functional/gui-feature.md +1 -1
  82. package/core/skills/qc/qa-designer/functional/gui-screen.md +1 -1
  83. package/core/skills/qc/qa-designer/integration/api.md +1 -1
  84. package/core/skills/qc/qa-designer/integration/db.md +1 -1
  85. package/core/skills/qc/qa-designer/integration/gui.md +1 -1
  86. package/core/skills/qc/qa-designer/integration/kafka.md +1 -1
  87. package/core/skills/qc/qa-designer/non-functional.md +1 -1
  88. package/core/skills/qc/qa-planner/test-plan.md +4 -4
  89. package/core/skills/qc/qa-runner/exploratory/session.md +2 -2
  90. package/core/skills/test/SKILL.md +10 -0
  91. package/core/steps/context-loader.md +5 -0
  92. package/core/templates/project-context.yaml +19 -1
  93. package/docs/01-getting-started/installation.md +3 -1
  94. package/docs/02-guides/developer/commands.md +1 -1
  95. package/docs/02-guides/developer/workflow.md +2 -0
  96. package/docs/02-guides/qc-automation.md +66 -1
  97. package/docs/02-guides/tester/README.md +2 -0
  98. package/docs/02-guides/tester/bug-reporting.md +1 -1
  99. package/docs/02-guides/tester/workflow.md +4 -3
  100. package/docs/03-concepts/architecture.md +2 -0
  101. package/docs/03-concepts/pipeline.md +19 -6
  102. package/docs/03-concepts/traceability.md +2 -1
  103. package/docs/04-operations/bug-flow.md +45 -4
  104. package/docs/04-operations/sync-and-update.md +38 -1
  105. package/docs/05-reference/commands.md +11 -11
  106. package/docs/05-reference/modules.md +2 -2
  107. package/docs/05-reference/trace-schema.md +18 -12
  108. package/modules/qc-playwright/stack-profile.yaml +3 -3
  109. package/package.json +1 -1
  110. package/skills/code/SKILL.md +5 -0
  111. package/skills/debug/SKILL.md +5 -0
  112. package/skills/design-spec/SKILL.md +5 -0
  113. package/skills/discovery/SKILL.md +5 -0
  114. package/skills/qc/qa-analyst/acceptance-criteria.md +5 -1
  115. package/skills/qc/qa-analyst/business-rules.md +6 -2
  116. package/skills/qc/qa-analyst/data-flow.md +6 -2
  117. package/skills/qc/qa-analyst/spec-breakdown.md +7 -3
  118. package/skills/qc/qa-designer/e2e/journey.md +1 -1
  119. package/skills/qc/qa-designer/exploratory/charter.md +2 -2
  120. package/skills/qc/qa-designer/exploratory/explore-to-functional.md +1 -1
  121. package/skills/qc/qa-designer/functional/api.md +1 -1
  122. package/skills/qc/qa-designer/functional/gui-feature.md +1 -1
  123. package/skills/qc/qa-designer/functional/gui-screen.md +1 -1
  124. package/skills/qc/qa-designer/integration/api.md +1 -1
  125. package/skills/qc/qa-designer/integration/db.md +1 -1
  126. package/skills/qc/qa-designer/integration/gui.md +1 -1
  127. package/skills/qc/qa-designer/integration/kafka.md +1 -1
  128. package/skills/qc/qa-designer/non-functional.md +1 -1
  129. package/skills/qc/qa-planner/test-plan.md +4 -4
  130. package/skills/qc/qa-runner/exploratory/session.md +2 -2
  131. package/skills/test/SKILL.md +10 -0
  132. package/steps/context-loader.md +5 -0
  133. package/templates/project-context.yaml +19 -1
@@ -52,9 +52,13 @@ Thể hiện luồng dạng bước tuần tự hoặc sơ đồ text:
52
52
 
53
53
  ## Output
54
54
 
55
+ Ghi vào **mục Data Flow** của `{paths.qc_dir}/{UC-ID}/REQUIREMENT_ANALYSIS.md`
56
+ (KHÔNG tạo file riêng — qc-analyze chỉ trả 2 file: `REQUIREMENT_ANALYSIS.md` + `DOC_GAPS.md`):
57
+
55
58
  - Sơ đồ/list luồng dữ liệu cho mỗi kịch bản chính.
56
59
  - Danh sách integration point + state change + failure point.
57
- - Chặng nào luồng/hành vi chưa rõ (vd lỗi xử lý ra sao, retry, partial commit) →
58
- ghi vào `DOC_GAPS.md` (loại MISSING / OPEN QUESTION).
59
60
  - Gợi ý loại test cần cho từng điểm (gui-feature / integration / e2e) khi sang qa-designer.
60
61
  - Dữ liệu/trạng thái cần chuẩn bị & cleanup → đầu vào fixture cho qa-runner.
62
+
63
+ Chặng nào luồng/hành vi chưa rõ (vd lỗi xử lý ra sao, retry, partial commit) →
64
+ ghi vào `{paths.qc_dir}/{UC-ID}/DOC_GAPS.md` (loại MISSING / OPEN QUESTION).
@@ -46,12 +46,16 @@ F. GIẢ ĐỊNH & CÂU HỎI MỞ: điều suy ra được vs điều cần dev
46
46
 
47
47
  ## Output
48
48
 
49
- File Markdown tả yêu cầu cấu trúc (đặt trong `docs/<project>/<feature>/`):
49
+ ⚠️ `/qc-analyze` chỉ ghi **ĐÚNG 2 FILE** cho mỗi UC, đặt trong thư mục QC **lộ ra ngoài**
50
+ `{paths.qc_dir}/{UC-ID}/` (mặc định `docs/{UC-ID}/` — KHÔNG để trong `.agent/` ẩn):
51
+ `REQUIREMENT_ANALYSIS.md` + `DOC_GAPS.md`. KHÔNG tách mỗi bước phân tích thành file riêng.
52
+
53
+ Phần spec-breakdown là **mục đầu tiên** của `REQUIREMENT_ANALYSIS.md`:
50
54
  - Bảng chức năng + input/output/constraint
51
55
  - Sơ đồ/list luồng chính & phụ
52
56
  - Danh sách giả định và câu hỏi mở (đánh dấu rõ điều CHƯA chắc)
53
57
 
54
- Đồng thời ghi mọi khoảng trống phát hiện vào `docs/<project>/<feature>/DOC_GAPS.md`
55
- (theo `.claude/skills/qa-analyst/DOC_GAPS.template.md`), mỗi gap có ID `GAP-xx`.
58
+ Đồng thời ghi mọi khoảng trống phát hiện vào `{paths.qc_dir}/{UC-ID}/DOC_GAPS.md`
59
+ (theo `{paths.qc_skills_dir}/qa-analyst/DOC_GAPS.template.md`), mỗi gap có ID `GAP-xx`.
56
60
 
57
61
  Kết thúc bằng gợi ý: feature đã đủ rõ để chuyển sang `qa-planner` (phân tích rủi ro) chưa.
@@ -37,5 +37,5 @@ Mỗi journey → 1 TC bám Format; Expected = chuỗi verify point; chuẩn b
37
37
  **Journey phụ thuộc gap vẫn viết + 🚫 Block: GAP-xx**, định tuyến ghi "dự kiến theo BR". Trace BR.
38
38
 
39
39
  ## Output
40
- File TC e2e (hoặc nhóm E2E trong file feature) trong `docs/<project>/<feature>/`.
40
+ File TC e2e (hoặc nhóm E2E trong file feature) trong `{paths.qc_dir}/{UC-ID}/test-cases/`.
41
41
  In bảng `E2E-ID | Journey | Pri | Trace | Block` + bảng TC block. Bàn giao `qa-reviewer`.
@@ -63,6 +63,6 @@ Sinh 10-15 câu hỏi cho dev/BA (assumptions, edge case, error handling, securi
63
63
 
64
64
  ## Output
65
65
 
66
- Charter files: docs/<project>/exploratory/charters/<feature>_01.md, _02.md...
67
- Ideas file: docs/<project>/exploratory/ideas/<feature>.md
66
+ Charter files: {paths.qc_dir}/exploratory/charters/<feature>_01.md, _02.md...
67
+ Ideas file: {paths.qc_dir}/exploratory/ideas/<feature>.md
68
68
  Bảng tổng kết: STT | Charter | Tour | Risk | Time-box
@@ -37,7 +37,7 @@ Chuyển draft → TC chính thức bám **format file `TC_<FEATURE>.md`**:
37
37
  **Trace** `[BR-xx](REQUIREMENT_ANALYSIS.md#3-business-rules)` (không có BR → `⚠️ Chưa có Business Rule`) · **🚫 Block** `[GAP-xx]` nếu chặn.
38
38
  - **Test Data** dạng list · **Steps** `[Action]`/`[Verify]` · **Expected** 1 bullet cụ thể.
39
39
  - Phân nhóm GUI/Functional · cuối file: Trace matrix + bảng TC block · bỏ nội dung gạch ngang.
40
- - Đặt file `docs/<project>/<feature>/TC_<FEATURE>.md`.
40
+ - Đặt file `{paths.qc_dir}/{UC-ID}/test-cases/TC_<FEATURE>.md`.
41
41
 
42
42
  ## Output
43
43
  File TC functional + bảng `TC_ID | Title | Priority | Technique | Trace`. Bàn giao `qa-reviewer`.
@@ -41,5 +41,5 @@ response (schema thành công + các mã lỗi 4xx/5xx + body lỗi) · side-eff
41
41
  - Mỗi TC bám khối Format; Expected ghi status code + phần body verify; trace BR; gap chặn → 🚫 Block.
42
42
 
43
43
  ## Output
44
- File TC (`TC_<FEATURE>_API.md` hoặc gộp trong file feature) trong `docs/<project>/<feature>/`.
44
+ File TC (`TC_<FEATURE>_API.md` hoặc gộp trong file feature) trong `{paths.qc_dir}/{UC-ID}/test-cases/`.
45
45
  In bảng TC + Trace matrix. Bàn giao `qa-reviewer`.
@@ -42,5 +42,5 @@ Liệt kê các màn/route + thứ tự điều hướng · state/dữ liệu tr
42
42
  - Mỗi TC bám khối Format; trace BR; gap chặn → 🚫 Block.
43
43
 
44
44
  ## Output
45
- File `TC_<FEATURE>.md` trong `docs/<project>/<feature>/`. In bảng TC + Trace matrix + bảng TC block.
45
+ File `TC_<FEATURE>.md` trong `{paths.qc_dir}/{UC-ID}/test-cases/`. In bảng TC + Trace matrix + bảng TC block.
46
46
  Bàn giao `qa-reviewer` (test-case).
@@ -48,5 +48,5 @@ chức năng (input/action/display/nav) · constraint (required/min-max/format/e
48
48
  - Mỗi TC bám khối Format trên; trace BR; TC chặn bởi gap → 🚫 Block.
49
49
 
50
50
  ## Output
51
- File `TC_<FEATURE>.md` trong `docs/<project>/<feature>/`. In bảng `TC_ID | Title | Priority | Tags | Trace`
51
+ File `TC_<FEATURE>.md` trong `{paths.qc_dir}/{UC-ID}/test-cases/`. In bảng `TC_ID | Title | Priority | Tags | Trace`
52
52
  + Trace matrix + bảng TC block. Bàn giao `qa-reviewer` (test-case).
@@ -39,4 +39,4 @@ Nhóm TC: happy (dữ liệu đúng đầu→cuối) → contract negative (inpu
39
39
  → concurrency → điều kiện đồng bộ (đổ/không đổ). Mỗi TC bám Format; trace BR; gap chặn → 🚫 Block.
40
40
 
41
41
  ## Output
42
- File TC integration trong `docs/<project>/<feature>/`. Ưu tiên P0 cho định tuyến & tiền-dữ liệu. Bàn giao `qa-reviewer`.
42
+ File TC integration trong `{paths.qc_dir}/{UC-ID}/test-cases/`. Ưu tiên P0 cho định tuyến & tiền-dữ liệu. Bàn giao `qa-reviewer`.
@@ -35,5 +35,5 @@ Nhóm TC: ghi đúng giá trị (happy) → default/null đúng → update khôn
35
35
  → audit log → ràng buộc/unique (negative). Mỗi TC bám Format; trace BR; gap chặn → 🚫 Block.
36
36
 
37
37
  ## Output
38
- File TC trong `docs/<project>/<feature>/`. Ghi rõ query kiểm tra DB + yêu cầu cleanup;
38
+ File TC trong `{paths.qc_dir}/{UC-ID}/test-cases/`. Ghi rõ query kiểm tra DB + yêu cầu cleanup;
39
39
  không hardcode ID, chuẩn bị/dọn data qua fixture. Bàn giao `qa-reviewer`.
@@ -37,4 +37,4 @@ Nhóm TC: UI render đúng dữ liệu backend (happy) → empty state → lỗi
37
37
  Mỗi TC bám Format; trace BR; gap chặn → 🚫 Block.
38
38
 
39
39
  ## Output
40
- File TC trong `docs/<project>/<feature>/`. Mỗi TC nêu API liên quan + biểu hiện UI. Bàn giao `qa-reviewer`.
40
+ File TC trong `{paths.qc_dir}/{UC-ID}/test-cases/`. Mỗi TC nêu API liên quan + biểu hiện UI. Bàn giao `qa-reviewer`.
@@ -37,4 +37,4 @@ Nhóm TC: phát đúng topic+payload (happy) → điều kiện không phát →
37
37
  Mỗi TC bám Format; trace BR; gap chặn → 🚫 Block.
38
38
 
39
39
  ## Output
40
- File TC trong `docs/<project>/<feature>/`. Mỗi TC ghi topic, key, payload cần verify + hành vi consumer. Bàn giao `qa-reviewer`.
40
+ File TC trong `{paths.qc_dir}/{UC-ID}/test-cases/`. Mỗi TC ghi topic, key, payload cần verify + hành vi consumer. Bàn giao `qa-reviewer`.
@@ -37,4 +37,4 @@ Mỗi TC bám Format; **Expected có ngưỡng pass + công cụ đo**; đánh d
37
37
  Trace BR; gap chặn → 🚫 Block.
38
38
 
39
39
  ## Output
40
- File TC non-functional trong `docs/<project>/<feature>/`. Mỗi TC ghi tiêu chí đo + ngưỡng + công cụ. Bàn giao `qa-reviewer`.
40
+ File TC non-functional trong `{paths.qc_dir}/{UC-ID}/test-cases/`. Mỗi TC ghi tiêu chí đo + ngưỡng + công cụ. Bàn giao `qa-reviewer`.
@@ -8,9 +8,9 @@ ported_from: ai-automation-qc-base
8
8
 
9
9
  Tổng hợp **output của qa-analyst** thành **Test Plan** cho một feature.
10
10
 
11
- **Đầu vào (bắt buộc, chỉ 2 nguồn):**
12
- 1. `docs/<project>/<feature>/REQUIREMENT_ANALYSIS.md` — chức năng, BR-xx, AC-xx, data flow (qa-analyst).
13
- 2. `docs/<project>/<feature>/DOC_GAPS.md` — bảng gap GAP-xx, mức độ, gap Blocker (qa-analyst).
11
+ **Đầu vào (bắt buộc, chỉ 2 nguồn — đúng 2 file qa-analyst trả ra):**
12
+ 1. `{paths.qc_dir}/{UC-ID}/REQUIREMENT_ANALYSIS.md` — chức năng, BR-xx, AC-xx, data flow (qa-analyst).
13
+ 2. `{paths.qc_dir}/{UC-ID}/DOC_GAPS.md` — bảng gap GAP-xx, mức độ, gap Blocker (qa-analyst).
14
14
 
15
15
  ## Khi nào trigger
16
16
  - "lập test plan cho [Feature]" / "viết test plan"
@@ -53,7 +53,7 @@ Tổng hợp **output của qa-analyst** thành **Test Plan** cho một feature.
53
53
 
54
54
  ## Output — Template `TEST_PLAN.md`
55
55
 
56
- Đặt tại `docs/<project>/<feature>/TEST_PLAN.md`:
56
+ Đặt tại `{paths.qc_dir}/{UC-ID}/TEST_PLAN.md`:
57
57
 
58
58
  ```markdown
59
59
  # Test Plan – <Feature>
@@ -23,7 +23,7 @@ Skill **tự chứa**, 2 mode:
23
23
  Input: charter + tour + tester + time-box. Tạo file gồm: metadata (date/tester/charter/tour/env/data) ·
24
24
  `#SETUP` (bước chuẩn bị) · `#TEST` (5–8 gợi ý theo tour) · `#BUG` template (title, severity, steps,
25
25
  expected/actual) · `#QUESTION`, `#IDEA` placeholder · summary cuối session.
26
- → `docs/<project>/exploratory/sessions/<YYYY-MM-DD>_<tester>.md`
26
+ → `{paths.qc_dir}/exploratory/sessions/<YYYY-MM-DD>_<tester>.md`
27
27
 
28
28
  ## Mode 2 — Convert Findings
29
29
  Input: session note (#BUG + #IDEA).
@@ -33,4 +33,4 @@ Input: session note (#BUG + #IDEA).
33
33
  - **Weekly summary** (nếu yêu cầu): overview, top findings, coverage gap, recommendations.
34
34
 
35
35
  ## Output
36
- Mode 1: file session note. Mode 2: bug reports + file TC trong `docs/<project>/<feature>/` + summary.
36
+ Mode 1: file session note. Mode 2: bug reports + file TC trong `{paths.qc_dir}/{UC-ID}/test-cases/` + summary.
@@ -331,6 +331,8 @@ Read `.agent/project-context.yaml`. Extract and store:
331
331
  - `paths.specs_dir` → BDD specs root
332
332
  - `paths.prd_dir` → PRD documents root
333
333
  - `paths.refinement_dir` → findings/review output dir
334
+ - `paths.qc_dir` → QC automation artifacts root (visible top-level, one subfolder per UC: `{qc_dir}/{UC-ID}/`)
335
+ - `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)
334
336
  - `paths.product_definitions_dir` → product definitions root
335
337
  - `paths.domain_knowledge_dir` → domain knowledge root
336
338
  - `paths.business_dictionary` → path to business-dictionary.md
@@ -343,6 +345,8 @@ If `paths` section is absent, use these defaults:
343
345
  - `specs_dir` = `specs/bdd`
344
346
  - `prd_dir` = `specs/prd`
345
347
  - `refinement_dir` = `.agent/review`
348
+ - `qc_dir` = `docs`
349
+ - `qc_skills_dir` = `.agent/skills/qc`
346
350
  - `product_definitions_dir` = `specs/product-definition`
347
351
  - `domain_knowledge_dir` = `specs/domain-knowledge`
348
352
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
@@ -387,6 +391,7 @@ If `services` section is present:
387
391
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
388
392
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
389
393
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
394
+ - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
390
395
 
391
396
  > **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.
392
397
 
@@ -765,6 +770,8 @@ Read `.agent/project-context.yaml`. Extract and store:
765
770
  - `paths.specs_dir` → BDD specs root
766
771
  - `paths.prd_dir` → PRD documents root
767
772
  - `paths.refinement_dir` → findings/review output dir
773
+ - `paths.qc_dir` → QC automation artifacts root (visible top-level, one subfolder per UC: `{qc_dir}/{UC-ID}/`)
774
+ - `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)
768
775
  - `paths.product_definitions_dir` → product definitions root
769
776
  - `paths.domain_knowledge_dir` → domain knowledge root
770
777
  - `paths.business_dictionary` → path to business-dictionary.md
@@ -777,6 +784,8 @@ If `paths` section is absent, use these defaults:
777
784
  - `specs_dir` = `specs/bdd`
778
785
  - `prd_dir` = `specs/prd`
779
786
  - `refinement_dir` = `.agent/review`
787
+ - `qc_dir` = `docs`
788
+ - `qc_skills_dir` = `.agent/skills/qc`
780
789
  - `product_definitions_dir` = `specs/product-definition`
781
790
  - `domain_knowledge_dir` = `specs/domain-knowledge`
782
791
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
@@ -821,6 +830,7 @@ If `services` section is present:
821
830
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
822
831
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
823
832
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
833
+ - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
824
834
 
825
835
  > **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.
826
836
 
@@ -36,6 +36,8 @@ Read `.agent/project-context.yaml`. Extract and store:
36
36
  - `paths.specs_dir` → BDD specs root
37
37
  - `paths.prd_dir` → PRD documents root
38
38
  - `paths.refinement_dir` → findings/review output dir
39
+ - `paths.qc_dir` → QC automation artifacts root (visible top-level, one subfolder per UC: `{qc_dir}/{UC-ID}/`)
40
+ - `paths.qc_skills_dir` → where qc-* commands load QC skills from (default bundled `.agent/skills/qc`; override to the QC team's own repo/submodule so framework upgrade won't overwrite them)
39
41
  - `paths.product_definitions_dir` → product definitions root
40
42
  - `paths.domain_knowledge_dir` → domain knowledge root
41
43
  - `paths.business_dictionary` → path to business-dictionary.md
@@ -48,6 +50,8 @@ If `paths` section is absent, use these defaults:
48
50
  - `specs_dir` = `specs/bdd`
49
51
  - `prd_dir` = `specs/prd`
50
52
  - `refinement_dir` = `.agent/review`
53
+ - `qc_dir` = `docs`
54
+ - `qc_skills_dir` = `.agent/skills/qc`
51
55
  - `product_definitions_dir` = `specs/product-definition`
52
56
  - `domain_knowledge_dir` = `specs/domain-knowledge`
53
57
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
@@ -92,6 +96,7 @@ If `services` section is present:
92
96
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
93
97
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
94
98
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
99
+ - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
95
100
 
96
101
  > **Why under `spec_source`:** PRD, design-spec, domain knowledge, the **API contract (tech-docs)**, and tester feedback are all **cross-team artifacts** — they must live in the **shared spec repo** so every umbrella (FE/App/BE) reads the same source via `/sync`. Tech-docs specifically: BE authors the tech-design (API contract), commits + pushes it into the spec submodule (2-layer commit), and FE/App pull it on their next `/sync` to wire the real API in `/generate-code --phase=integration`. In single-service mode (no `spec_source`), these default under the repo root — still shared, same repo.
97
102
 
@@ -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
@@ -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/qc-automation.md#skill-sourcing--upgrade-safety](../02-guides/qc-automation.md#skill-sourcing--upgrade-safety).
92
94
 
93
95
  ## QC automation stack (tùy chọn)
94
96
 
@@ -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.
@@ -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
 
@@ -54,6 +54,8 @@ BE: my-project-specs/specs/bdd/{domain}/system/{TICKET-ID}-UC*.feature
54
54
  Tạo PR → notify PO/SA review
55
55
  ```
56
56
 
57
+ > **Commit ở đâu, push mấy tầng?** Code + `.trace/` nằm trong service submodule → **commit 2 tầng** (service rồi umbrella pointer); tech-docs đẩy lên spec repo. Sơ đồ git đầy đủ theo từng role: [Sync & Update — Git flow theo role](../../04-operations/sync-and-update.md#ai-commit-vào-repo-nào-git-flow-theo-role).
58
+
57
59
  ---
58
60
 
59
61
  ← [BDD & Trace System](bdd-and-trace.md) · Tiếp theo: [Tình huống thực tế](scenarios.md)
@@ -35,13 +35,20 @@ Cả hai hiển thị **cạnh nhau** trong Living Docs; không cái nào ghi đ
35
35
 
36
36
  | Command | Vai trò | Output |
37
37
  |---------|---------|--------|
38
- | `/qc-analyze` | bóc tách spec chính thức thành requirement + BR/AC + data-flow + `DOC_GAPS` | `{refinement_dir}/qc/{UC-ID}/` |
38
+ | `/qc-analyze` | bóc tách spec chính thức thành **1 file phân tích gộp** (requirement + BR/AC + data-flow) + `DOC_GAPS` | `{qc_dir}/{UC-ID}/` → `REQUIREMENT_ANALYSIS.md` + `DOC_GAPS.md` (**2 file**) |
39
39
  | `/qc-plan` | risk / what-if / questions-for-dev + test plan | `TEST_PLAN.md` |
40
40
  | `/qc-design-test` | thiết kế test case (Markdown `.Test.md`), tag `@trace.verifies={UC-ID}-SC{N}` | `test-cases/` |
41
41
  | `/qc-review` | cổng review hai chiều: review test case (sau design) và script (sau run) | findings |
42
42
  | `/qc-run-test` | sinh + chạy Python pytest-playwright; **ghi `qc_status`** per scenario | `{trace_dir}/{UC-ID}.tsv` |
43
43
  | `/qc-report` | report pytest-html + Playwright trace + evidence | `reports/<feature>/report.html` |
44
44
 
45
+ > **Nơi lưu artifact (`qc_dir`):** mọi output của pipeline (trừ report) nằm trong thư mục QC
46
+ > **lộ ra ngoài** `{qc_dir}/{UC-ID}/` — mặc định `docs/{UC-ID}/`, cấu hình qua `paths.qc_dir`
47
+ > trong `project-context.yaml`. Đây là **working-doc riêng của QC** trong repo QC, **không ẩn**
48
+ > (KHÔNG nằm trong `.agent/`). Spec gốc (PRD/`.feature`/design-spec) KHÔNG nằm đây — chúng đến
49
+ > từ **submodule spec của PO** (`spec_source`). `/qc-analyze` chỉ ghi **đúng 2 file**:
50
+ > `REQUIREMENT_ANALYSIS.md` (phân tích gộp) + `DOC_GAPS.md`.
51
+
45
52
  ## Stack — Module qc-playwright
46
53
 
47
54
  `/qc-run-test` và `/qc-report` dùng stack module `qc-playwright`
@@ -84,6 +91,64 @@ Các skill chi tiết theo từng giai đoạn QC nằm trong `skills/qc/`:
84
91
 
85
92
  Mỗi skill **tự chứa** (self-contained) và có version frontmatter để theo dõi khi nâng cấp.
86
93
 
94
+ ## Khi QC Tìm Thấy Bug / Spec Gap — Đẩy Lên Specs
95
+
96
+ QC chạy pipeline nhưng **không tự sửa spec/code**. Khi phát hiện vấn đề, đẩy lên spec repo của PO
97
+ qua flow feedback có sẵn (`/report-bug` · `/propose-scenario` — PO/Dev nhận khi `/sync`):
98
+
99
+ | QC phát hiện ở | Loại | Hành động |
100
+ |---|---|---|
101
+ | `/qc-run-test` FAIL = **product-gap** (impl ≠ spec, lỗi thật) | bug | `/report-bug {UC-ID} {expected vs actual}` |
102
+ | `/qc-run-test` FAIL = **script-bug** (sai selector/logic script) | — | QC tự sửa script + chạy lại (**KHÔNG** file bug) |
103
+ | `/qc-analyze` `DOC_GAPS` blocker = **spec sai / mơ hồ / mâu thuẫn** (PRD·BDD) | spec defect | `/report-bug {UC-ID}` (BUG_FLOW phân loại PRD/BDD) |
104
+ | `/qc-analyze` `DOC_GAPS` = **thiếu coverage** (behavior trong AC nhưng chưa có scenario) | coverage gap | `/propose-scenario {UC-ID}` |
105
+ | `DOC_GAPS` = `ASSUMPTION` / `OPEN QUESTION` | câu hỏi | qc-plan → questions-for-dev (xác nhận với PO/Dev, không file bug) |
106
+
107
+ `/report-bug` ghi `feedback/bug-reports/BUG-xxx.md` + commit/push lên spec repo; `/propose-scenario`
108
+ ghi `feedback/bdd-proposals/`. PO/Dev thấy khi `/sync`, rồi BUG_FLOW định tuyến root cause:
109
+
110
+ ```
111
+ • Code bug → Dev /fix-bug (KHÔNG đổi spec)
112
+ • BDD sai / thiếu → sửa .feature / promote proposal → /generate-bdd
113
+ • PRD mơ hồ / sai → PO sửa PRD → /refine-prd → /review-context → /generate-bdd
114
+ ↓ (nếu spec đổi → regenerate)
115
+ /generate-code lại → QC /qc-run-test lại → qc_status: fail → pass
116
+ ```
117
+
118
+ > QC chỉ **đọc** spec (từ submodule PO) — mọi thay đổi PRD/BDD là việc của PO/Dev. QC đẩy *tín hiệu*
119
+ > (bug / proposal / gap), không tự sửa canonical spec. `/qc-report` ở cuối pipeline **in sẵn** danh
120
+ > sách lệnh `/report-bug` cho từng product-gap để QC chạy. Chi tiết flow bug: [Operations · Bug Flow](../04-operations/bug-flow.md).
121
+
122
+ ## Skill Sourcing & Upgrade-Safety
123
+
124
+ Các skill QC (`qa-analyst` / `qa-designer` / `qa-planner` / `qa-reviewer` / `qa-runner` +
125
+ `DOC_GAPS.template.md`) **không bị hardcode** — command nạp chúng từ `paths.qc_skills_dir`:
126
+
127
+ | Tình huống | `qc_skills_dir` | Hệ quả khi `/update-framework` |
128
+ |---|---|---|
129
+ | Mặc định (standalone) | `.agent/skills/qc` (bản framework bundle) | **Bị ghi đè** mỗi lần upgrade → đừng sửa trực tiếp ở đây |
130
+ | QC sở hữu skill (khuyến nghị) | repo QC / submodule, vd `qc-base/.claude/skills` | **Không bao giờ bị đụng** — upgrade chỉ rewrite `.agent/` |
131
+
132
+ > `qc_skills_dir` chỉ cần trỏ tới thư mục **chứa các folder `qa-*`**. Cả 2 layout đều hợp lệ:
133
+ > framework bundle (`.agent/skills/qc/qa-analyst/…`) và repo QC (`.claude/skills/qa-analyst/…`).
134
+
135
+ **Cách QC tách skill ra khỏi vòng đời framework:**
136
+
137
+ ```bash
138
+ # 1. Đưa repo skill của QC vào project (submodule để pin version):
139
+ git submodule add <ai-automation-qc-base-repo-url> qc-base
140
+
141
+ # 2. Trỏ qc_skills_dir trong .agent/project-context.yaml:
142
+ # paths:
143
+ # qc_skills_dir: "qc-base/.claude/skills"
144
+
145
+ # 3. Từ giờ: QC hoàn thiện skill trong repo qc-base, bump submodule khi cần.
146
+ # /update-framework ghi đè .agent/ nhưng KHÔNG chạm qc-base/ → skill an toàn.
147
+ ```
148
+
149
+ Nhờ vậy **vòng đời skill QC** và **vòng đời framework** tách hẳn nhau: nâng cấp framework
150
+ không nuốt mất skill đang hoàn thiện, và QC update skill 1 chỗ (repo của họ) cho mọi project.
151
+
87
152
  ## Xem Thêm
88
153
 
89
154
  - [Guide › Tester](tester/README.md) — vai trò tester, spec-manifest, `/report-bug`, `/propose-scenario`
@@ -65,6 +65,8 @@ PRD BDD (từ PRD) /sync + /generate-spec-manifest
65
65
 
66
66
  Đây là **bộ test chính thức (authoritative) của QC**, chạy ngay trong framework. Pipeline dùng stack module `qc-playwright` (Python + pytest-playwright + Page Object). Xem chi tiết flow tại **[QC Automation guide](../qc-automation.md)**.
67
67
 
68
+ > **Artifact ra đâu:** `/qc-analyze` ghi **2 file** (`REQUIREMENT_ANALYSIS.md` + `DOC_GAPS.md`), `/qc-plan` → `TEST_PLAN.md`, `/qc-design-test` → `test-cases/*.Test.md` — tất cả trong `{qc_dir}/{UC-ID}/` (mặc định `docs/`, **visible**, không phải `.agent/` ẩn). Skill QC nạp từ `paths.qc_skills_dir` — trỏ được tới repo QC để skill **không bị `/update-framework` ghi đè**. Chi tiết: [QC Automation guide](../qc-automation.md#skill-sourcing--upgrade-safety).
69
+
68
70
  > **Phân biệt với test commands của Dev:** `/dev-gen-test`, `/dev-run-test`, `/dev-smoke-test` là **dev tự kiểm tra code của mình** — phát tín hiệu `dev_selftest`, KHÔNG phải bộ test chính thức. Bộ test authoritative của QC là pipeline `/qc-*` (sinh ra `qc_status`). Hai luồng tách biệt.
69
71
 
70
72
  ---
@@ -30,7 +30,7 @@ Nếu `/report-bug` báo *coverage gap* (behavior đúng nhưng chưa có scenar
30
30
  ```
31
31
 
32
32
  - Nếu behavior **đã nằm trong một AC của PRD** → lệnh draft Gherkin (tag `@proposed @from-test`), ghi vào `{spec_source}/feedback/bdd-proposals/` → commit + push. PO/Dev review rồi đưa vào `.feature`.
33
- - Nếu behavior **chưa có trong PRD** → lệnh dừng xuất *PRD change request* cho PO.
33
+ - Nếu behavior **chưa có trong PRD** → lệnh **ghi** một *PRD change request* (`State: Open`) vào `{spec_source}/feedback/prd-change-requests/{UC-ID}-{slug}.md` → commit + push (KHÔNG chỉ in ra). PO thấy nó khi `/sync`, thêm/sửa AC rồi `/generate-bdd` lại.
34
34
 
35
35
  > Tester không tự ghi vào BDD — chỉ đề xuất. Giữ đúng ownership.
36
36
 
@@ -41,9 +41,10 @@ Lookup FT-042 trong spec-manifest.yaml
41
41
 
42
42
  Chạy QC automation pipeline (6 bước — ghi kết quả chính thức vào TSV)
43
43
 
44
- ├─ /qc-analyze {UC-ID} → bóc tách spec, xác định scope, phát hiện DOC_GAPS
45
- ├─ /qc-plan {UC-ID} → risk + test plan + questions-for-dev
46
- ├─ /qc-design-test {UC-ID} → thiết kế test case chi tiết (.Test.md)
44
+ ├─ /qc-analyze {UC-ID} → 2 file: REQUIREMENT_ANALYSIS.md + DOC_GAPS.md
45
+ ├─ /qc-plan {UC-ID} → TEST_PLAN.md (risk + plan + questions-for-dev)
46
+ ├─ /qc-design-test {UC-ID} → test-cases/*.Test.md
47
+ │ ⌙ artifact phân tích/thiết kế → {qc_dir}/{UC-ID}/ (mặc định docs/, VISIBLE)
47
48
  ├─ /qc-review {UC-ID} → review test design trước khi chạy
48
49
  ├─ /qc-run-test {UC-ID} → sinh + chạy pytest-playwright
49
50
  │ → ghi qc_status (pass/fail/skip) per scenario
@@ -62,6 +62,8 @@ LAYER 5 — OUTPUT (artifacts in consumer proj)
62
62
  src/ · .trace/*.tsv (authoritative, committed) · .agent/review/
63
63
  QC automation outputs:
64
64
  QC test cases / scripts (Python pytest-playwright, Page Object)
65
+ → QC analysis / test-cases ghi vào {qc_dir}/{UC-ID}/ (mặc định docs/,
66
+ visible — KHÔNG nằm trong .agent/)
65
67
  → guides per-layer ở skills/qc/<stage>/ · qc_status trong .trace/*.tsv
66
68
  ```
67
69
 
@@ -90,10 +90,13 @@ Phase 5 (cont): Dev Self-Check (dev verifies their OWN code — NOT the officia
90
90
 
91
91
  Phase 5b: QC Automation (the OFFICIAL QC suite — see below)
92
92
 
93
- Phase 6: Tester Feedback (QA → PO/Dev, closes the loop)
94
- /report-bug {UC-ID} ──────→ {spec}/feedback/bug-reports/{BUG-ID}.md commit+push
95
- /propose-scenario {UC-ID} → {spec}/feedback/bdd-proposals/{...}.md commit+push
96
- PO/Dev: /sync "📥 New tester feedback" → /fix-bug · add to BDD · update PRD
93
+ Phase 6: Tester / QC Feedback (QA/QC → PO/Dev, closes the loop)
94
+ /report-bug {UC-ID} ──────→ {spec}/feedback/bug-reports/{BUG-ID}.md (State: Open) → push
95
+ /propose-scenario {UC-ID} → behavior ∈ AC → {spec}/feedback/bdd-proposals/{...}.md → push
96
+ behavior MỚI {spec}/feedback/prd-change-requests/{...}.md push
97
+ QC nguồn: /qc-run-test FAIL & /qc-analyze DOC_GAPS cũng route vào đây
98
+ PO/Dev: /sync → "📥 State: Open" → /fix-bug {BUG-ID} (Open→Fixed) · add BDD · update PRD
99
+ QC: /qc-run-test re-verify pass → bug Closed (qc_owner/qc_blocked_by clear)
97
100
 
98
101
  Cross-cutting (any role, anytime)
99
102
  /sync ────────────────────→ git pull + submodules + Living Docs + surface feedback
@@ -117,8 +120,18 @@ BDD approved (specs/bdd/*.feature)
117
120
  /qc-analyze → /qc-plan → /qc-design-test → /qc-review → /qc-run-test → /qc-report
118
121
  (đọc UC/SC, phân tích) chạy test → set qc_status
119
122
  ▼ ▼
120
- QC test cases / scripts .trace/*.tsv: qc_status
121
- (skills/qc/<stage>/ guides) (pass/fail/skip/not_run)
123
+ QC analysis + test cases .trace/*.tsv: qc_status
124
+ → {qc_dir}/{UC-ID}/ (visible, mặc định docs/) (pass/fail/skip/not_run)
125
+ REQUIREMENT_ANALYSIS.md · DOC_GAPS.md · + qc_owner / qc_blocked_by
126
+ TEST_PLAN.md · test-cases/*.Test.md (skills load từ {qc_skills_dir})
127
+
128
+ ── Feedback loop về spec (đóng vòng) ───────────────────────────────────
129
+ /qc-analyze DOC_GAPS blocker (spec sai/mơ hồ) ┐
130
+ /qc-run-test FAIL = product-gap ├─▶ /report-bug · /propose-scenario
131
+ /qc-report tổng hợp gap → in sẵn lệnh ┘ │ (cùng flow tester)
132
+
133
+ feedback/ trong spec repo (State: Open)
134
+ → commit+push → PO/Dev thấy qua /sync (xem bug-flow.md)
122
135
 
123
136
  Mapping: mỗi QC test → scenario qua @trace.verifies={UC-ID}-SC{N}
124
137
  ```
@@ -103,7 +103,8 @@ Living Docs (VS Code panel) đọc trace TSV và hiển thị traceability healt
103
103
  └──────────────────────────────────────────────────────────────────┘
104
104
  ```
105
105
 
106
- - Drill down: PRD → UC → per-scenario table (Spec ver, Gen ver, Code, Tests, **Dev Self-Check**, **QC Status**, Status)
106
+ - Drill down: PRD → UC → per-scenario table (Spec ver, Gen ver, Code, Tests, **Dev Self-Check**, **QC Status**, **Waiting on**, Status)
107
+ - **Waiting on** (cột `qc_owner` + `qc_blocked_by`): cho PO/PM thấy case chưa pass đang **chờ dev** (product-gap → `BUG-{id}`) hay **chờ PO** confirm/clarify (spec gap → `GAP-{id}`). Aggregates `waiting_dev` / `waiting_po` ở header dashboard.
107
108
  - Status badges: ✅ OK · ⚠️ DRIFT · 🔴 GAP · — UNTRACKED · filter theo domain/PRD status/doc status · search theo UC/SC ID.
108
109
 
109
110
  **Ba nơi chứa trace data — phân biệt authoritative vs mirror:**
@@ -1,8 +1,10 @@
1
1
  [📚 Docs](../README.md) › [Operations](README.md) › Bug Flow
2
2
 
3
- # Bug Flow — PO · Dev · Tester
3
+ # Bug Flow — PO · Dev · Tester · QC
4
4
 
5
- > Cách **PO, Dev, và Tester phối hợp** khi phát hiện bug. Mọi bug đều được trace về spec layer để fix đúng chỗ và tránh lặp lại.
5
+ > Cách **PO, Dev, Tester, QC phối hợp** khi phát hiện bug. Mọi bug đều được trace về spec layer để fix đúng chỗ và tránh lặp lại.
6
+
7
+ > **QC cũng là nguồn bug.** Pipeline `/qc-*` đẩy vào **cùng** flow này: `/qc-run-test` FAIL = `product-gap` → `/report-bug {UC-ID}`; `/qc-analyze` `DOC_GAPS` blocker (spec sai/mơ hồ) → `/report-bug` (Case 2/3) hoặc thiếu coverage → `/propose-scenario`. Cùng phân loại Case 1–6 bên dưới. Chi tiết: [Guide · QC Automation](../02-guides/qc-automation.md#khi-qc-tìm-thấy-bug--spec-gap--đẩy-lên-specs).
6
8
 
7
9
  ---
8
10
 
@@ -242,6 +244,40 @@ DevOps → check infra, env vars, deploy artifacts
242
244
 
243
245
  ## 9. Giao tiếp hiệu quả — các format thông báo
244
246
 
247
+ ### Git flow của feedback loop (2 repo, 1 vòng)
248
+
249
+ Mọi feedback đi qua **git**, không qua chat: file được ghi vào spec repo, commit+push, rồi PO/Dev kéo về bằng `/sync`. Đây là đường đi đầy đủ — từ lúc QC/Tester phát hiện tới lúc bug `Closed`:
250
+
251
+ ```
252
+ QC / Tester SPEC REPO (PO sở hữu) SERVICE SUBMODULE (Dev sở hữu)
253
+ ───────────── ───────────────────── ──────────────────────────────
254
+ /report-bug read-only
255
+ /propose-scenario specs/code
256
+ (QC: /qc-run-test FAIL,
257
+ /qc-analyze DOC_GAPS)
258
+ │ ghi file ──────────────▶ feedback/bug-reports/*.md (KHÔNG sửa specs/code trực tiếp)
259
+ feedback/bdd-proposals/*.md
260
+ feedback/prd-change-requests/*.md
261
+ State: Open
262
+ │ git commit + push (tầng spec repo)
263
+
264
+ origin(spec) ──── /sync (PO/Dev pull) ────┐
265
+
266
+ ┌──────────────── phân loại (Case 1–6) ───────────────┐
267
+ ▼ ▼
268
+ PRD/BDD gap → PO sửa PRD + bump Code bug → Dev /fix-bug {BUG-ID}
269
+ → commit+push spec repo → set State: Fixed
270
+ → /generate-bdd lại → commit+push service (tầng 1)
271
+ │ + umbrella pointer (tầng 2)
272
+ └───────────────────┬──────────────────┘
273
+
274
+ QC /qc-run-test re-verify ──── pass ──▶ State: Closed
275
+ (qc_owner / qc_blocked_by tự clear)
276
+ ```
277
+
278
+ - **2 tầng push** chỉ áp dụng phía service submodule (xem [Sync & Update §4.4](sync-and-update.md#44--commit-2-tầng-thay-đổi-trong-service-submodule)); feedback file nằm trong **spec repo** nên chỉ cần push 1 tầng ở đó.
279
+ - `/sync` chỉ surface bug `State: Open`; `Fixed`/`Closed` để riêng (xem [§10](#10-checklist-đóng-bug)).
280
+
245
281
  ### Bug report (Tester → Dev)
246
282
 
247
283
  Tester chạy `/report-bug {UC-ID} {mô tả}` → tự sinh report theo format dưới (gồm phân loại layer + phát hiện coverage gap), commit+push vào **spec repo** `feedback/bug-reports/{BUG-ID}.md`. PO/Dev thấy khi chạy `/sync` (dòng `📥 New tester feedback`):
@@ -306,11 +342,16 @@ Trước khi đánh "Resolved":
306
342
  - [ ] Nếu root cause là lỗi AI gen hay lặp → đã `/learn` (hoặc accept prompt khi `/fix-bug`)
307
343
  - [ ] Notify tester với đầy đủ thông tin re-test
308
344
 
309
- **Tester:**
310
- - [ ] Re-test đúng scenario được chỉ định
345
+ **Tester / QC:**
346
+ - [ ] Re-test đúng scenario được chỉ định (QC: `/qc-run-test {UC-ID}` lại → `qc_status` flip `fail → pass`)
311
347
  - [ ] Kiểm tra regression: các AC khác của cùng PRD không bị ảnh hưởng
312
348
  - [ ] Confirm PASS trước khi close
313
349
 
350
+ **Vòng đời bug report (đừng để `feedback/` phình mãi):**
351
+ - [ ] `State` của `feedback/bug-reports/{BUG-ID}.md`: `🟢 Open` → `🟡 Fixed` (set bởi `/fix-bug {BUG-ID}`) → `🟢 Closed` (sau khi `/qc-run-test` re-verify pass).
352
+ - [ ] Khi `Closed`: `/qc-run-test` clear `qc_owner`/`qc_blocked_by` của SC (tự động khi `qc_status=pass`); tuỳ chọn move file sang `feedback/bug-reports/archive/`.
353
+ - [ ] `/sync` chỉ surface bug `State: Open` là "đang chờ" — Fixed/Closed không làm nhiễu PO/PM.
354
+
314
355
  **PO** *(nếu PRD được cập nhật)*:
315
356
  - [ ] PRD version mới đã được bump
316
357
  - [ ] Changelog có entry cho thay đổi