spec-lite 1.2.0 → 1.2.2

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.
package/README.md CHANGED
@@ -86,7 +86,7 @@ Mỗi requirement mới đều đi qua pipeline này.
86
86
 
87
87
  /build ◄──────────────┐
88
88
  │ │
89
- /review │ (nếu Critical/Important → sửa và build lại)
89
+ /review-integration │ (nếu Critical/Important → sửa và build lại)
90
90
  │ │
91
91
  [approve] ───────────┘ (nếu chỉ Suggestion hoặc không có finding)
92
92
  ```
@@ -109,12 +109,17 @@ Tạo `plan.md` và `todo.md` từ `spec.md` + `tech.md`.
109
109
  #### `/build`
110
110
  Implement từng task trong `plan.md`/`todo.md` theo TDD incremental.
111
111
 
112
- #### `/review`
112
+ #### `/review-integration`
113
113
  Review implementation sau `/build` theo năm trục: correctness, readability, architecture, security, performance. Đối chiếu trực tiếp với `spec.md` và `tech.md`.
114
114
 
115
115
  - Critical/Important → dừng, sửa, re-review
116
116
  - Chỉ Suggestion hoặc không có finding → approve, tiếp tục `/build` task tiếp theo
117
117
 
118
+ #### `/review-everything`
119
+ Review toàn bộ codebase ở **project level** đối chiếu với `prd.md` / `domain.md` / `sad.md`. Spawn 5 subagent song song theo năm axis của `code-review-and-quality`.
120
+
121
+ Sau khi có findings, hỏi user severity tier muốn xử lý (Critical / Critical+Required / +Optional / All / Bỏ qua). Nếu chọn fix → gom selected findings thành raw requirement và auto-invoke `/spec-new` để tạo integration. Findings full snapshot được lưu vào `specs/integrations/{NNN}-{slug}/review-findings.md`.
122
+
118
123
  ---
119
124
 
120
125
  ## Files được tạo ra
@@ -130,6 +135,7 @@ Review implementation sau `/build` theo năm trục: correctness, readability, a
130
135
  | `/spec-tech` | `specs/integrations/{slug}/tech.md` |
131
136
  | `/plan` | `specs/integrations/{slug}/plan.md`, `todo.md` |
132
137
  | `/build` | *(implements tasks từ `plan.md`/`todo.md`)* |
133
- | `/review` | *(findings report — không tạo file)* |
138
+ | `/review-integration` | *(findings report — không tạo file)* |
139
+ | `/review-everything` | `specs/integrations/{NNN}-{slug}/review-findings.md` *(qua /spec-new)* |
134
140
 
135
141
  Component và feature artifacts trong greenfield mọc dần qua **cascade proposals** từ integrations — không có skill chuyên biệt để tạo.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-lite",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Spec-driven development kit for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {
@@ -74,7 +74,7 @@ Nếu `status: approved` → tiếp tục sang Bước 0b.
74
74
 
75
75
  **Tạo branch (bắt buộc):**
76
76
 
77
- Luôn tạo branch `build/{integration-slug}` trước khi build, bất kể có dùng worktree hay không. Điều này đảm bảo `/review` luôn có base để diff chính xác.
77
+ Luôn tạo branch `build/{integration-slug}` trước khi build, bất kể có dùng worktree hay không. Điều này đảm bảo `/review-integration` luôn có base để diff chính xác.
78
78
 
79
79
  ```bash
80
80
  git checkout -b feat/{slug}
@@ -212,7 +212,7 @@ Invoke `debugging-and-error-recovery`:
212
212
  Khi tất cả task trong session này đã done, thông báo:
213
213
 
214
214
  ```
215
- Tất cả task đã hoàn thành. Bước tiếp theo: chạy /review để kiểm tra toàn bộ implementation trước khi merge.
215
+ Tất cả task đã hoàn thành. Bước tiếp theo: chạy /review-integration để kiểm tra toàn bộ implementation trước khi merge.
216
216
  ```
217
217
 
