spec-lite 1.2.1 → 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
@@ -115,6 +115,11 @@ Review implementation sau `/build` theo năm trục: correctness, readability, a
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
@@ -131,5 +136,6 @@ Review implementation sau `/build` theo năm trục: correctness, readability, a
131
136
  | `/plan` | `specs/integrations/{slug}/plan.md`, `todo.md` |
132
137
  | `/build` | *(implements tasks từ `plan.md`/`todo.md`)* |
133
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.1",
3
+ "version": "1.2.2",
4
4
  "description": "Spec-driven development kit for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {
@@ -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
@@ -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.