@educa-corp/sdd-framework 0.2.4 → 0.2.6

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 (152) hide show
  1. package/commands/generate-architecture.md +706 -0
  2. package/commands/generate-architecture.tmpl +194 -0
  3. package/commands/generate-code.md +35 -9
  4. package/commands/generate-code.tmpl +35 -9
  5. package/commands/generate-tech-docs.md +259 -246
  6. package/commands/generate-tech-docs.tmpl +21 -0
  7. package/core/FRAMEWORK_VERSION +1 -1
  8. package/core/commands/generate-architecture.md +706 -0
  9. package/core/commands/generate-code.md +35 -9
  10. package/core/commands/generate-tech-docs.md +259 -246
  11. package/core/skills/setup-ai-first/SKILL.md +12 -4
  12. package/core/templates/architecture.template.md +392 -111
  13. package/core/templates/tech-design.template.md +238 -246
  14. package/docs/01-getting-started/installation.md +47 -112
  15. package/docs/01-getting-started/quickstart.md +58 -72
  16. package/docs/01-getting-started/what-is-sdd.md +75 -0
  17. package/docs/02-concepts/architecture.md +109 -0
  18. package/docs/02-concepts/glossary.md +87 -0
  19. package/docs/02-concepts/overview.md +93 -0
  20. package/docs/02-concepts/pipeline-steps/00-setup.md +102 -0
  21. package/docs/02-concepts/pipeline-steps/01-discovery.md +129 -0
  22. package/docs/02-concepts/pipeline-steps/02-specification.md +130 -0
  23. package/docs/02-concepts/pipeline-steps/03-design-spec.md +90 -0
  24. package/docs/02-concepts/pipeline-steps/04-bdd.md +120 -0
  25. package/docs/02-concepts/pipeline-steps/05-tech-docs.md +101 -0
  26. package/docs/02-concepts/pipeline-steps/06-code.md +119 -0
  27. package/docs/02-concepts/pipeline-steps/07-dev-selftest.md +92 -0
  28. package/docs/02-concepts/pipeline-steps/08-qc-automation.md +102 -0
  29. package/docs/02-concepts/pipeline-steps/09-validate-traces.md +104 -0
  30. package/docs/02-concepts/pipeline-steps/10-feedback-loop.md +105 -0
  31. package/docs/02-concepts/pipeline-steps/README.md +92 -0
  32. package/docs/02-concepts/roles-and-hitl.md +73 -0
  33. package/docs/02-concepts/traceability.md +94 -0
  34. package/docs/03-guides/architect.md +98 -0
  35. package/docs/03-guides/developer.md +76 -0
  36. package/docs/03-guides/product-owner.md +68 -0
  37. package/docs/03-guides/tester-qa.md +70 -0
  38. package/docs/04-reference/commands.md +105 -0
  39. package/docs/04-reference/configuration.md +94 -0
  40. package/docs/04-reference/model-selection.md +68 -0
  41. package/docs/04-reference/modules.md +74 -0
  42. package/docs/04-reference/trace-schema.md +93 -0
  43. package/docs/README.md +29 -40
  44. package/docs/explain/00-setup-ai-first.md +77 -0
  45. package/docs/explain/00b-generate-architecture.md +76 -0
  46. package/docs/explain/01-define-product.md +79 -0
  47. package/docs/explain/02-generate-prd.md +78 -0
  48. package/docs/explain/03-refine-prd.md +86 -0
  49. package/docs/explain/04-review-context.md +100 -0
  50. package/docs/explain/05-generate-design-spec.md +73 -0
  51. package/docs/explain/06-generate-bdd.md +77 -0
  52. package/docs/explain/07-generate-tech-docs.md +71 -0
  53. package/docs/explain/08-review-tech-docs.md +79 -0
  54. package/docs/explain/09-generate-code.md +78 -0
  55. package/docs/explain/10-review-code.md +70 -0
  56. package/docs/explain/11-map-testids.md +69 -0
  57. package/docs/explain/12-dev-gen-test.md +66 -0
  58. package/docs/explain/13-dev-run-test.md +69 -0
  59. package/docs/explain/14-dev-smoke-test.md +67 -0
  60. package/docs/explain/15-qc-analyze.md +68 -0
  61. package/docs/explain/16-qc-plan.md +61 -0
  62. package/docs/explain/17-qc-design-test.md +61 -0
  63. package/docs/explain/18-qc-review.md +59 -0
  64. package/docs/explain/19-qc-run-test.md +67 -0
  65. package/docs/explain/20-qc-report.md +61 -0
  66. package/docs/explain/21-validate-traces.md +68 -0
  67. package/docs/explain/22-generate-spec-manifest.md +60 -0
  68. package/docs/explain/23-fix-bug.md +69 -0
  69. package/docs/explain/24-debug.md +61 -0
  70. package/docs/explain/25-report-bug.md +65 -0
  71. package/docs/explain/26-propose-scenario.md +63 -0
  72. package/docs/explain/27-learn.md +65 -0
  73. package/docs/explain/28-sync.md +70 -0
  74. package/docs/explain/29-update-framework.md +65 -0
  75. package/docs/explain/README.md +134 -0
  76. package/package.json +1 -1
  77. package/skills/setup-ai-first/SKILL.md +12 -4
  78. package/skills/setup-ai-first/SKILL.tmpl +12 -4
  79. package/templates/architecture.template.md +392 -111
  80. package/templates/tech-design.template.md +238 -246
  81. package/docs/01-getting-started/README.md +0 -19
  82. package/docs/01-getting-started/core-concepts.md +0 -102
  83. package/docs/02-guides/README.md +0 -26
  84. package/docs/02-guides/bdd-input-checklist.md +0 -68
  85. package/docs/02-guides/developer/README.md +0 -49
  86. package/docs/02-guides/developer/bdd-and-trace.md +0 -126
  87. package/docs/02-guides/developer/commands.md +0 -76
  88. package/docs/02-guides/developer/pr-checklist.md +0 -16
  89. package/docs/02-guides/developer/scenarios.md +0 -460
  90. package/docs/02-guides/developer/workflow.md +0 -121
  91. package/docs/02-guides/prd-input-checklist.md +0 -94
  92. package/docs/02-guides/product-owner/README.md +0 -81
  93. package/docs/02-guides/product-owner/commands.md +0 -30
  94. package/docs/02-guides/product-owner/handoff-checklist.md +0 -42
  95. package/docs/02-guides/product-owner/prd-writing-rules.md +0 -45
  96. package/docs/02-guides/product-owner/scenarios.md +0 -438
  97. package/docs/02-guides/tech-docs-input-checklist.md +0 -109
  98. package/docs/02-guides/tester/README.md +0 -75
  99. package/docs/02-guides/tester/bug-reporting.md +0 -117
  100. package/docs/02-guides/tester/qc-automation.md +0 -165
  101. package/docs/02-guides/tester/reading-specs.md +0 -79
  102. package/docs/02-guides/tester/scenarios.md +0 -186
  103. package/docs/02-guides/tester/spec-manifest.md +0 -130
  104. package/docs/02-guides/tester/test-checklist.md +0 -31
  105. package/docs/02-guides/tester/workflow.md +0 -77
  106. package/docs/03-concepts/README.md +0 -20
  107. package/docs/03-concepts/architecture.md +0 -248
  108. package/docs/03-concepts/mechanisms-explained.md +0 -124
  109. package/docs/03-concepts/pipeline.md +0 -278
  110. package/docs/03-concepts/traceability.md +0 -152
  111. package/docs/04-operations/README.md +0 -33
  112. package/docs/04-operations/bug-flow.md +0 -364
  113. package/docs/04-operations/publishing.md +0 -154
  114. package/docs/04-operations/sync-and-update.md +0 -522
  115. package/docs/05-reference/README.md +0 -34
  116. package/docs/05-reference/command-cheatsheet.md +0 -147
  117. package/docs/05-reference/commands.md +0 -234
  118. package/docs/05-reference/model-selection.md +0 -74
  119. package/docs/05-reference/modules.md +0 -110
  120. package/docs/05-reference/trace-schema.md +0 -154
  121. package/docs/06-commands/README.md +0 -75
  122. package/docs/06-commands/explain-debug.md +0 -32
  123. package/docs/06-commands/explain-define-product.md +0 -43
  124. package/docs/06-commands/explain-dev-gen-test.md +0 -28
  125. package/docs/06-commands/explain-dev-run-test.md +0 -24
  126. package/docs/06-commands/explain-dev-smoke-test.md +0 -25
  127. package/docs/06-commands/explain-fix-bug.md +0 -28
  128. package/docs/06-commands/explain-generate-bdd.md +0 -45
  129. package/docs/06-commands/explain-generate-code.md +0 -53
  130. package/docs/06-commands/explain-generate-design-spec.md +0 -54
  131. package/docs/06-commands/explain-generate-prd.md +0 -45
  132. package/docs/06-commands/explain-generate-spec-manifest.md +0 -20
  133. package/docs/06-commands/explain-generate-tech-docs.md +0 -56
  134. package/docs/06-commands/explain-learn.md +0 -21
  135. package/docs/06-commands/explain-map-testids.md +0 -28
  136. package/docs/06-commands/explain-propose-scenario.md +0 -24
  137. package/docs/06-commands/explain-qc-analyze.md +0 -22
  138. package/docs/06-commands/explain-qc-design-test.md +0 -20
  139. package/docs/06-commands/explain-qc-plan.md +0 -21
  140. package/docs/06-commands/explain-qc-report.md +0 -23
  141. package/docs/06-commands/explain-qc-review.md +0 -24
  142. package/docs/06-commands/explain-qc-run-test.md +0 -27
  143. package/docs/06-commands/explain-refine-prd.md +0 -51
  144. package/docs/06-commands/explain-report-bug.md +0 -24
  145. package/docs/06-commands/explain-review-code.md +0 -45
  146. package/docs/06-commands/explain-review-context.md +0 -68
  147. package/docs/06-commands/explain-review-tech-docs.md +0 -45
  148. package/docs/06-commands/explain-setup-ai-first.md +0 -25
  149. package/docs/06-commands/explain-sync.md +0 -24
  150. package/docs/06-commands/explain-update-framework.md +0 -22
  151. package/docs/06-commands/explain-validate-traces.md +0 -25
  152. package/docs/t-sample.md +0 -826