218
- Không tự động invoke `/review` — để user chủ động gọi.
218
+ Không tự động invoke `/review-integration` — để user chủ động gọi.
@@ -0,0 +1,326 @@
1
+ ---
2
+ name: review-everything
3
+ description: Review toàn bộ codebase ở cấp project (không phải per-integration) theo năm trục của code-review-and-quality. Đối chiếu implementation với prd.md, domain.md, sad.md. Sau khi user chọn severity cần xử lý, gom findings thành raw requirement và invoke /spec-new để tạo integration fix.
4
+ ---
5
+
6
+ # Review Everything
7
+
8
+ ## Tổng quan
9
+
10
+ `/review-everything` review toàn bộ codebase ở **project level** — không bị giới hạn ở diff của một integration.
11
+
12
+ Khác với `/review-integration` (chạy sau `/build`, đối chiếu với spec.md / tech.md của integration hiện tại), `/review-everything` đứng cao hơn:
13
+
14
+ - **Context** = main artifacts: `prd.md` (NFRs, Constraints, Component Index, Feature Index), `domain.md` (Glossary, Shared Entities), `sad.md` (Tech Stack, Cross-Cutting, **Architectural Guardrails**).
15
+ - **Scope** = toàn bộ source code, không filter theo branch diff.
16
+ - **Output** = findings table phân loại theo severity của `code-review-and-quality`.
17
+ - **Hand-off** = nếu user chọn fix → gom selected findings thành raw requirement → invoke `/spec-new` để tạo integration mới và xử lý như integration bình thường.
18
+
19
+ ## When to Use
20
+
21
+ - Health-check định kỳ codebase (sau cột mốc, trước release lớn).
22
+ - Audit khi onboard owner mới hoặc trước cross-team review.
23
+ - Phát hiện tech debt / vi phạm guardrails đã tích luỹ qua nhiều integration.
24
+
25
+ ## When NOT to Use
26
+
27
+ - Vừa hoàn thành một integration cụ thể → dùng `/review-integration` (diff-based, đối chiếu spec.md/tech.md).
28
+ - `prd.md` / `domain.md` / `sad.md` chưa có nội dung → review sẽ thiếu chuẩn để đối chiếu. Chạy `/spec-prd` → `/spec-sad` (hoặc `/spec-brownfield-init`) trước.
29
+
30
+ ---
31
+
32
+ ## Process
33
+
34
+ ### Bước 1: Validate prerequisites
35
+
36
+ Kiểm tra các file sau tồn tại và **có nội dung** (không phải template rỗng):
37
+
38
+ - `specs/main/prd.md`
39
+ - `specs/main/domain.md`
40
+ - `specs/main/sad.md`
41
+
42
+ Nếu thiếu hoặc rỗng → dừng:
43
+
44
+ > Main artifacts chưa sẵn sàng. Hãy chạy `/spec-prd` và `/spec-sad` (greenfield) hoặc `/spec-brownfield-init` (brownfield) trước.
45
+
46
+ ---
47
+
48
+ ### Bước 2: Load context một lần
49
+
50
+ Đọc đầy đủ:
51
+
52
+ - `prd.md` — Problem, Target Users, Scope, **NFRs**, Business Constraints, **Component Index**, **Feature Index**
53
+ - `domain.md` — Glossary, Shared Entities (owner, fields)
54
+ - `sad.md` — Architectural Style, Tech Stack, Cross-Cutting Concerns, Inter-Service Communication, Infrastructure, **Architectural Guardrails**
55
+
56
+ Liệt kê source code roots cần review (mặc định cả repo, trừ thư mục node_modules / dist / build / .claude / specs / .git và các thư mục test fixtures).
57
+
58
+ Tóm tắt cho user trước khi spawn agents:
59
+
60
+ ```
61
+ CONTEXT
62
+ - Components (từ prd.md): C-001 …, C-002 …
63
+ - Guardrails từ sad.md: {top 3-5 guardrail quan trọng}
64
+ - NFRs từ prd.md: {liệt kê}
65
+
66
+ SOURCE SCOPE
67
+ - Roots: src/, packages/api/, …
68
+ - Excluded: node_modules/, dist/, .claude/, specs/
69
+
70
+ Tiếp tục review? (y/n)
71
+ ```
72
+
73
+ Chỉ tiến hành Bước 3 sau khi user xác nhận.
74
+
75
+ ---
76
+
77
+ ### Bước 3: Spawn 5 review subagents — parallel theo axis
78
+
79
+ Cùng context, khác axis. Mỗi subagent (`subagent_type: Explore`) nhận:
80
+
81
+ - Cùng tóm tắt prd / domain / sad (đặc biệt Guardrails + NFRs liên quan).
82
+ - Source roots cần đọc.
83
+ - **Một** axis của `code-review-and-quality` cần focus.
84
+ - Yêu cầu output format chuẩn (xem dưới).
85
+
86
+ Spawn **trong cùng một message** (5 Agent tool calls song song):
87
+
88
+ | Axis | Tập trung vào |
89
+ | --- | --- |
90
+ | **Correctness** | Edge cases, error paths, off-by-one, race conditions, mismatch giữa code và acceptance/business rule trong frd/crd. |
91
+ | **Readability** | Naming, control flow, abstraction quá sớm, code chết, độ dài quá mức cần thiết. |
92
+ | **Architecture** | Tuân thủ guardrails trong sad.md, module boundaries, circular dependencies, vi phạm Component Index. |
93
+ | **Security** | Input validation, secrets in code, auth checks, injection, untrusted external data. Tham chiếu `security-and-hardening`. |
94
+ | **Performance** | N+1, unbounded loops, missing pagination, hot-path allocations. Tham chiếu `performance-optimization`. |
95
+
96
+ **Prompt template cho mỗi subagent:**
97
+
98
+ ```
99
+ Review toàn bộ codebase tại {repo path} chỉ theo trục {AXIS}.
100
+
101
+ CONTEXT (đối chiếu code với những thứ sau):
102
+ - prd.md: {tóm tắt NFRs, Component Index, Feature Index}
103
+ - domain.md: {Glossary terms, Shared Entities}
104
+ - sad.md: {Architectural Guardrails, Tech Stack quan trọng}
105
+
106
+ YÊU CẦU:
107
+ 1. Đọc các source root sau (đệ quy, bỏ excluded): {roots}
108
+ 2. Chỉ tìm vấn đề thuộc trục {AXIS} — KHÔNG flag vấn đề thuộc trục khác.
109
+ 3. Mỗi finding gán severity theo scale của code-review-and-quality:
110
+ - Critical — blocks merge (security vuln, data loss, broken core function)
111
+ - Required (no prefix) — must fix before merge
112
+ - Optional / Consider — worth considering, not required
113
+ - Nit — minor formatting/style
114
+ - FYI — informational only
115
+ 4. Trả output đúng format YAML dưới đây, không thêm narrative:
116
+
117
+ findings:
118
+ - id: {AXIS}-001
119
+ severity: Critical | Required | Optional | Nit | FYI
120
+ title: {tên ngắn gọn, bắt đầu bằng động từ}
121
+ file: {path:line hoặc path}
122
+ detail: {2-3 dòng — vấn đề gì, đối chiếu với context nào}
123
+ suggestion: {hướng fix ngắn gọn}
124
+ - id: {AXIS}-002
125
+ ...
126
+
127
+ Nếu không có finding nào ở trục này → trả `findings: []`.
128
+ ```
129
+
130
+ Subagent chỉ đọc code, không sửa. Trả về YAML structured findings.
131
+
132
+ ---
133
+
134
+ ### Bước 4: Aggregate findings
135
+
136
+ Gom findings từ 5 subagent vào một bảng duy nhất, sắp theo severity giảm dần rồi theo axis:
137
+
138
+ ```
139
+ FINDINGS — {N} total
140
+
141
+ | ID | Severity | Axis | File | Title |
142
+ |---------------|----------|--------------|-------------------------|-----------------------------|
143
+ | SEC-001 | Critical | Security | src/auth/login.ts:42 | Fix SQL injection in … |
144
+ | ARCH-001 | Critical | Architecture | src/modules/billing/… | Remove circular dep with … |
145
+ | CORR-001 | Required | Correctness | src/orders/create.ts:88 | Handle empty cart case |
146
+ | PERF-001 | Required | Performance | src/api/users.ts:120 | Replace N+1 with batch fetch|
147
+ | READ-001 | Optional | Readability | src/utils/parse.ts:15 | Rename `tmp` → `payload` |
148
+ | READ-002 | Nit | Readability | … | … |
149
+ | SEC-003 | FYI | Security | … | … |
150
+
151
+ Tổng: {C} Critical · {R} Required · {O} Optional · {N} Nit · {F} FYI
152
+ ```
153
+
154
+ Hiển thị toàn bộ bảng cho user. Mỗi finding giữ nguyên `id` do subagent gán (prefix theo axis: CORR, READ, ARCH, SEC, PERF) — đây là handle để reference trong spec.md sau này.
155
+
156
+ ---
157
+
158
+ ### Bước 5: Hỏi user severity tier muốn xử lý
159
+
160
+ Dùng `AskUserQuestion`:
161
+
162
+ ```
163
+ question: "Xử lý findings ở mức nào?"
164
+ header: "Severity tier"
165
+ options:
166
+ - label: "Chỉ Critical"
167
+ description: "Chỉ fix {C} findings blocking. Bỏ qua phần còn lại."
168
+ - label: "Critical + Required"
169
+ description: "Fix tất cả {C+R} findings must-fix theo code-review-and-quality."
170
+ - label: "Critical + Required + Optional"
171
+ description: "Bao gồm cả Optional/Consider (worth-considering)."
172
+ - label: "Tất cả (kèm Nit + FYI)"
173
+ description: "Fix toàn bộ {N} findings — kể cả nit và FYI."
174
+ - label: "Bỏ qua — chỉ xem findings"
175
+ description: "Không tạo integration. Findings vẫn được lưu nếu cần tham chiếu sau."
176
+ ```
177
+
178
+ Nếu user chọn "Bỏ qua" → ghi findings ra `specs/main/review/{YYYY-MM-DD-HHmm}.md` (tạo thư mục nếu chưa có) rồi dừng.
179
+
180
+ Nếu user chọn một tier → tiếp Bước 6.
181
+
182
+ ---
183
+
184
+ ### Bước 6: Gom selected findings → raw requirement cho /spec-new
185
+
186
+ Filter findings theo tier đã chọn (tier cao hơn = tập con nhỏ hơn, ví dụ "Chỉ Critical" → chỉ giữ severity=Critical).
187
+
188
+ Sinh **raw requirement** (string đưa làm ARGUMENT cho `/spec-new`):
189
+
190
+ ```
191
+ Fix project-level review findings — {YYYY-MM-DD} review.
192
+
193
+ Selected severity tier: {tier label} → {K} findings.
194
+
195
+ Findings to address:
196
+ - [SEC-001] Critical · Security · src/auth/login.ts:42 — Fix SQL injection in user lookup
197
+ - [ARCH-001] Critical · Architecture · src/modules/billing/* — Remove circular dependency with payments module
198
+ - [CORR-001] Required · Correctness · src/orders/create.ts:88 — Handle empty cart case
199
+ - …
200
+
201
+ Acceptance: mỗi finding ở trên có hành động fix tương ứng + verification (test hoặc manual check).
202
+ Đầy đủ detail/suggestion xem `review-findings.md` trong cùng thư mục integration.
203
+ ```
204
+
205
+ ---
206
+
207
+ ### Bước 7: Invoke /spec-new với raw requirement
208
+
209
+ Gọi `Skill` tool: `skill=spec-new`, `args={raw requirement ở Bước 6}`.
210
+
211
+ `/spec-new` sẽ:
212
+ 1. Nhận ARGUMENT làm raw requirement (bỏ qua nhánh "chọn từ prd.md").
213
+ 2. Load context (prd / domain / frd / crd liên quan).
214
+ 3. Interview 4 phần (Problem Statement, Requirements, Acceptance Criteria, Out of Scope) — agent **gợi ý sẵn** dựa trên findings, user chỉnh.
215
+ 4. Sinh `specs/integrations/{NNN}-{slug}/spec.md` + cascade lên main artifacts.
216
+
217
+ **Khi `/spec-new` đề xuất slug**, gợi ý mặc định:
218
+ - `review-{YYYY-MM-DD}` — ngắn, có ngày để truy ngược review nào.
219
+ - User có quyền sửa.
220
+
221
+ ---
222
+
223
+ ### Bước 8: Sau khi /spec-new tạo xong integration → lưu findings file
224
+
225
+ `/spec-new` ghi `specs/integrations/{NNN}-{slug}/spec.md`. Đọc lại path đó để biết `{NNN}-{slug}`.
226
+
227
+ Ghi **toàn bộ findings** (không chỉ selected — giữ full để tham chiếu sau) vào:
228
+
229
+ ```
230
+ specs/integrations/{NNN}-{slug}/review-findings.md
231
+ ```
232
+
233
+ Nội dung:
234
+
235
+ ```markdown
236
+ ---
237
+ slug: {NNN}-{slug}
238
+ created: {YYYY-MM-DD HH:mm}
239
+ total_findings: {N}
240
+ selected_tier: {tier label}
241
+ ---
242
+
243
+ # Review Findings — {YYYY-MM-DD}
244
+
245
+ Project-level review chạy bởi `/review-everything`.
246
+
247
+ ## Summary
248
+
249
+ | Severity | Count | Selected for fix |
250
+ |---|---|---|
251
+ | Critical | {c} | {✓ nếu tier bao gồm} |
252
+ | Required | {r} | … |
253
+ | Optional | {o} | … |
254
+ | Nit | {n} | … |
255
+ | FYI | {f} | … |
256
+
257
+ ## Selected for fix in this integration
258
+
259
+ {Bảng findings được chọn, đầy đủ id / severity / axis / file / title / detail / suggestion}
260
+
261
+ ## Deferred (not in this integration)
262
+
263
+ {Bảng findings KHÔNG được chọn — để tham chiếu cho lần review/integration sau}
264
+ ```
265
+
266
+ Thông báo:
267
+
268
+ ```
269
+ ✓ /review-everything hoàn tất.
270
+
271
+ Findings: {N} total ({C} Critical · {R} Required · {O} Optional · {Ni} Nit · {F} FYI)
272
+ Selected: {tier} → {K} findings
273
+ Integration: specs/integrations/{NNN}-{slug}/
274
+ ├── spec.md (đã tạo bởi /spec-new + cascade)
275
+ └── review-findings.md (full snapshot)
276
+
277
+ Bước tiếp theo:
278
+ - /spec-tech {NNN} → thiết kế technical design cho phase fix
279
+ - /plan → phân rã tasks
280
+ - /build → implement
281
+ ```
282
+
283
+ ---
284
+
285
+ ## Mối quan hệ với các skill khác
286
+
287
+ | Skill | Quan hệ |
288
+ | --- | --- |
289
+ | `code-review-and-quality` | **Delegated** — 5 subagent áp axis của skill này lên codebase. Severity scale dùng nguyên scheme của skill. |
290
+ | `security-and-hardening` | Subagent Security tham chiếu khi đánh giá. |
291
+ | `performance-optimization` | Subagent Performance tham chiếu khi đánh giá. |
292
+ | `spec-new` | **Auto-invoked ở Bước 7** với ARGUMENT là raw requirement gom từ findings. Toàn bộ flow sau đó giống integration bình thường. |
293
+ | `review-integration` | Khác scope — `/review-integration` chạy sau `/build` cho **một** integration, đối chiếu spec.md/tech.md. `/review-everything` chạy project-level, đối chiếu prd/domain/sad. |
294
+
295
+ ---
296
+
297
+ ## Common Rationalizations
298
+
299
+ | Rationalization | Reality |
300
+ | --- | --- |
301
+ | "Code chạy ổn, không cần review project-level" | Drift tích luỹ qua nhiều integration không bị diff-based review bắt được (ví dụ vi phạm guardrail mới thêm vào sad.md sau khi code đã viết). |
302
+ | "Tier Critical-only là đủ rồi" | Required findings cũng phải fix trước merge theo định nghĩa của code-review-and-quality. Critical-only nên chỉ dùng khi có hạn về effort. |
303
+ | "Bỏ qua Optional/Nit cho nhanh" | Hợp lệ. Optional/Nit có thể defer — nhưng đừng để chúng biến mất khỏi history. Findings file vẫn ghi đầy đủ để lần sau pickup. |
304
+
305
+ ## Red Flags
306
+
307
+ - Spawn 1 subagent cho cả 5 axis → context blowup, findings sót.
308
+ - Filter selected findings nhưng không lưu **full** snapshot vào `review-findings.md` → mất traceability.
309
+ - Skip Bước 1 (validate prerequisites) → review không có chuẩn để đối chiếu, findings sẽ thiên về subjective.
310
+ - Tạo spec.md trực tiếp thay vì invoke `/spec-new` → duplicate logic, không cascade lên main artifacts.
311
+
312
+ ## Verification
313
+
314
+ Trước khi spawn subagents:
315
+ - [ ] `prd.md`, `domain.md`, `sad.md` đã có nội dung
316
+ - [ ] Đã tóm tắt context + source roots cho user và user xác nhận
317
+
318
+ Sau khi aggregate findings:
319
+ - [ ] Findings được phân loại đúng theo severity scale của `code-review-and-quality`
320
+ - [ ] Mỗi finding có `id` (prefix theo axis), `file`, `title`, `detail`, `suggestion`
321
+ - [ ] Bảng tổng đếm đúng từng severity
322
+
323
+ Sau khi user chọn tier:
324
+ - [ ] Raw requirement build từ chỉ selected findings
325
+ - [ ] `/spec-new` được invoke với ARGUMENT chứa raw requirement
326
+ - [ ] Sau khi `/spec-new` xong → `review-findings.md` ghi **full** findings (selected + deferred) vào integration directory
@@ -1,9 +1,9 @@
1
1
  ---
