spec-lite 1.1.0 → 1.1.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
@@ -12,30 +12,19 @@ npx spec-lite install
12
12
 
13
13
  Lệnh này copy `skills/` và `templates/` vào thư mục `.claude/` của project.
14
14
 
15
- ## Sử dụng
15
+ ---
16
16
 
17
- Các skill được gọi bằng slash command bên trong Claude Code.
17
+ ## Greenfield dự án mới chưa code
18
18
 
19
- ### Thứ tự thực hiện
19
+ Chạy một lần để bootstrap main artifacts, sau đó vào Integration Pipeline.
20
20
 
21
21
  ```
22
22
  /spec-prd → /spec-sad
23
-
24
- (có requirement mới)
25
-
26
- /spec-new
27
-
28
- /spec-tech
29
-
30
- /plan
31
-
32
- /build
23
+
24
+
25
+ Integration Pipeline
33
26
  ```
34
27
 
35
- ---
36
-
37
- ### Seed skills — chạy một lần khi bắt đầu dự án
38
-
39
28
  #### `/spec-prd`
40
29
  Tạo hoặc cập nhật `specs/main/prd.md` thông qua interview có cấu trúc. Đồng thời scaffold `specs/main/domain.md` skeleton.
41
30
 
@@ -48,7 +37,59 @@ Sections: Architectural Style · System Overview · Tech Stack · Cross-Cutting
48
37
 
49
38
  ---
50
39
 
51
- ### Integration skills chạy mỗi khi requirement mới
40
+ ## Brownfieldproject đãcode
41
+
42
+ Scan codebase để extract main artifacts, sau đó vào Integration Pipeline. Thứ tự bắt buộc: `init` → `component` → `feature`.
43
+
44
+ ```
45
+ /spec-brownfield-init
46
+
47
+
48
+ /spec-brownfield-component
49
+
50
+
51
+ /spec-brownfield-feature
52
+
53
+
54
+ (fill in NEEDS_CLARIFY khi có thêm context)
55
+
56
+
57
+ Integration Pipeline
58
+ ```
59
+
60
+ #### `/spec-brownfield-init [path]`
61
+ Scan codebase, tạo `prd.md` (không có Component/Feature Index), `domain.md` (Glossary only), `sad.md`. Interview 5 phần: Problem Statement · Target Users · Scope · NFRs · Business Constraints. Component Index và Feature Index để placeholder — sẽ được điền bởi hai skill tiếp theo.
62
+
63
+ #### `/spec-brownfield-component [path]`
64
+ Scan module dirs, tạo `crd.md` + `cdd.md` cho từng component, điền Component Index vào `prd.md`, cascade Shared Entities vào `domain.md`. Yêu cầu `init` đã chạy.
65
+
66
+ #### `/spec-brownfield-feature [path]`
67
+ Scan routes/use cases/tests, tạo `frd.md` + `fdd.md` cho từng feature, điền Feature Index vào `prd.md`. Yêu cầu `component` đã chạy (fdd.md cần C-XXX IDs từ Component Index).
68
+
69
+ > **NEEDS_CLARIFY:** Các mục chưa rõ khi scan được đánh dấu `[NEEDS_CLARIFY]` — không block workflow, fill in dần khi có thêm context.
70
+
71
+ ---
72
+
73
+ ## Integration Pipeline — dùng cho cả greenfield và brownfield
74
+
75
+ Mỗi requirement mới đều đi qua pipeline này.
76
+
77
+ ```
78
+ /spec-new [requirement]
79
+ (human review + apply cascade proposals + approve)
80
+
81
+ /spec-tech
82
+ (human review + apply cascade proposals + approve)
83
+
84
+ /plan
85
+ (human approve)
86
+
87
+ /build ◄──────────────┐
88
+ │ │
89
+ /review │ (nếu Critical/Important → sửa và build lại)
90
+ │ │
91
+ [approve] ───────────┘ (nếu chỉ Suggestion hoặc không có finding)
92
+ ```
52
93
 
53
94
  #### `/spec-new [requirement]`
54
95
  Tạo `specs/integrations/{slug}/spec.md` cho một integration mới.
@@ -68,17 +109,27 @@ Tạo `plan.md` và `todo.md` từ `spec.md` + `tech.md`.
68
109
  #### `/build`
69
110
  Implement từng task trong `plan.md`/`todo.md` theo TDD incremental.
70
111
 
112
+ #### `/review`
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
+
115
+ - Critical/Important → dừng, sửa, re-review
116
+ - Chỉ Suggestion hoặc không có finding → approve, tiếp tục `/build` task tiếp theo
117
+
71
118
  ---