@@ -1,147 +0,0 @@
1
- [📚 Docs](../README.md) › [Reference](README.md) › Command Cheat-Sheet
2
-
3
- # Command Cheat-Sheet — luồng & chọn lệnh
4
-
5
- > Bối rối không biết **chạy lệnh nào, theo thứ tự nào, ai chạy**? Trang này là bản đồ 1 trang. Chi tiết Input/Output từng lệnh: [Command Reference](commands.md).
6
-
7
- - [Luồng end-to-end (ai chạy gì)](#luồng-end-to-end-ai-chạy-gì)
8
- - [Tôi muốn REVIEW thứ này → dùng lệnh nào?](#tôi-muốn-review-thứ-này--dùng-lệnh-nào)
9
- - [Vòng review chuẩn: 3 bước (review → Board → resume)](#vòng-review-chuẩn-3-bước-review--board--resume)
10
- - [Giải mã flag: mặc định vs --fix vs --resume](#giải-mã-flag-mặc-định-vs---fix-vs---resume)
11
- - [QC pipeline — 6 bước tuần tự](#qc-pipeline--6-bước-tuần-tự)
12
- - [dev-* vs qc-* — đừng nhầm](#dev--vs-qc---đừng-nhầm)
13
-
14
- ---
15
-
16
- ## Luồng end-to-end (ai chạy gì)
17
-
18
- Mỗi mũi tên = "xong cái trước mới sang cái sau". Nhãn dưới mỗi lệnh là **vai trò** chạy nó.
19
-
20
- ```mermaid
21
- flowchart LR
22
- A["/define-product<br/><b>PO</b>"] --> B["/generate-prd<br/><b>PO</b>"]
23
- B --> C["/refine-prd<br/><b>PO</b> + Board"]
24
- C --> D["/review-context (PRD)<br/><b>PO</b> · cổng chất lượng"]
25
- D -->|"PO đặt Status: approved"| E["/generate-design-spec<br/><b>PO</b> (chỉ FE/App)"]
26
- E --> F["/generate-bdd<br/><b>PO</b> · web→app→system"]
27
- F --> G["/review-context (BDD)<br/><b>SA/Dev</b>"]
28
- G -->|"đặt @trace.status: approved"| H["/generate-tech-docs<br/><b>Dev</b> · BE trước, FE sau"]
29
- H --> I["/review-tech-docs<br/><b>Dev</b> + Board"]
30
- I --> J["/generate-code<br/><b>Dev</b>"]
31
- J --> K["/review-code<br/><b>Dev</b> · 4 lens"]
32
- K --> L["/dev-gen-test → /dev-run-test<br/><b>Dev</b> · self-check"]
33
- L --> M["/qc-* (6 bước)<br/><b>QC/Tester</b>"]
34
- M --> N["/validate-traces<br/><b>Tech Lead</b>"]
35
- ```
36
-
37
- > **BE bỏ qua Design Spec** (bước E) — đọc PRD trực tiếp rồi `/generate-bdd`. **Full-stack/không tách mock** → `/generate-code` một lần (bỏ qua FE 2-phase). Cross-cutting (`/sync`, `/fix-bug`, `/debug`, `/learn`, `/report-bug`, `/propose-scenario`) chạy bất cứ lúc nào, không nằm trong chuỗi này.
38
-
39
- <details>
40
- <summary>Bản text (ASCII fallback)</summary>
41
-
42
- ```
43
- PO ───────────────────────────────────────────────────────────────────────────
44
- /define-product → /generate-prd → /refine-prd → /review-context(PRD) → PO đặt Status: approved
45
- → /generate-design-spec (FE/App)
46
- → /generate-bdd (web→app→system)
47
- SA/Dev ────────────────────────────────────────────────────────────────────────
48
- /review-context(BDD) → đặt @trace.status: approved → /generate-tech-docs → /review-tech-docs
49
- → /generate-code → /review-code → /dev-gen-test → /dev-run-test
50
- QC/Tester ──────────────────────────────────────────────────────────────────────
51
- /qc-analyze → /qc-plan → /qc-design-test → /qc-review → /qc-run-test → /qc-report
52
- Tech Lead ──────────────────────────────────────────────────────────────────────
53
- /validate-traces
54
- ```
55
- </details>
56
-
57
- ---
58
-
59
- ## Tôi muốn REVIEW thứ này → dùng lệnh nào?
60
-
61
- Có **4 lệnh review** cho **4 loại artifact khác nhau**. Đây là điểm hay nhầm nhất:
62
-
63
- | Tôi muốn review… | Cách dùng (ví dụ) | Nó kiểm cái gì | Ai chạy |
64
- |---|---|---|---|
65
- | **PRD — nội dung & độ đầy đủ** | `/refine-prd specs/auth/login/{TICKET-ID}-login.md` | 3 lens DEV·SA·PO (đọc bằng mắt kỹ thuật, viết bằng lời nghiệp vụ): luồng đủ rõ để build chưa? nhất quán nghiệp vụ? scope & mục tiêu rõ? | PO |
66
- | **PRD — chất lượng trước khi approve** | `/review-context specs/auth/login/{TICKET-ID}-login.md` | P-checks: banned term, mơ hồ, mâu thuẫn PRD khác, thiếu section, routing theo `Domain` (bảng Metadata) | PO |
67
- | **BDD `.feature`** | `/review-context specs/auth/login/bdd/system/FEAT-01-UC1-login.feature` | B-checks: mỗi AC/BR → có ≥1 scenario? Gherkin R1–R10, compliance C1–C5 | SA/Dev |
68
- | **Tech design** | `/review-tech-docs specs/auth/login/tech-docs/FEAT-01-tech-design.md` | T-checks: đúng layer/architecture, entity, trace BDD, cross-team API sign-off | Dev/SA |
69
- | **Code** | `/review-code FEAT-01-UC1` | 4 lăng kính: Traceability · Layer Architecture · Coding Standards · Spec Compliance | Dev |
70
-
71
- > **Vì sao PRD có 2 lệnh review?** `/refine-prd` làm **trước** (cải thiện nội dung, fan-out 3 lens). `/review-context` làm **sau** như **cổng chất lượng cuối** trước khi approve + sang BDD. Thứ tự: `generate-prd → refine-prd → review-context → approve`.
72
- >
73
- > **Vì sao `/review-context` dùng cho cả PRD lẫn BDD?** Nó tự nhận loại theo file: `.md` ở gốc feature folder → PRD mode (P-checks); `.feature` → BDD mode (B-checks). Cùng một "cổng chất lượng", hai bộ tiêu chí.
74
-
75
- ---
76
-
77
- ## Vòng review chuẩn: 3 bước (review → Board → resume)
78
-
79
- Mọi lệnh review (`/refine-prd`, `/review-context`, `/review-tech-docs`) đều chạy **cùng một vòng 3 bước**. Lệnh review **không sửa file** — nó chỉ ghi ra findings; bạn duyệt ở Review Board; rồi `--resume` mới áp dụng.
80
-
81
- ```
82
- ① /refine-prd {file} ② Mở Review Board (extension) ③ /… --resume {file}
83
- ─────────────────────────── ────────────────────────────── ──────────────────────────
84
- PHÂN TÍCH (read-only) → DUYỆT từng finding: → ÁP DỤNG cái đã accept
85
- ghi .agent/review/ ✓Accept ✎Modify ⏸Defer ✗Reject + bump version + reset draft + changelog
86
- {slug}-findings.yaml 💬 Giải thích (nếu khó hiểu)
87
- ```
88
-
89
- - **① không đụng vào file gốc.** An toàn chạy bất cứ lúc nào.
90
- - **② Review Board** = panel của extension *Spec Driven Docs Tools*. Right-click file `*-findings.yaml` → Open Review Board, hoặc bấm thông báo khi findings vừa tạo. Finding khó hiểu → bấm **💬 Giải thích** (no-tech + đề xuất phương án, chờ confirm).
91
- - **③ `--resume`** đọc các finding `accepted`/`modified` và áp vào file gốc, rồi bump version. Nút **⚡ Apply** trên Board tự chạy đúng lệnh `--resume` này cho bạn.
92
-
93
- ---
94
-
95
- ## Giải mã flag: mặc định vs --fix vs --resume
96
-
97
- Cùng một lệnh `/review-context` (và họ review nói chung) có **3 chế độ**. Đây là khác biệt:
98
-
99
- | Chế độ | Lệnh | Làm gì | Khi nào |
100
- |---|---|---|---|
101
- | **Phân tích** (mặc định, không flag) | `/review-context {file}` | Chỉ phân tích → ghi findings. **Không sửa file.** | Bước ① mọi vòng review |
102
- | **`--fix`** | `/review-context --fix {file}` | Phân tích **rồi tự áp ngay** các finding `auto_fixable` (banned term, metadata, coverage matrix…). Bỏ qua Board. | Dev muốn dọn nhanh lỗi máy-sửa-được, không cần người quyết |
103
- | **`--resume`** | `/review-context --resume {file}` | **Không phân tích lại.** Đọc findings file, áp các finding **người đã accept** ở Board. | Bước ③ sau khi duyệt ở Board |
104
-
105
- > **Nhớ nhanh:** `--fix` = "máy tự sửa cái an toàn **ngay**" · `--resume` = "áp cái **tôi đã duyệt**". Không flag = "chỉ xem, đừng động vào file".
106
-
107
- ---
108
-
109
- ## QC pipeline — 6 bước tuần tự
110
-
111
- QC là **chuỗi 6 lệnh chạy theo thứ tự** sau khi BDD `@trace.status: approved`. Output bước trước là input bước sau:
112
-
113
- ```
114
- /qc-analyze → /qc-plan → /qc-design-test → /qc-review → /qc-run-test → /qc-report
115
- scope test test-case duyệt chạy + report
116
- + gaps plan chi tiết TC/script qc_status HTML
117
- ```
118
-
119
- | # | Lệnh | Ra cái gì |
120
- |---|---|---|
121
- | 1 | `/qc-analyze` | `REQUIREMENT_ANALYSIS.md` + `DOC_GAPS.md` |
122
- | 2 | `/qc-plan` | `TEST_PLAN.md` (scope, layer, ưu tiên) |
123
- | 3 | `/qc-design-test` | `test-cases/*.Test.md` |
124
- | 4 | `/qc-review` | Verdict APPROVED / NEEDS_FIX (inline) |
125
- | 5 | `/qc-run-test` | Script Python + ghi `qc_status` vào trace TSV |
126
- | 6 | `/qc-report` | `report.html` (Playwright trace + pytest-html) |
127
-
128
- > Chi tiết: [chương QC Automation](../02-guides/tester/qc-automation.md). Stack `qc-playwright`, độc lập với module code của dev.
129
-
130
- ---
131
-
132
- ## dev-* vs qc-* — đừng nhầm
133
-
134
- Hai luồng test **tách biệt**, ghi **hai cột khác nhau** trong trace TSV:
135
-
136
- | | `/dev-*` (dev self-check) | `/qc-*` (QC chính thức) |
137
- |---|---|---|
138
- | Ai chạy | **Dev** — tự kiểm code mình | **QC/Tester** |
139
- | Lệnh | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` | `/qc-analyze` … `/qc-report` (6 bước) |
140
- | Ghi signal | `dev_selftest` (pass/fail/not_run) | `qc_status` (pass/fail/skip/not_run) |
141
- | Là coverage chính thức? | **KHÔNG** — chỉ tín hiệu "dev đã smoke" | **CÓ** — coverage authoritative |
142
-
143
- > Cả hai hiển thị **cạnh nhau** trong Living Docs. `dev_selftest: pass` **không** thay thế QC. Xem [Traceability](../03-concepts/traceability.md#hai-tín-hiệu-test-dev_selftest-vs-qc_status).
144
-
145
- ---
146
-
147
- *Xem thêm:* [Command Reference (chi tiết)](commands.md) · [Concepts › Pipeline](../03-concepts/pipeline.md) · [Developer › Workflow](../02-guides/developer/workflow.md)
@@ -1,234 +0,0 @@
1
- [📚 Docs](../README.md) › [Reference](README.md) › Command Reference
2
-
3
- # Command Reference
4
-
5
- > Mọi slash command của framework, gom theo phase. Mỗi command kèm **Cách dùng (ví dụ cụ thể)**, **Output**, và **When to use**. Phần cuối mô tả **Command Internals** — kiến trúc step file dùng chung bởi mọi command.
6
- >
7
- > Ví dụ dùng chung một feature xuyên suốt: domain `auth`, ticket `FEAT-01`, use case `FEAT-01-UC1` (đăng nhập). Thay bằng file/UC-ID của bạn.
8
-
9
- ---
10
-
11
- ## Mục lục
12
-
13
- - [Setup & Maintenance](#setup--maintenance)
14
- - [Phase 1 — Discovery](#phase-1--discovery)
15
- - [Phase 2 — PRD](#phase-2--prd)
16
- - [Phase 2b — Design Spec (FE/App)](#phase-2b--design-spec-feapp)
17
- - [Phase 3 — BDD Spec](#phase-3--bdd-spec)
18
- - [Phase 4 — Tech Design](#phase-4--tech-design)
19
- - [Phase 5 — Code](#phase-5--code)
20
- - [Phase 6 — Dev Self-Check](#phase-6--dev-self-check)
21
- - [Phase 6b — QC Automation (official QC suite)](#phase-6b--qc-automation-official-qc-suite)
22
- - [Phase 7 — Traceability Audit](#phase-7--traceability-audit)
23
- - [Phase 8 — Tester / QC Feedback](#phase-8--tester--qc-feedback)
24
- - [Debugging & Cross-cutting](#debugging--cross-cutting)
25
- - [Command Internals — Step Architecture](#command-internals--step-architecture)
26
-
27
- > **Lưu ý số phase:** README dùng cả "Phase 5b / Phase 6b" (sơ đồ workflow) và "Phase 6b" (bảng tổng quan) cho QC Automation. Ở đây dùng nhãn **Phase 6b** cho QC suite để khớp bảng "Phase overview". Dù số khác nhau, ý nghĩa không đổi: QC suite là pipeline `/qc-*` riêng biệt với dev self-check `/dev-*`.
28
-
29
- ---
30
-
31
- ## Setup & Maintenance
32
-
33
- | Command | Cách dùng (ví dụ) | Output | When to use |
34
- |---------|-------------------|--------|-------------|
35
- | `/setup-ai-first` | `/setup-ai-first` | Project structure + config files | First-time project setup |
36
- | `/sync` | `/sync` | Git pull + submodule update + Living Docs sync | **Daily driver** — đồng bộ *nội dung* project (code/specs trong submodule) |
37
- | `/update-framework` | `/update-framework` | Refreshed `.agent/` command files from npm | **Occasionally** — nâng cấp *bản thân framework* khi có version mới |
38
- | `/sync-figma-components {module}` | `/sync-figma-components react` | Updated `figma-components/{module}.md` | After Figma design system changes |
39
- | `/sync-figma-tokens {url?}` | `/sync-figma-tokens` *(hoặc kèm URL Figma)* | Updated `figma-tokens.md` | After design token changes |
40
-
41
- > **`/sync` vs `/update-framework` là hai thứ khác nhau:**
42
- > - `/sync` cập nhật **nội dung project** — pull code/specs mới từ git remote + refresh Living Docs. Nguồn = git remotes của bạn. Chạy thường xuyên.
43
- > - `/update-framework` cập nhật **framework tooling** — refresh `.agent/commands/`, `steps/`, `modules/` lên version mới nhất. Nguồn = npm registry. Chạy hiếm. Không bao giờ đụng `project-context.yaml`, `CLAUDE.md`, domain-knowledge, hay `.trace/`.
44
-
45
- ---
46
-
47
- ## Phase 1 — Discovery
48
-
49
- | Command | Cách dùng (ví dụ) | Output | When to use |
50
- |---------|-------------------|--------|-------------|
51
- | `/define-product` | `/define-product` | `specs/product-definition/{TICKET-ID}-{slug}.md` | Starting any new feature. AI dẫn PO qua 7 phase Q&A có cấu trúc — không cần spec viết sẵn. |
52
-
53
- ---
54
-
55
- ## Phase 2 — PRD
56
-
57
- | Command | Cách dùng (ví dụ) | Output | When to use |
58
- |---------|-------------------|--------|-------------|
59
- | `/generate-prd` | `/generate-prd specs/product-definition/FEAT-01-login.md` | `specs/{domain}/{prd-slug}/{TICKET-ID}-{prd-slug}.md` | After define-product. Thêm `API Source: existing` + section "Existing API Contract" cho feature brownfield. |
60
- | `/refine-prd` | `/refine-prd specs/auth/login/{TICKET-ID}-login.md` | `.agent/review/{prd-slug}-findings.yaml` | After generate-prd — fan-out 3 review lens (DEV/SA/PO) + completeness-critic loop, mở Review Board. |
61
- | `/refine-prd --resume` | `/refine-prd --resume specs/auth/login/{TICKET-ID}-login.md` | Applied findings + bumped version | Sau khi review trong Review Board (nút ⚡ Apply tự chạy lệnh này). |
62
- | `/review-context` (PRD) | `/review-context specs/auth/login/{TICKET-ID}-login.md` | `.agent/review/{prd-slug}-review-context-findings.yaml` | Quality gate trước Phase 3. Checks: routing P0 (umbrella), banned terms (P1), ambiguity (P2), conflicts (P3), completeness (P4), custom (P5). 0 critical → PO đặt `Status: approved`. `--fix`/`--resume` reset Status→draft khi sửa PRD. |
63
- | `/review-context --fix` | `/review-context --fix specs/auth/login/{TICKET-ID}-login.md` | Applies all auto-fixable findings immediately | Dev quick-fix, không cần Review Board. |
64
- | `/review-context --resume` | `/review-context --resume specs/auth/login/{TICKET-ID}-login.md` | Applies accepted findings + bump version | PO/SA review — human quyết từng finding. |
65
-
66
- > **Change Log gọn (rolling-window):** PRD chỉ giữ **5 version gần nhất** trong `# Change Log` (bảng phẳng 1 dòng/version); lịch sử cũ hơn được `/refine-prd` & `/review-context` tự dồn sang `changelog/{TICKET-ID}-{prd-slug}.changelog.md` (thư mục con của feature-package). Nhờ vậy PRD **không phình** theo các vòng refine, Dev/QC khỏi nạp lịch sử thừa vào context. `/generate-bdd` đọc 5 row gần để bắt drift; nếu BDD cũ hơn cửa sổ này → khuyến nghị gen lại toàn bộ (F).
67
-
68
- ---
69
-
70
- ## Phase 2b — Design Spec (FE/App)
71
-
72
- | Command | Cách dùng (ví dụ) | Output | When to use |
73
- |---------|-------------------|--------|-------------|
74
- | `/generate-design-spec` | `/generate-design-spec specs/auth/login/{TICKET-ID}-login.md` | `specs/{domain}/{prd-slug}/design-spec/{TICKET-ID}-design-spec-{platform}-{slug}.md` | FE/App: sau khi PRD approved (guard mềm), trước BDD. Ghi `Built from PRD: vX` (phát hiện lỗi thời); re-run có Version Check theo PRD. PO cấp **node-level Figma frame link** (`?node-id=`) cho mỗi screen; AI fetch từng frame qua Figma MCP. Screen thiếu link → ❌ Missing, Status giữ `draft`. **Self-Review Gate** tự rà trước khi ghi; `/generate-bdd` chỉ **cảnh báo mềm** nếu design-spec chưa approved. |
75
-
76
- > BE teams bỏ qua Phase 2b — đọc PRD trực tiếp rồi `/generate-bdd`.
77
-
78
- ---
79
-
80
- ## Phase 3 — BDD Spec
81
-
82
- | Command | Cách dùng (ví dụ) | Output | When to use |
83
- |---------|-------------------|--------|-------------|
84
- | `/generate-bdd` | `/generate-bdd specs/auth/login/{TICKET-ID}-login.md` | `specs/{domain}/{prd-slug}/bdd/{UC-ID}.feature` (multi-service: `{prd-slug}/bdd/{service}/{UC-ID}.feature`) | After PRD approved (+ Design Spec sign-off cho FE/App). Đọc Service/Module từ PRD metadata, áp platform vocabulary, hiện SC outline chờ confirm. **Thứ tự outside-in: web → app → system**; `system` **tổng hợp từ web+app BDD** (web&app lệch contract → CHECKPOINT chọn union/platform-hint/separate-endpoints, ghi `@system.resolution:`; chỉ-BE → từ PRD). PRD lớn (>3 UC hoặc >300 dòng) → orchestration mode (1 sub-agent / UC). FE/App: nuốt AC-UI + Screen States từ design-spec (gate approved+fresh+sanity). Proposal tester: chỉ nạp `Status: accepted` rồi lưu trữ. |
85
- | `/review-context` (BDD) | `/review-context specs/auth/login/bdd/system/FEAT-01-UC1-login.feature` | `.agent/review/{uc-id}-review-bdd-findings.yaml` | Quality gate trước Phase 4. Checks: PRD coverage (mỗi AC + BR → ≥1 SC), Gherkin R1–R10, compliance C1–C5. 0 critical → đặt `@trace.status: approved`. |
86
- | `/review-context --fix` | `/review-context --fix specs/auth/login/bdd/web/FEAT-01-UC1-login.feature` | Auto-fix terminology, metadata, coverage matrix + reset `@trace.status` & `uc_status` → draft | Dev quick-fix. |
87
- | `/review-context --resume` | `/review-context --resume specs/auth/login/bdd/system/FEAT-01-UC1-login.feature` | Applies accepted findings + bump bdd_version + reset `@trace.status` & `uc_status` → draft | SA review. |
88
-
89
- ---
90
-
91
- ## Phase 4 — Tech Design
92
-
93
- | Command | Cách dùng (ví dụ) | Output | When to use |
94
- |---------|-------------------|--------|-------------|
95
- | `/generate-tech-docs` | `/generate-tech-docs specs/auth/login/bdd/system/FEAT-01-UC1-login.feature` | **1 doc full-stack/PRD**: `specs/{domain}/{prd-slug}/tech-docs/{TICKET-ID}-tech-design.md` | After BDD approved. **Input = 1..n file BDD tech lead trỏ** (batch, cảnh báo >5), gộp vào doc chung của PRD (append qua nhiều lần chạy). Doc chứa API contract (§4.1–§4.4) + client design (§4.5 component/state/API-map/**§4.5.6 Test Selectors** per platform) + §5 sequence xuyên tầng. Brownfield (`@trace.api_source: existing`) → reverse-document phần API. |
96
- | `/map-testids {UC-ID}` | `/map-testids FEAT-01-UC1` | Cập nhật §4.5.6 Test Selectors trong tech-doc gộp + patch forwarding/usage-site + ghi `figma-components/{module}.md` | FE/App, cho component **reuse** / code **có sẵn** (brownfield): reverse-document id đang có, gán id còn thiếu, đảm bảo component dùng chung forward được test-id. Bổ trợ cho `/generate-tech-docs` (chỉ gán id cho code mới). |
97
- | `/review-tech-docs` | `/review-tech-docs specs/auth/login/tech-docs/FEAT-01-tech-design.md` | `.agent/review/{TICKET-ID}-tech-review-findings.yaml` | After generate-tech-docs — mở Review Board. Review cả doc/PRD (findings gom theo UC). |
98
- | `/review-tech-docs --resume` | `/review-tech-docs --resume specs/auth/login/tech-docs/FEAT-01-tech-design.md` | Applies accepted findings + bump revision | Sau khi review trong Review Board. |
99
-
100
- ---
101
-
102
- ## Phase 5 — Code
103
-
104
- | Command | Cách dùng (ví dụ) | Output | When to use |
105
- |---------|-------------------|--------|-------------|
106
- | `/generate-code` | `/generate-code specs/auth/login/bdd/system/FEAT-01-UC1-login.feature` | `src/...` (tags `@trace.implements`) | After tech-design approved. Guard mềm: BDD `@trace.status` approved; FE/App design-spec approved+fresh+sanity. Default = full impl/BE. |
107
- | `/generate-code --phase=ui` | `/generate-code --phase=ui specs/auth/login/bdd/web/FEAT-01-UC1-login.feature` | UI + mock API adapter | FE: BE chưa sẵn sàng — sinh UI + mock adapter. Mock **shape**: BE contract nếu có (chuẩn) → else System BDD + warn; fixture values luôn từ System BDD. Tester test FE ngay được. |
108
- | `/generate-code --phase=integration` | `/generate-code --phase=integration specs/auth/login/bdd/web/FEAT-01-UC1-login.feature` | Wires real API | FE: sau khi T7 sign-off gate approved — thay mock adapter bằng real API calls. |
109
- | `/review-code` | `/review-code FEAT-01-UC1` | Review report: Critical / Major / Minor | After generate-code. Check: mỗi scenario có endpoint, trace tags, layer rules, error handling khớp CLAUDE.md §5. Fix CRITICAL + MAJOR trước khi merge. |
110
-
111
- ---
112
-
113
- ## Phase 6 — Dev Self-Check
114
-
115
- > Đây là **developer self-check / smoke** — dev tự kiểm tra code mình vừa sinh ra. **Không phải** official QC suite (đó là Phase 6b `/qc-*`). Signal = `dev_selftest`, tách biệt với `qc_status`.
116
-
117
- | Command | Cách dùng (ví dụ) | Output | When to use |
118
- |---------|-------------------|--------|-------------|
119
- | `/dev-gen-test` | `/dev-gen-test specs/auth/login/bdd/system/FEAT-01-UC1-login.feature` | `src/test/...` (tags `@trace.verifies`) | After generate-code. Tự chọn test framework đúng platform. |
120
- | `/dev-run-test` | `/dev-run-test FEAT-01-UC1` | Self-check report — ghi `dev_selftest` (pass/fail/not_run) + `dev_selftest_at` vào trace TSV | After dev-gen-test. |
121
- | `/dev-smoke-test` | `/dev-smoke-test FEAT-01-UC1` | Live endpoint check | Optional — sau deploy. |
122
-
123
- ---
124
-
125
- ## Phase 6b — QC Automation (official QC suite)
126
-
127
- > Pipeline `/qc-*` **là** official QC suite. Chạy **theo thứ tự** sau khi BDD `@trace.status: approved` (review-context BDD sạch + người duyệt; `/qc-analyze` cảnh báo mềm nếu chưa). Tách biệt hoàn toàn với dev self-check: QC sở hữu `qc_status`, dev sở hữu `dev_selftest`. `/qc-run-test` & `/qc-report` dùng module `qc-playwright`, độc lập với dev implementation module. Xem [../02-guides/tester/qc-automation.md](../02-guides/tester/qc-automation.md).
128
-
129
- | Command | Cách dùng (ví dụ) | Output | When to use |
130
- |---------|-------------------|--------|-------------|
131
- | `/qc-analyze` | `/qc-analyze FEAT-01-UC1` | **2 file** trong `{qc_dir}/{UC-ID}/` (mặc định `docs/`): `REQUIREMENT_ANALYSIS.md` (gộp requirement + BR + data-flow + AC) + `DOC_GAPS.md` | After BDD `@trace.status: approved` (guard mềm) — đầu pipeline QC. |
132
- | `/qc-plan` | `/qc-plan FEAT-01-UC1` | `{qc_dir}/{UC-ID}/TEST_PLAN.md` (scope, layers, priorities, questions-for-dev) | After `/qc-analyze`. |
133
- | `/qc-design-test` | `/qc-design-test FEAT-01-UC1` | `{qc_dir}/{UC-ID}/test-cases/*.Test.md` mapped to `{UC-ID}-SC{N}` | After `/qc-plan`. |
134
- | `/qc-review` | `/qc-review FEAT-01-UC1` | Verdict APPROVED / NEEDS_FIX + findings (**inline — không sinh file**) | After `/qc-design-test` (test-case) hoặc `/qc-run-test` (script). |
135
- | `/qc-run-test` | `/qc-run-test FEAT-01-UC1` | Script Python (`pages/`, `tests/`) + ghi `qc_status` (pass/fail/skip/not_run) + `qc_run_at` vào trace TSV, keyed by `@trace.verifies={UC-ID}-SC{N}` | After `/qc-review`. |
136
- | `/qc-report` | `/qc-report FEAT-01-UC1` | QC report `reports/<feature>/report.html` (Playwright Trace + pytest-html) | After `/qc-run-test`. |
137
-
138
- ---
139
-
140
- ## Phase 7 — Traceability Audit
141
-
142
- | Command | Cách dùng (ví dụ) | Output | When to use |
143
- |---------|-------------------|--------|-------------|
144
- | `/validate-traces {domain}` | `/validate-traces auth` *(hoặc `/validate-traces FEAT-01-UC1`)* | Coverage matrix + drift report + `trace-report.json` | Anytime — verify traceability. Đọc mọi `.trace/{domain}/{prd-slug}/{UC-ID}-{platform}.tsv` rồi tính status OK / DRIFT / GAP / UNTRACKED. |
145
-
146
- ---
147
-
148
- ## Phase 8 — Tester / QC Feedback
149
-
150
- > Cả hai đều **read-only trên canonical specs/code**. Chúng chỉ ghi vào `feedback/` của shared spec repo và **commit + push** → PO/Dev thấy qua `/sync`. Tester/QC không bao giờ sửa `.feature` trực tiếp. QC cũng dùng hai lệnh này: `/qc-run-test` FAIL = product-gap và `/qc-analyze` DOC_GAPS blocker đều route sang `/report-bug` hoặc `/propose-scenario` (xem [../02-guides/tester/qc-automation.md](../02-guides/tester/qc-automation.md)).
151
-
152
- | Command | Cách dùng (ví dụ) | Output | When to use |
153
- |---------|-------------------|--------|-------------|
154
- | `/report-bug {UC-ID} {desc}` | `/report-bug FEAT-01-UC1 "nhập sai mật khẩu vẫn đăng nhập được"` | `{spec_repo}/feedback/bug-reports/{BUG-ID}.md` + spec context + layer classification | Tester hoặc QC tìm thấy bug (gồm QC product-gap). Phân loại layer (Code/BDD/PRD/Design/Env) để route. |
155
- | `/propose-scenario {UC-ID} {desc}` | `/propose-scenario FEAT-01-UC1 "khoá tài khoản sau 5 lần sai mật khẩu"` | `{spec_repo}/feedback/bdd-proposals/{UC-ID}-*.md` draft Gherkin (mang `Status: proposed`) | Tester hoặc QC tìm thấy edge case BDD chưa cover. Map vào PRD AC sẵn có, hoặc emit PRD change request nếu hành vi thực sự mới. Vòng đời: `proposed` → PO/Dev đặt `accepted` → `/generate-bdd` nạp rồi đặt `incorporated` + lưu trữ. |
156
-
157
- ---
158
-
159
- ## Debugging & Cross-cutting
160
-
161
- | Command | Cách dùng (ví dụ) | Output | When to use |
162
- |---------|-------------------|--------|-------------|
163
- | `/fix-bug {BUG-ID\|ticket\|desc}` | `/fix-bug BUG-012` *(hoặc ticket / mô tả lỗi)* | Code fix trên branch + regression test; nếu nhận `{BUG-ID}` → set report State `🟢 Open` → `🟡 Fixed` (QC re-verify pass mới → `🟢 Closed`) | Khi tìm thấy bug/ticket, hoặc route một filed bug report. |
164
- | `/debug` | `/debug "NullPointerException ở LoginService"` | Debug session | Deep debugging. |
165
- | `/learn {text}` | `/learn "AI hay dùng var, phải dùng const"` | Appends guardrail vào project lessons file | Khi AI lặp lại lỗi bạn muốn chặn. |
166
- | `/generate-spec-manifest` | `/generate-spec-manifest` | `spec-manifest.yaml` | Sinh manifest làm entry point cho external/tester agents. |
167
-
168
- > **Project Lessons:** lessons lưu ở `paths.lessons_file` (default `specs/domain-knowledge/lessons-learned.md`; per-service `.agent/project-lessons.md` trong umbrella mode). Context-loader **Step 6.7** load mọi lesson đầu **mỗi** command như hard constraint. Đây là *project memory*, không phải fine-tuning model.
169
-
170
- ---
171
-
172
- ## Command Internals — Step Architecture
173
-
174
- Mọi command trong `.agent/commands/` được compose từ **step file** dùng chung trong `.agent/steps/`. Các step này là nền móng — mọi command gọi chúng tuần tự trước khi chạy logic riêng.
175
-
176
- ### Step files at a glance
177
-
178
- | File | Role | Called by |
179
- |------|------|-----------|
180
- | `gate.md` | Universal entry — model check, file resolution, context load, user checkpoint | Every command |
181
- | `context-loader.md` | Multi-step context loading (stack → service routing → service conventions → arch → safety → domain → UI → recap) | `gate.md` Step 2 |
182
- | `spawn-agent.md` | Sub-agent orchestration cho PRD lớn | `generate-bdd`, `generate-code`, `dev-gen-test` |
183
- | `capture-lesson.md` | Append/refine guardrail vào project lessons file | `learn`, `review-code`, `fix-bug`, `debug` |
184
- | `report-footer.md` | Standard output format (status badge, artifact list, next command) | Every command |
185
-
186
- ### gate.md — Universal Entry Procedure
187
-
188
- | Step | What it does |
189
- |------|-------------|
190
- | **Step 0** | Sub-agent mode check — nếu `$ARGUMENTS` là JSON payload có `_agent_mode: true`, skip Steps 1–3 và dùng slim context trực tiếp |
191
- | **Step 0-B** | Model check — prompt chuyển sang `claude-opus`; `S` để skip |
192
- | **Step 1** | Resolve target file từ `$ARGUMENTS`; nếu thiếu, list candidates và hỏi user |
193
- | **Step 2** | Execute `context-loader.md` — load mọi project context vào working memory |
194
- | **Step 3** | CHECKPOINT — hiện summary (target file, stack, module, domains), chờ `Y` |
195
-
196
- ### context-loader.md — Context Loading Sequence
197
-
198
- Load context theo thứ tự ưu tiên nghiêm ngặt (anti-lost-in-middle: facts critical load trước, RECAP restate cuối):
199
-
200
- | Step | Priority | What loads |
201
- |------|----------|-----------|
202
- | 1 | PROJECT-CONFIG | `project-context.yaml` → stack, conventions, domains, services, paths |
203
- | 1.5 | SERVICE ROUTING | *(umbrella only)* detect active domain, route `trace_dir` (+ code) → service submodule, store `service_root`. Khi `spec_source` set: `specs_dir` (BDD) / `tech_docs_dir` / PRD / design-spec / domain-knowledge / feedback → **spec repo** (cross-team), KHÔNG per-service |
204
- | 1.6 | SERVICE CONVENTIONS | *(umbrella only)* load `{service_root}/.agent/project-context.yaml` → override `test_command`, `build_command`, `paths.trace_dir` |
205
- | 2 | PROJECT-CONFIG | `.agent/modules/{module}/stack-profile.yaml` → framework-specific layer patterns |
206
- | 3 | **CRITICAL** | `CLAUDE.md` → architecture layers, coding standards, naming |
207
- | 4 | SAFETY | `.agent/rules/data-protection.md` → sensitive file patterns |
208
- | 5 | DOMAIN | `business-dictionary.md` → canonical + banned terms |
209
- | 6 | DOMAIN | `core-entities.md` → entity catalog |
210
- | 6.7 | **GUARDRAILS** | `lessons_file` → accumulated lessons (via `/learn`) as hard constraints |
211
- | 6-B | UI COMPONENTS | `figma-components/{module}.md` → Figma → code component + import path |
212
- | 6-C | UI TOKENS | `figma-tokens.md` → design tokens |
213
- | 7 | **RECAP** | `[CTX LOADED]` block printed để khóa critical facts vào working memory |
214
-
215
- Status values của RECAP: `FULL` · `PARTIAL — missing: {list}` · `MINIMAL` (chỉ project-context.yaml).
216
-
217
- ### spawn-agent.md — Sub-Agent Orchestration
218
-
219
- Khi PRD vượt ngưỡng complexity, `generate-bdd` / `generate-code` / `dev-gen-test` tự chuyển từ single-session sang orchestration mode.
220
-
221
- | Signal | Threshold | Action |
222
- |--------|-----------|--------|
223
- | UC count in PRD | > 3 UCs | Spawn 1 sub-agent per UC |
224
- | PRD length | > 300 lines | Spawn agents regardless of UC count |
225
-
226
- Orchestrator: Step A build slim context JSON → Step B scan PRD → UC list → Step C announce plan → Step D spawn 1 sub-agent/UC (parallel, mỗi agent chỉ đọc UC section của mình) → Step E collect + merge results.
227
-
228
- ### report-footer.md — Standard Output Format
229
-
230
- Mọi command kết thúc bằng footer: `Status` badge (`✅ Complete` · `⚠️ Warnings` · `❌ Failed`), danh sách **Output Artifacts** (created/updated), và field **Next** gợi ý command kế tiếp.
231
-
232
- ---
233
-
234
- *Xem thêm:* [Trace TSV Schema](trace-schema.md) · [Stack Modules](modules.md) · [02 · Guides](../02-guides/) (theo vai trò).
@@ -1,74 +0,0 @@
1
- # Chọn model cho từng step (Opus vs Sonnet)
2
-
3
- > Bảng khuyến nghị model chạy cho mỗi command trong pipeline. Mục tiêu: **đặt Opus đúng chỗ đắt giá** (nơi một quyết định sai làm hỏng code/spec thật) và **để Sonnet gánh phần cơ học** (điền template, chấm luật, chạy lệnh, tổng hợp). Không phải "to hơn cho chắc" — chọn theo bản chất công việc.
4
-
5
- ## Nguyên tắc chọn
6
-
7
- **Dùng Opus khi step có BẤT KỲ dấu hiệu nào dưới đây:**
8
-
9
- 1. **Ghi/sửa artifact khó đảo** — code thật hoặc spec có thẩm quyền (PRD, tech-doc). Sai là mất công truy vết/khôi phục.
10
- 2. **Phải hoà giải với bối cảnh có sẵn** — không clobber code UC khác, không đẻ package trùng, ghi **superset**. Cần giữ trạng thái hiện có trong đầu rồi suy giao phần.
11
- 3. **Tổng hợp / khử mơ hồ** — biến input mơ hồ thành quyết định đã chốt (discovery → PRD, PRD → tech design).
12
- 4. **Rủi ro bịa** — phải phân biệt "suy được từ nguồn" vs "khai [GAP], KHÔNG bịa". Đây là chỗ Sonnet hay tự chế cho liền mạch.
13
- 5. **Truy nguyên nhân gốc** — debug, fix-bug: đọc triệu chứng → lần ra nguyên nhân thật.
14
-
15
- **Sonnet là đủ khi step chủ yếu là:**
16
-
17
- - Điền template theo ánh xạ nguồn→đích rõ ràng.
18
- - Chấm luật / checklist (trích ID vi phạm, tính status theo công thức).
19
- - Đọc-thuần: report, tổng hợp, bookkeeping trace/TSV.
20
- - Chạy lệnh và thuật lại output.
21
-
22
- > **Bằng chứng thực nghiệm:** ba bug nặng nhất của project này (clobber code UC trước, package fragmentation, hardcode) đều xảy ra ở **generate-code** khi chạy model yếu — chúng là lỗi *suy luận về bối cảnh*, không phải lỗi cú pháp. Guard cơ học (Guard sau-ghi, `_seams.tsv`, Self-Review Gate) giảm rủi ro nhưng vẫn cần model đủ sức **chủ động chấp hành**, không đọc cho có.
23
-
24
- ## Bảng tra nhanh
25
-
26
- ### 🔴 Opus — bước quyết định, ghi artifact khó đảo
27
-
28
- | Command | Vì sao Opus |
29
- |---|---|
30
- | `generate-code` | Ghi code thật; phải EXTEND superset (không clobber UC khác), quyết định nối hàng thật vs đẻ stub (seam), khớp package by-layer, không hardcode. Ca đắt giá nhất. |
31
- | `generate-tech-docs` | Tech design gộp full-stack; rủi ro bịa/thiếu cao (retro đã flag). Self-Review Gate + GAP Register chỉ hiệu quả khi model đủ sức tự bác bỏ mình. |
32
- | `fix-bug` | Sửa code thật theo nguyên nhân gốc; cùng rủi ro clobber như generate-code. |
33
- | `debug` | Truy nguyên nhân gốc từ triệu chứng — suy luận nhiều tầng. |
34
- | `generate-prd` | Tổng hợp discovery → PRD; khử mơ hồ, chốt scope/business rules mà hạ nguồn bám theo. |
35
- | `refine-prd` | Phê bình 3-lens; giá trị nằm ở chất lượng chỉ trích, không phải điền chữ. |
36
- | `review-tech-docs` | T1–T9 gồm reconciliation + gap-honesty; phải bắt được chỗ tech-doc bịa/thiếu. |
37
- | `define-product` | Đặt nền product-definition — sai lệch lan xuống toàn bộ pipeline. Ít chạy nhưng đòn bẩy cao. |
38
-
39
- ### 🟡 Tùy độ phức tạp — mặc định Sonnet, nâng Opus khi domain khó
40
-
41
- | Command | Mặc định | Nâng Opus khi |
42
- |---|---|---|
43
- | `generate-design-spec` | Sonnet | Luồng UI/UX nhiều nhánh, ràng buộc trạng thái phức tạp. |
44
- | `generate-bdd` | Sonnet | Domain nhiều edge/nhánh lỗi khó suy từ PRD. |
45
- | `review-context` | Sonnet | Cần đánh giá sâu độ phủ scenario, không chỉ liệt kê. |
46
- | `review-code` | Sonnet | Review logic/nghiệp vụ (không chỉ chấm CV/BR style). |
47
- | `propose-scenario` | Sonnet | Sinh scenario cho nghiệp vụ nhiều biến thể. |
48
- | `qc-analyze` | Sonnet | Phân tích rủi ro test sâu, không chỉ phân loại. |
49
- | `qc-review` | Sonnet | Đánh giá chất lượng test-case cần suy luận. |
50
-
51
- ### 🟢 Sonnet là đủ — cơ học, chấm luật, đọc-thuần
52
-
53
- | Command | Bản chất |
54
- |---|---|
55
- | `dev-gen-test` | Sinh test từ BDD — ánh xạ scenario→test khá thẳng. |
56
- | `dev-run-test` · `dev-smoke-test` · `qc-run-test` | Chạy test, thuật output. |
57
- | `qc-plan` · `qc-design-test` · `qc-report` | Điền plan/case/report theo khuôn. |
58
- | `map-testids` | Ánh xạ test-id. |
59
- | `validate-traces` | Tính status theo công thức + Seam Audit theo luật rõ. |
60
- | `generate-spec-manifest` | Tổng hợp manifest cơ học. |
61
- | `review-code` (style) | Trích ID vi phạm CV/BR — chấm luật. |
62
- | `sync` · `update-framework` · `setup-ai-first` | Thao tác file/scaffold theo quy trình. |
63
- | `report-bug` · `learn` | Điền báo cáo / tra cứu. |
64
-
65
- > **Truly trivial** (`report-bug`, `generate-spec-manifest`, `sync`): Haiku cũng chạy được nếu cần tiết kiệm — nhưng lợi ích so với Sonnet không đáng kể.
66
-
67
- ## Ngoại lệ đáng nhớ
68
-
69
- - **generate-code trên greenfield cô lập → Sonnet ổn.** Khi UC đầu tiên của module trống: không sibling code, không seam ra ngoài, không EXTEND file có sẵn → không có gì để clobber. Hễ **module đã có code UC khác** (đúng tình huống segment-service) → về lại Opus.
70
- - **review-* nói chung**: nếu chỉ chấm checklist cơ học thì Sonnet đủ; nếu là "cổng chặn merge" mà bỏ sót gây hậu quả thật → Opus.
71
-
72
- ## Tóm tắt một dòng
73
-
74
- **Ghi code/spec khó đảo hoặc phải hoà giải bối cảnh → Opus. Điền khuôn, chấm luật, chạy lệnh, tổng hợp → Sonnet.**
@@ -1,110 +0,0 @@
1
- [📚 Docs](../README.md) › [Reference](README.md) › Stack Modules
2
-
3
- # Stack Modules
4
-
5
- > Mỗi module dưới `modules/` ship một `stack-profile.yaml` chứa layer pattern, naming rule, và test pattern riêng cho framework đó. Framework detect platform type từ `tech_stack.module` (hoặc `active_module` trong multi-service) và adapt mọi artifact sinh ra.
6
-
7
- ---
8
-
9
- ## Mục lục
10
-
11
- - [Danh sách module](#danh-sách-module)
12
- - [Platform type grouping](#platform-type-grouping)
13
- - [qc-playwright — QC automation stack](#qc-playwright--qc-automation-stack)
14
-
15
- ---
16
-
17
- ## Danh sách module
18
-
19
- 15 module (xác minh bằng listing thư mục `modules/`):
20
-
21
- | Module | Language / Framework | Platform type |
22
- |--------|----------------------|---------------|
23
- | `java-spring` | Java + Spring Boot | backend |
24
- | `golang` | Go + Gin/Echo | backend |
25
- | `dotnet` | C# + .NET / ASP.NET Core | backend |
26
- | `php-laravel` | PHP + Laravel | backend |
27
- | `context-engineering` | Generic AI/LLM projects | backend |
28
- | `react` | TypeScript + React | web-frontend |
29
- | `nextjs` | TypeScript + Next.js | web-frontend |
30
- | `vue` | TypeScript + Vue 3 | web-frontend |
31
- | `nuxt` | TypeScript + Nuxt 3 + @nuxt/ui | web-frontend |
32
- | `angular` | TypeScript + Angular | web-frontend |
33
- | `flutter` | Dart + Flutter | mobile |
34
- | `react-native` | TypeScript + React Native / Expo | mobile |
35
- | `ios-swiftui` | Swift + SwiftUI | mobile |
36
- | `android-compose` | Kotlin + Jetpack Compose | mobile |
37
- | `qc-playwright` | Python + pytest-playwright + Page Object | QC / E2E (xem dưới) |
38
-
39
- ---
40
-
41
- ## Platform type grouping
42
-
43
- `platform_type` được suy ra từ module và quyết định cách adapt BDD vocabulary, tech-design sections, và test templates.
44
-
45
- | `platform_type` | Modules |
46
- |-----------------|---------|
47
- | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
48
- | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
49
- | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
50
-
51
- Ví dụ adapt theo platform type:
52
-
53
- - **BDD vocabulary** — backend dùng "submits a request" / "receives response"; web dùng "clicks" / "types into" / "navigates to"; mobile dùng "taps" / "enters" / "opens".
54
- - **Tech-design sections** — backend: §4 API Endpoints / §5 Service Flow / §6 Data Model…; web-frontend: §4 Screen/Component Breakdown / §5 State Management…; mobile: §4 Screen/Widget Breakdown / §5 State & Data Flow….
55
- - **Test templates** — Java → JUnit 5 + Mockito + `@WebMvcTest`; web → Vitest/Jest + Testing Library + Playwright/Cypress; Flutter → `testWidgets`; iOS → `XCTestCase`; Android → Compose rule + `@HiltAndroidTest`.
56
-
57
- ---
58
-
59
- ## qc-playwright — QC automation stack
60
-
61
- `qc-playwright` là **stack QC automation độc lập** với dev implementation module. Nó power native QC pipeline (`/qc-run-test`, `/qc-report`) và được chọn qua `tech_stack.qc_module` hoặc per `/qc-*` run — không phụ thuộc vào stack dev (java-spring, react, flutter…). Per-layer guides nằm ở `skills/qc/<stage>/`. Xem [../02-guides/tester/qc-automation.md](../02-guides/tester/qc-automation.md).
62
-
63
- **Stack** (từ `modules/qc-playwright/stack-profile.yaml`): Python 3 + pytest-playwright + Page Object Model. Report = Playwright Trace + pytest-html (**không** dùng Allure, không hand-written dashboard, không `record_video`).
64
-
65
- **Build commands:**
66
-
67
- | Mục đích | Command |
68
- |----------|---------|
69
- | Test | `python3 -m pytest` |
70
- | E2E | `python3 -m pytest -m e2e` |
71
- | Report | `python3 -m pytest --html=reports/<feature>/report.html --self-contained-html` |
72
- | Show trace | `python3 -m playwright show-trace <test-results/<nodeid>/trace.zip>` |
73
-
74
- **Key architecture rules:**
75
- - **Markdown-first** — không sinh Python cho tới khi có `.Test.md` đã review cho feature.
76
- - Không hard-code URL/credential/timeout — đọc từ `Env.*` và `CONFIG[...]`.
77
- - Không `time.sleep()` — dùng Playwright auto-wait / `expect()`.
78
- - Mỗi test độc lập qua pytest-playwright fixtures (`page` / `logged_in_page` / …).
79
- - Page Object extends slim `BasePage`; tách 3 layer: locators `_x()`, actions `verb_noun()`, assertions `assert_x()` dùng `expect()`.
80
- - Locator priority: `data-testid` → role → label/text → CSS → tránh XPath.
81
- - Group test theo `(role, account)` để login/logout không interleave giữa các role.
82
- - Cover 100% TC trong `.Test.md` — mỗi TC kết thúc Pass/Fail/Skip, không để Draft.
83
-
84
- **Naming:** test case id `TC_<FEATURE>_<NNN>` · test class `TestFeatureHappyCase` · test function `test_TC<NNN>_<snake_case>` · page object `<feature>_page.py` (`<Feature>Page` extends `BasePage`).
85
-
86
- **Folder structure:**
87
- ```
88
- {paths.qc_dir}/{UC-ID}/test-cases/ ← test-case Markdown (.Test.md) — source of truth (mặc định docs/, lộ ra ngoài)
89
- pages/ ← Page Object Model (base_page.py + <feature>_page.py)
90
- tests/ ← pytest scripts, 1-1 với test-cases/ (conftest.py + test_<feature>.py)
91
- utils/ ← config_loader, logger, steps, test_ordering, report helpers
92
- test_data/ ← JSON datasets
93
- config/config.yaml ← browser, timeout, video/screenshot/trace toggles
94
- reports/ test-results/ ← generated (gitignored): html report, trace.zip, screenshots
95
- ```
96
-
97
- **Test layers:** functional (gui-screen / gui-feature / api) · integration (api/db/gui/kafka) · e2e (journey) · non-functional · exploratory.
98
-
99
- **Trace tags** (map QC test về scenario, drive `qc_status`):
100
- ```python
101
- # @trace.verifies={UC-ID}-SC{N}
102
- # @trace.source=<official .feature path>
103
- # @trace.test_type=functional|integration|e2e|non-functional
104
- ```
105
-
106
- > `/qc-run-test` ghi `pass|fail|skip|not_run` + `qc_run_at` vào `{trace_dir}/{UC-ID}-{platform}.tsv` (song song với `dev_selftest`), surfaced trong Living Docs là kết quả QC automation **chính thức**. Mỗi FAIL được phân loại script-bug (fix selector/logic) vs product-gap (giữ FAIL + evidence, không bao giờ fake-pass).
107
-
108
- ---
109
-
110
- *Xem thêm:* [Trace TSV Schema](trace-schema.md) (`qc_status` vs `dev_selftest`) · [Command Reference](commands.md) (pipeline `/qc-*`) · [02 · Guides · QC Automation](../02-guides/tester/qc-automation.md).