2
- name: review
2
+ name: review-integration
3
3
  description: Review code sau bước /build theo năm trục — correctness, readability, architecture, security, performance. Dùng sau khi hoàn thành một hoặc nhiều task trong todo.md. Đối chiếu implementation với spec.md và tech.md để xác nhận đúng yêu cầu.
4
4
  ---
5
5
 
6
- # Review
6
+ # Review Integration
7
7
 
8
8
  ## Tổng quan
9
9
 
@@ -65,7 +65,7 @@ Append section mới vào cuối file (không ghi đè section cũ). Chỉ ghi c
65
65
  - [ ] **Important** — {tên ngắn gọn}
66
66
  ```
67
67
 
68
- > Details đầy đủ nằm ở Phase Review trong `plan.md` (nếu user chọn thêm phase), hoặc trong output của `/review` lúc đó.
68
+ > Details đầy đủ nằm ở Phase Review trong `plan.md` (nếu user chọn thêm phase), hoặc trong output của `/review-integration` lúc đó.
69
69
 
70
70
  **Bước 3 — Đề xuất thêm phase mới vào plan.md và todo.md:**
71
71
 
@@ -142,7 +142,7 @@ Thông báo:
142
142
 
143
143
  ```
144
144
  Findings đã được lưu vào specs/integrations/{slug}/techdebt.md.