72
119
 
73
- ### Files được tạo ra
120
+ ## Files được tạo ra
74
121
 
75
122
  | Command | Output |
76
123
  |---------|--------|
77
124
  | `/spec-prd` | `specs/main/prd.md`, `specs/main/domain.md` (skeleton) |
78
125
  | `/spec-sad` | `specs/main/sad.md` |
126
+ | `/spec-brownfield-init` | `specs/main/prd.md`, `specs/main/domain.md`, `specs/main/sad.md` |
127
+ | `/spec-brownfield-component` | `specs/main/component/{C-XXX}-*/crd.md + cdd.md` |
128
+ | `/spec-brownfield-feature` | `specs/main/feature/{F-XXX}-*/frd.md + fdd.md` |
79
129
  | `/spec-new` | `specs/integrations/{slug}/spec.md` |
80
130
  | `/spec-tech` | `specs/integrations/{slug}/tech.md` |
81
131
  | `/plan` | `specs/integrations/{slug}/plan.md`, `todo.md` |
82
- | `/build` | _(implements tasks từ `plan.md`/`todo.md`)_ |
132
+ | `/build` | *(implements tasks từ `plan.md`/`todo.md`)* |
133
+ | `/review` | *(findings report — không tạo file)* |
83
134
 
84
- Component (`crd.md`, `cdd.md`) và feature (`frd.md`, `fdd.md`) artifacts mọc dần qua **cascade proposals** từ integrations — không có skill chuyên biệt để tạo.
135
+ 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/bin/cli.js CHANGED
@@ -21,6 +21,6 @@ if (command === 'install') {
21
21
  cpSync(join(pkgRoot, 'templates'), join(claudeDir, 'templates'), { recursive: true })
22
22
  console.log('✓ templates → .claude/templates/')
23
23
  } else {
24
- console.log('Usage: npx @torus-engineering/spec-lite install')
24
+ console.log('Usage: npx spec-lite install')
25
25
  process.exit(1)
26
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-lite",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Spec-driven development kit for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,347 @@
1
+ ---
2
+ name: code-review-and-quality
3
+ description: Conducts multi-axis code review. Use before merging any change. Use when reviewing code written by yourself, another agent, or a human. Use when you need to assess code quality across multiple dimensions before it enters the main branch.
4
+ ---
5
+
6
+ # Code Review and Quality
7
+
8
+ ## Overview
9
+
10
+ Multi-dimensional code review with quality gates. Every change gets reviewed before merge — no exceptions. Review covers five axes: correctness, readability, architecture, security, and performance.
11
+
12
+ **The approval standard:** Approve a change when it definitely improves overall code health, even if it isn't perfect. Perfect code doesn't exist — the goal is continuous improvement. Don't block a change because it isn't exactly how you would have written it. If it improves the codebase and follows the project's conventions, approve it.
13
+
14
+ ## When to Use
15
+
16
+ - Before merging any PR or change
17
+ - After completing a feature implementation
18
+ - When another agent or model produced code you need to evaluate
19
+ - When refactoring existing code
20
+ - After any bug fix (review both the fix and the regression test)
21
+
22
+ ## The Five-Axis Review
23
+
24
+ Every review evaluates code across these dimensions:
25
+
26
+ ### 1. Correctness
27
+
28
+ Does the code do what it claims to do?
29
+
30
+ - Does it match the spec or task requirements?
31
+ - Are edge cases handled (null, empty, boundary values)?
32
+ - Are error paths handled (not just the happy path)?
33
+ - Does it pass all tests? Are the tests actually testing the right things?
34
+ - Are there off-by-one errors, race conditions, or state inconsistencies?
35
+
36
+ ### 2. Readability & Simplicity
37
+
38
+ Can another engineer (or agent) understand this code without the author explaining it?
39
+
40
+ - Are names descriptive and consistent with project conventions? (No `temp`, `data`, `result` without context)
41
+ - Is the control flow straightforward (avoid nested ternaries, deep callbacks)?
42
+ - Is the code organized logically (related code grouped, clear module boundaries)?
43
+ - Are there any "clever" tricks that should be simplified?
44
+ - **Could this be done in fewer lines?** (1000 lines where 100 suffice is a failure)
45
+ - **Are abstractions earning their complexity?** (Don't generalize until the third use case)
46
+ - Would comments help clarify non-obvious intent? (But don't comment obvious code.)
47
+ - Are there dead code artifacts: no-op variables (`_unused`), backwards-compat shims, or `// removed` comments?
48
+
49
+ ### 3. Architecture
50
+
51
+ Does the change fit the system's design?
52
+
53
+ - Does it follow existing patterns or introduce a new one? If new, is it justified?
54
+ - Does it maintain clean module boundaries?
55
+ - Is there code duplication that should be shared?
56
+ - Are dependencies flowing in the right direction (no circular dependencies)?
57
+ - Is the abstraction level appropriate (not over-engineered, not too coupled)?
58
+
59
+ ### 4. Security
60
+
61
+ For detailed security guidance, see `security-and-hardening`. Does the change introduce vulnerabilities?
62
+
63
+ - Is user input validated and sanitized?
64
+ - Are secrets kept out of code, logs, and version control?
65
+ - Is authentication/authorization checked where needed?
66
+ - Are SQL queries parameterized (no string concatenation)?
67
+ - Are outputs encoded to prevent XSS?
68
+ - Are dependencies from trusted sources with no known vulnerabilities?
69
+ - Is data from external sources (APIs, logs, user content, config files) treated as untrusted?
70
+ - Are external data flows validated at system boundaries before use in logic or rendering?
71
+
72
+ ### 5. Performance
73
+
74
+ For detailed profiling and optimization, see `performance-optimization`. Does the change introduce performance problems?
75
+
76
+ - Any N+1 query patterns?
77
+ - Any unbounded loops or unconstrained data fetching?
78
+ - Any synchronous operations that should be async?
79
+ - Any unnecessary re-renders in UI components?
80
+ - Any missing pagination on list endpoints?
81
+ - Any large objects created in hot paths?
82
+
83
+ ## Change Sizing
84
+
85
+ Small, focused changes are easier to review, faster to merge, and safer to deploy. Target these sizes:
86
+
87
+ ```
88
+ ~100 lines changed → Good. Reviewable in one sitting.
89
+ ~300 lines changed → Acceptable if it's a single logical change.
90
+ ~1000 lines changed → Too large. Split it.
91
+ ```
92
+
93
+ **What counts as "one change":** A single self-contained modification that addresses one thing, includes related tests, and keeps the system functional after submission. One part of a feature — not the whole feature.
94
+
95
+ **Splitting strategies when a change is too large:**
96
+
97
+ | Strategy | How | When |
98
+ |----------|-----|------|
99
+ | **Stack** | Submit a small change, start the next one based on it | Sequential dependencies |
100
+ | **By file group** | Separate changes for groups needing different reviewers | Cross-cutting concerns |
101
+ | **Horizontal** | Create shared code/stubs first, then consumers | Layered architecture |
102
+ | **Vertical** | Break into smaller full-stack slices of the feature | Feature work |
103
+
104
+ **When large changes are acceptable:** Complete file deletions and automated refactoring where the reviewer only needs to verify intent, not every line.
105
+
106
+ **Separate refactoring from feature work.** A change that refactors existing code and adds new behavior is two changes — submit them separately. Small cleanups (variable renaming) can be included at reviewer discretion.
107
+
108
+ ## Change Descriptions
109
+
110
+ Every change needs a description that stands alone in version control history.
111
+
112
+ **First line:** Short, imperative, standalone. "Delete the FizzBuzz RPC" not "Deleting the FizzBuzz RPC." Must be informative enough that someone searching history can understand the change without reading the diff.
113
+
114
+ **Body:** What is changing and why. Include context, decisions, and reasoning not visible in the code itself. Link to bug numbers, benchmark results, or design docs where relevant. Acknowledge approach shortcomings when they exist.
115
+
116
+ **Anti-patterns:** "Fix bug," "Fix build," "Add patch," "Moving code from A to B," "Phase 1," "Add convenience functions."
117
+
118
+ ## Review Process
119
+
120
+ ### Step 1: Understand the Context
121
+
122
+ Before looking at code, understand the intent:
123
+
124
+ ```
125
+ - What is this change trying to accomplish?
126
+ - What spec or task does it implement?
127
+ - What is the expected behavior change?
128
+ ```
129
+
130
+ ### Step 2: Review the Tests First
131
+
132
+ Tests reveal intent and coverage:
133
+
134
+ ```
135
+ - Do tests exist for the change?
136
+ - Do they test behavior (not implementation details)?
137
+ - Are edge cases covered?
138
+ - Do tests have descriptive names?
139
+ - Would the tests catch a regression if the code changed?
140
+ ```
141
+
142
+ ### Step 3: Review the Implementation
143
+
144
+ Walk through the code with the five axes in mind:
145
+
146
+ ```
147
+ For each file changed:
148
+ 1. Correctness: Does this code do what the test says it should?
149
+ 2. Readability: Can I understand this without help?
150
+ 3. Architecture: Does this fit the system?
151
+ 4. Security: Any vulnerabilities?
152
+ 5. Performance: Any bottlenecks?
153
+ ```
154
+
155
+ ### Step 4: Categorize Findings
156
+
157
+ Label every comment with its severity so the author knows what's required vs optional:
158
+
159
+ | Prefix | Meaning | Author Action |
160
+ |--------|---------|---------------|
161
+ | *(no prefix)* | Required change | Must address before merge |
162
+ | **Critical:** | Blocks merge | Security vulnerability, data loss, broken functionality |
163
+ | **Nit:** | Minor, optional | Author may ignore — formatting, style preferences |
164
+ | **Optional:** / **Consider:** | Suggestion | Worth considering but not required |
165
+ | **FYI** | Informational only | No action needed — context for future reference |
166
+
167
+ This prevents authors from treating all feedback as mandatory and wasting time on optional suggestions.
168
+
169
+ ### Step 5: Verify the Verification
170
+
171
+ Check the author's verification story:
172
+
173
+ ```
174
+ - What tests were run?
175
+ - Did the build pass?
176
+ - Was the change tested manually?
177
+ - Are there screenshots for UI changes?
178
+ - Is there a before/after comparison?
179
+ ```
180
+
181
+ ## Multi-Model Review Pattern
182
+
183
+ Use different models for different review perspectives:
184
+
185
+ ```
186
+ Model A writes the code
187
+
188
+
189
+ Model B reviews for correctness and architecture
190
+
191
+
192
+ Model A addresses the feedback
193
+
194
+
195
+ Human makes the final call
196
+ ```
197
+
198
+ This catches issues that a single model might miss — different models have different blind spots.
199
+
200
+ **Example prompt for a review agent:**
201
+ ```
202
+ Review this code change for correctness, security, and adherence to
203
+ our project conventions. The spec says [X]. The change should [Y].
204
+ Flag any issues as Critical, Important, or Suggestion.
205
+ ```
206
+
207
+ ## Dead Code Hygiene
208
+
209
+ After any refactoring or implementation change, check for orphaned code:
210
+
211
+ 1. Identify code that is now unreachable or unused
212
+ 2. List it explicitly
213
+ 3. **Ask before deleting:** "Should I remove these now-unused elements: [list]?"
214
+
215
+ Don't leave dead code lying around — it confuses future readers and agents. But don't silently delete things you're not sure about. When in doubt, ask.
216
+
217
+ ```
218
+ DEAD CODE IDENTIFIED:
219
+ - formatLegacyDate() in src/utils/date.ts — replaced by formatDate()
220
+ - OldTaskCard component in src/components/ — replaced by TaskCard
221
+ - LEGACY_API_URL constant in src/config.ts — no remaining references
222
+ → Safe to remove these?
223
+ ```
224
+
225
+ ## Review Speed
226
+
227
+ Slow reviews block entire teams. The cost of context-switching to review is less than the waiting cost imposed on others.
228
+
229
+ - **Respond within one business day** — this is the maximum, not the target
230
+ - **Ideal cadence:** Respond shortly after a review request arrives, unless deep in focused coding. A typical change should complete multiple review rounds in a single day
231
+ - **Prioritize fast individual responses** over quick final approval. Quick feedback reduces frustration even if multiple rounds are needed
232
+ - **Large changes:** Ask the author to split them rather than reviewing one massive changeset
233
+
234
+ ## Handling Disagreements
235
+
236
+ When resolving review disputes, apply this hierarchy:
237
+
238
+ 1. **Technical facts and data** override opinions and preferences
239
+ 2. **Style guides** are the absolute authority on style matters
240
+ 3. **Software design** must be evaluated on engineering principles, not personal preference
241
+ 4. **Codebase consistency** is acceptable if it doesn't degrade overall health
242
+
243
+ **Don't accept "I'll clean it up later."** Experience shows deferred cleanup rarely happens. Require cleanup before submission unless it's a genuine emergency. If surrounding issues can't be addressed in this change, require filing a bug with self-assignment.
244
+
245
+ ## Honesty in Review
246
+
247
+ When reviewing code — whether written by you, another agent, or a human:
248
+
249
+ - **Don't rubber-stamp.** "LGTM" without evidence of review helps no one.
250
+ - **Don't soften real issues.** "This might be a minor concern" when it's a bug that will hit production is dishonest.
251
+ - **Quantify problems when possible.** "This N+1 query will add ~50ms per item in the list" is better than "this could be slow."
252
+ - **Push back on approaches with clear problems.** Sycophancy is a failure mode in reviews. If the implementation has issues, say so directly and propose alternatives.
253
+ - **Accept override gracefully.** If the author has full context and disagrees, defer to their judgment. Comment on code, not people — reframe personal critiques to focus on the code itself.
254
+
255
+ ## Dependency Discipline
256
+
257
+ Part of code review is dependency review:
258
+
259
+ **Before adding any dependency:**
260
+ 1. Does the existing stack solve this? (Often it does.)
261
+ 2. How large is the dependency? (Check bundle impact.)
262
+ 3. Is it actively maintained? (Check last commit, open issues.)
263
+ 4. Does it have known vulnerabilities? (`npm audit`)
264
+ 5. What's the license? (Must be compatible with the project.)
265
+
266
+ **Rule:** Prefer standard library and existing utilities over new dependencies. Every dependency is a liability.
267
+
268
+ ## The Review Checklist
269
+
270
+ ```markdown
271
+ ## Review: [PR/Change title]
272
+
273
+ ### Context
274
+ - [ ] I understand what this change does and why
275
+
276
+ ### Correctness
277
+ - [ ] Change matches spec/task requirements
278
+ - [ ] Edge cases handled
279
+ - [ ] Error paths handled
280
+ - [ ] Tests cover the change adequately
281
+
282
+ ### Readability
283
+ - [ ] Names are clear and consistent
284
+ - [ ] Logic is straightforward
285
+ - [ ] No unnecessary complexity
286
+
287
+ ### Architecture
288
+ - [ ] Follows existing patterns
289
+ - [ ] No unnecessary coupling or dependencies
290
+ - [ ] Appropriate abstraction level
291
+
292
+ ### Security
293
+ - [ ] No secrets in code
294
+ - [ ] Input validated at boundaries
295
+ - [ ] No injection vulnerabilities
296
+ - [ ] Auth checks in place
297
+ - [ ] External data sources treated as untrusted
298
+
299
+ ### Performance
300
+ - [ ] No N+1 patterns
301
+ - [ ] No unbounded operations
302
+ - [ ] Pagination on list endpoints
303
+
304
+ ### Verification
305
+ - [ ] Tests pass
306
+ - [ ] Build succeeds
307
+ - [ ] Manual verification done (if applicable)
308
+
309
+ ### Verdict
310
+ - [ ] **Approve** — Ready to merge
311
+ - [ ] **Request changes** — Issues must be addressed
312
+ ```
313
+ ## See Also
314
+
315
+ - For detailed security review guidance, see `references/security-checklist.md`
316
+ - For performance review checks, see `references/performance-checklist.md`
317
+
318
+ ## Common Rationalizations
319
+
320
+ | Rationalization | Reality |
321
+ |---|---|
322
+ | "It works, that's good enough" | Working code that's unreadable, insecure, or architecturally wrong creates debt that compounds. |
323
+ | "I wrote it, so I know it's correct" | Authors are blind to their own assumptions. Every change benefits from another set of eyes. |
324
+ | "We'll clean it up later" | Later never comes. The review is the quality gate — use it. Require cleanup before merge, not after. |
325
+ | "AI-generated code is probably fine" | AI code needs more scrutiny, not less. It's confident and plausible, even when wrong. |
326
+ | "The tests pass, so it's good" | Tests are necessary but not sufficient. They don't catch architecture problems, security issues, or readability concerns. |
327
+
328
+ ## Red Flags
329
+
330
+ - PRs merged without any review
331
+ - Review that only checks if tests pass (ignoring other axes)
332
+ - "LGTM" without evidence of actual review
333
+ - Security-sensitive changes without security-focused review
334
+ - Large PRs that are "too big to review properly" (split them)
335
+ - No regression tests with bug fix PRs
336
+ - Review comments without severity labels — makes it unclear what's required vs optional
337
+ - Accepting "I'll fix it later" — it never happens
338
+
339
+ ## Verification
340
+
341
+ After review is complete:
342
+
343
+ - [ ] All Critical issues are resolved
344
+ - [ ] All Important issues are resolved or explicitly deferred with justification
345
+ - [ ] Tests pass
346
+ - [ ] Build succeeds
347
+ - [ ] The verification story is documented (what changed, how it was verified)