145
- Chạy /review lại hoặc /build khi sẵn sàng xử lý.
145
+ Chạy /review-integration lại hoặc /build khi sẵn sàng xử lý.
146
146
  ```
147
147
 
148
148
  ---
@@ -214,20 +214,30 @@ Ghi tất cả? [y] hoặc review từng file trước [r]:
214
214
 
215
215
  ---
216
216
 
217
- ### Bước 10: Điền Component Index vào prd.md
217
+ ### Bước 10: Điền Component Index vào prd.md + sad.md Components table
218
218
 
219
- Sau khi artifacts đã được ghi, update `specs/main/prd.md` Component Index với danh sách đã confirm:
219
+ Sau khi artifacts đã được ghi, update song song hai bảng — `prd.md > Components` (vai trò business) `sad.md > System Overview > Components` (góc nhìn architectural). Danh sách C-XXX phải khớp giữa hai bảng.
220
220
 
221
221
  ```
222
- Sẽ điền Component Index vào prd.md:
222
+ Sẽ điền:
223
+
224
+ prd.md Component Index (business view):
223
225
  C-001 | auth | Xác thực và phân quyền người dùng | active
224
226
  C-002 | user | Quản lý thông tin người dùng | active
225
227
  C-003 | payment | Xử lý thanh toán và giao dịch | active
226
228
  C-004 | notification | Gửi thông báo qua email/push | active
227
229
 
230
+ sad.md Components table (architectural view):
231
+ C-001 | auth | Stateless service, JWT issuer, in-mem session cache
232
+ C-002 | user | Stateful service, owns user DB, exposes REST
233
+ C-003 | payment | Stateful service, integrates Stripe, idempotent writes
234
+ C-004 | notification | Worker, consumes events from message bus
235
+
228
236
  Apply? [y/n]
229
237
  ```
230
238
 
239
+ Cột architectural notes trong sad.md nên ngắn gọn — tập trung vào boundary/deployment/key tech concern, không lặp lại business role từ prd.md.
240
+
231
241
  ---
232
242
 
233
243
  ### Bước 11: Summary
@@ -239,6 +249,7 @@ Apply? [y/n]
239
249
  ...
240
250
 
241
251
  ✓ prd.md Component Index: {N} entries đã được điền
252
+ ✓ sad.md Components table: {N} entries đã được điền (architectural view)
242
253
 
243
254
  {nếu có} ✓ domain.md Shared Entities: {N} entities đã được cascade
244
255
 
@@ -262,5 +273,6 @@ Bước tiếp theo:
262
273
  - [ ] Dependencies chỉ reference C-XXX IDs, không reference file paths
263
274
  - [ ] Business rules detect được đánh dấu `(detected from code)`
264
275
  - [ ] prd.md Component Index đã được update
276
+ - [ ] sad.md Components table đã được update — danh sách C-XXX khớp với prd.md
265
277
  - [ ] Shared Entities đã được cascade vào domain.md (nếu có)
266
278
  - [ ] NEEDS_CLARIFY items được list đầy đủ trong summary
@@ -111,6 +111,12 @@ Hỏi tuần tự từng phần:
111
111
 
112
112
  Nếu user muốn đề xuất → đề xuất 2-3 option với trade-offs rõ ràng, để user chọn. Không quyết định thay.
113
113
 
114
+ **Phần 1.5 — System Overview (diagram + Components table):**
115
+ > Vẽ sơ đồ tổng thể (Mermaid): các component và quan hệ chính.
116
+ > Components table (projection từ `prd.md > Components`): với mỗi `C-XXX`, ghi 1 dòng architectural note — boundary/deployment unit/key tech concern. **Không lặp lại role/responsibility từ `crd.md`** — chỉ góc nhìn architectural.
117
+
118
+ Nếu `prd.md > Components` còn rỗng (brownfield init chưa scan code, hoặc greenfield chưa biết component) → để placeholder và note rằng bảng này sẽ được điền khi Component Index có nội dung (qua `/spec-brownfield-component` hoặc cascade từ integration).
119
+
114
120
  **Phần 2 — Tech Stack:**
115
121
  > Tech stack cho từng layer: Frontend, Backend, Database, Infrastructure?
116
122
  > Với mỗi lựa chọn: lý do chọn là gì? (performance, team familiarity, ecosystem...)
@@ -196,6 +202,7 @@ Trước khi kết thúc, kiểm tra:
196
202
 
197
203
  - [ ] Frontmatter đầy đủ và đúng schema
198
204
  - [ ] Architectural Style có lý do gắn với NFRs hoặc constraints
205
+ - [ ] System Overview có diagram + Components table; danh sách C-XXX khớp với `prd.md > Components` (hoặc cả hai cùng rỗng nếu Component Index chưa được điền)
199
206
  - [ ] Mỗi tech stack item có lý do chọn rõ ràng
200
207
  - [ ] Tất cả 4 cross-cutting concerns đã được điền (auth, error, logging, caching)
201
208
  - [ ] Guardrails có ít nhất 3 item, mỗi item cụ thể và actionable
@@ -173,7 +173,7 @@ Sau khi main artifacts đã sẵn sàng (từ greenfield hoặc brownfield), m
173
173
  | `/spec-tech [number]` | `sad.md`, `domain.md`, cdd(s), fdd(s), `spec.md` | `specs/integrations/{slug}/tech.md` |
174
174
  | `/plan` | `spec.md`, `tech.md`, `domain.md` | `plan.md`, `todo.md` |
175
175
  | `/build` | `plan.md`, `todo.md` | *(source code)* |
176
- | `/review` | `spec.md`, `tech.md`, `plan.md`, `todo.md`, *(source code)* | *(findings report)* |
176
+ | `/review-integration` | `spec.md`, `tech.md`, `plan.md`, `todo.md`, *(source code)* | *(findings report)* |
177
177
  | `/archive` | `specs/integrations/` | `specs/archive/` |
178
178
 
179
179
  ### `/spec-new [requirement]`
@@ -250,7 +250,7 @@ Với mỗi task `[ ]` trong `todo.md`, lặp lại:
250
250
 
251
251
  ---
252
252
 
253
- ### `/review`
253
+ ### `/review-integration`
254
254
 
255
255
  Review implementation sau `/build` theo năm trục: correctness, readability, architecture, security, performance. Đối chiếu trực tiếp với `spec.md` và `tech.md`. Delegates to `code-review-and-quality`.
256
256
 
@@ -298,7 +298,7 @@ Di chuyển integration đã hoàn thành hoặc không còn active từ `specs/
298
298
 
299
299
  /build ←──────────────┐
300
300
  │ │
301
- /review │ (nếu Critical/Important)
301
+ /review-integration │ (nếu Critical/Important)
302
302
  │ │
303
303
  [approve] ──────────┘ (nếu Suggestion only)
304
304
 
@@ -307,6 +307,52 @@ Di chuyển integration đã hoàn thành hoặc không còn active từ `specs/
307
307
 
308
308
  ---
309
309
 
310
+ ## Project-level review
311
+
312
+ Khác với `/review-integration` (chạy sau `/build` cho một integration cụ thể), `/review-everything` review toàn bộ codebase đối chiếu với main artifacts.
313
+
314
+ | Command | Reads | Writes |
315
+ | --- | --- | --- |
316
+ | `/review-everything` | `prd.md`, `domain.md`, `sad.md`, *(source code)* | `specs/integrations/{NNN}-{slug}/review-findings.md` *(qua /spec-new)* |
317
+
318
+ ### `/review-everything`
319
+
320
+ Review codebase ở project level theo năm trục của `code-review-and-quality`. Spawn 5 subagent song song — cùng context (prd / domain / sad), khác axis (Correctness / Readability / Architecture / Security / Performance).
321
+
322
+ **Output** — findings table phân loại theo severity scale của `code-review-and-quality`: Critical, Required, Optional/Consider, Nit, FYI.
323
+
324
+ **Sau khi có findings**, hỏi user severity tier muốn xử lý:
325
+
326
+ - Critical only
327
+ - Critical + Required (must-fix)
328
+ - Critical + Required + Optional
329
+ - Tất cả (kèm Nit + FYI)
330
+ - Bỏ qua — chỉ xem findings
331
+
332
+ Nếu user chọn fix → gom selected findings thành raw requirement, invoke `/spec-new` với ARGUMENT đó. Integration được tạo và xử lý như integration thường (`/spec-tech` → `/plan` → `/build`).
333
+
334
+ `review-findings.md` (full snapshot, gồm cả deferred) được ghi vào `specs/integrations/{NNN}-{slug}/` để traceability.
335
+
336
+ **Khi dùng:**
337
+
338
+ - Health-check định kỳ, audit trước release lớn
339
+ - Cross-team review hoặc onboarding owner mới
340
+ - Khi nghi ngờ drift / vi phạm guardrails tích luỹ qua nhiều integration
341
+
342
+ ```
343
+ /review-everything
344
+
345
+ [findings table]
346
+
347
+ user chọn severity tier
348
+
349
+ (nếu fix) /spec-new ←─── raw requirement (gom từ findings)
350
+
351
+ /spec-tech → /plan → /build (integration bình thường)
352
+ ```
353
+
354
+ ---
355
+
310
356
  ## Cross-cutting skills
311
357
 
312
358
  Không nằm trong pipeline chính — được `build` tự động invoke khi gặp task phù hợp.
@@ -2,7 +2,7 @@
2
2
  slug: "{slug}"
3
3
  created: {YYYY-MM-DD}
4
4
  referenced_by:
5
- - skills/review/SKILL.md > Bước 2 — Luôn ghi findings vào techdebt.md
5
+ - skills/review-integration/SKILL.md > Bước 2 — Luôn ghi findings vào techdebt.md
6
6
  ---
7
7
 
8
8
  # Tech Debt — {title}
@@ -24,6 +24,14 @@ graph TD
24
24
  ...
25
25
  ```
26
26
 
27
+ ### Components
28
+
29
+ Liệt kê các component của hệ thống — projection từ `prd.md > Components` với góc nhìn **architectural** (boundary, deployment unit, key tech concern). Vai trò business/role chi tiết xem `crd.md`, internal design xem `cdd.md`.
30
+
31
+ | ID | Component | Boundary / Architectural notes |
32
+ | --- | --- | --- |
33
+ | C-XXX | {name} | {deployment unit, layer, key tech-level concern} |
34
+
27
35
  ## Tech Stack
28
36
 
29
37
  | Layer | Technology | Lý do chọn |