@kennethsolomon/shipkit 3.19.0 → 3.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -4
- package/package.json +1 -1
- package/skills/sk:brainstorming/SKILL.md +19 -128
- package/skills/sk:debug/SKILL.md +44 -111
- package/skills/sk:e2e/SKILL.md +45 -97
- package/skills/sk:features/SKILL.md +44 -99
- package/skills/sk:frontend-design/SKILL.md +16 -32
- package/skills/sk:laravel-init/SKILL.md +8 -7
- package/skills/sk:laravel-new/SKILL.md +1 -0
- package/skills/sk:lint/SKILL.md +42 -62
- package/skills/sk:mvp/SKILL.md +81 -134
- package/skills/sk:perf/SKILL.md +24 -43
- package/skills/sk:review/SKILL.md +57 -93
- package/skills/sk:security-check/SKILL.md +37 -43
- package/skills/sk:seo-audit/SKILL.md +75 -96
- package/skills/sk:setup-claude/SKILL.md +154 -0
- package/skills/sk:setup-claude/references/skill-profiles.md +223 -0
- package/skills/sk:setup-claude/scripts/__pycache__/apply_setup_claude.cpython-314.pyc +0 -0
- package/skills/sk:setup-claude/scripts/apply_setup_claude.py +110 -10
- package/skills/sk:setup-claude/templates/.claude/rules/laravel.md.template +14 -0
- package/skills/sk:setup-claude/templates/CLAUDE.md.template +102 -247
- package/skills/sk:setup-claude/templates/commands/brainstorm.md.template +1 -1
- package/skills/sk:setup-claude/templates/commands/execute-plan.md.template +1 -1
- package/skills/sk:setup-claude/templates/commands/finish-feature.md.template +1 -1
- package/skills/sk:setup-claude/templates/commands/security-check.md.template +1 -1
- package/skills/sk:setup-claude/templates/commands/write-plan.md.template +1 -1
- package/skills/sk:setup-claude/tests/__pycache__/test_apply_setup_claude.cpython-314.pyc +0 -0
- package/skills/sk:setup-claude/tests/test_apply_setup_claude.py +267 -0
- package/skills/sk:setup-optimizer/SKILL.md +101 -17
- package/skills/sk:skill-creator/SKILL.md +115 -226
- package/skills/sk:website/SKILL.md +81 -149
- package/skills/sk:write-tests/SKILL.md +44 -110
package/skills/sk:perf/SKILL.md
CHANGED
|
@@ -8,31 +8,28 @@ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Agent
|
|
|
8
8
|
|
|
9
9
|
## Purpose
|
|
10
10
|
|
|
11
|
-
Audit the implementation for performance issues before
|
|
12
|
-
|
|
13
|
-
Run this skill after implementing and passing lint/tests, but before `/sk:review`.
|
|
11
|
+
Audit the implementation for performance issues before `/sk:review`. Produces a findings report, fixes in-scope critical/high findings, auto-commits. Pre-existing findings (outside branch diff) are logged to `tasks/tech-debt.md`.
|
|
14
12
|
|
|
15
13
|
## Hard Rules
|
|
16
14
|
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
15
|
+
- Fix all critical and high in-scope findings (files in `git diff main..HEAD --name-only`). Re-run until critical/high = 0. ONE squash commit: `fix(perf): resolve performance findings`.
|
|
16
|
+
- Medium/low in-scope: fix if straightforward, otherwise log to `tasks/tech-debt.md`.
|
|
17
|
+
- Pre-existing findings (outside branch diff): log only — do NOT fix inline:
|
|
20
18
|
```
|
|
21
19
|
### [YYYY-MM-DD] Found during: sk:perf
|
|
22
20
|
File: path/to/file.ext:line
|
|
23
21
|
Issue: description of the performance issue
|
|
24
22
|
Severity: critical | high | medium | low
|
|
25
23
|
```
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
- **Auto-detect the stack** — only run checks relevant to what's present.
|
|
24
|
+
- Squash gate commits — one commit per pass, not per fix.
|
|
25
|
+
- Every finding must cite a specific file:line, estimated impact (high/medium/low), and a recommendation.
|
|
26
|
+
- Auto-detect stack — only run checks relevant to what's present.
|
|
30
27
|
|
|
31
28
|
## Before You Start
|
|
32
29
|
|
|
33
|
-
1. Detect
|
|
34
|
-
2. Determine scope: `git diff main..HEAD --name-only
|
|
35
|
-
3. If `tasks/perf-findings.md` exists, read it — check if prior findings
|
|
30
|
+
1. Detect stack: read `CLAUDE.md`, check for `package.json`, `composer.json`, `go.mod`, `requirements.txt`, `Cargo.toml`.
|
|
31
|
+
2. Determine scope: `git diff main..HEAD --name-only`.
|
|
32
|
+
3. If `tasks/perf-findings.md` exists, read it — check if prior findings were addressed.
|
|
36
33
|
4. If `tasks/lessons.md` exists, read it — apply performance-related lessons.
|
|
37
34
|
|
|
38
35
|
## Stack Detection
|
|
@@ -120,7 +117,7 @@ Run this skill after implementing and passing lint/tests, but before `/sk:review
|
|
|
120
117
|
|
|
121
118
|
## Generate Report
|
|
122
119
|
|
|
123
|
-
Write findings to `tasks/perf-findings.md
|
|
120
|
+
Write findings to `tasks/perf-findings.md` (never overwrite — append with date header):
|
|
124
121
|
|
|
125
122
|
```markdown
|
|
126
123
|
# Performance Audit — YYYY-MM-DD
|
|
@@ -167,13 +164,11 @@ Write findings to `tasks/perf-findings.md`:
|
|
|
167
164
|
| **Total** | **N** | **N** |
|
|
168
165
|
```
|
|
169
166
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
The report is written first, then fixes are applied to in-scope critical/high findings.
|
|
167
|
+
Write the report first, then apply fixes.
|
|
173
168
|
|
|
174
169
|
## Fix Critical/High Findings via Agent
|
|
175
170
|
|
|
176
|
-
|
|
171
|
+
Invoke the **`performance-optimizer`** agent:
|
|
177
172
|
|
|
178
173
|
```
|
|
179
174
|
Task: "Read tasks/perf-findings.md. Fix all Critical and High in-scope findings
|
|
@@ -181,43 +176,29 @@ Task: "Read tasks/perf-findings.md. Fix all Critical and High in-scope findings
|
|
|
181
176
|
pass before AND after. Commit: fix(perf): resolve performance findings"
|
|
182
177
|
```
|
|
183
178
|
|
|
184
|
-
|
|
179
|
+
Agent works in worktree isolation. After completion, merge its worktree branch and verify fixes in `tasks/perf-findings.md`.
|
|
185
180
|
|
|
186
|
-
##
|
|
181
|
+
## Fix & Retest Protocol
|
|
187
182
|
|
|
188
|
-
|
|
183
|
+
| Fix type | Action |
|
|
184
|
+
|----------|--------|
|
|
185
|
+
| Config/infrastructure (cache headers, compression, CDN config, pool size) | Commit → re-run `/sk:perf`. No test update needed. |
|
|
186
|
+
| Logic change (N+1 fix, algorithm refactor, pagination, data structure) | 1) Update/add failing tests 2) `/sk:test` at 100% 3) Commit tests+fix together 4) Re-run `/sk:perf` |
|
|
187
|
+
|
|
188
|
+
Logic changes include: N+1 fix (query count/data shape), algorithm change (output correctness), pagination (result set size). Tests must verify the optimized path produces correct results.
|
|
189
|
+
|
|
190
|
+
## When Done
|
|
189
191
|
|
|
190
192
|
> "Performance audit complete. Findings saved to `tasks/perf-findings.md`.
|
|
191
193
|
> - **Critical:** N | **High:** N | **Medium:** N | **Low:** N
|
|
192
194
|
>
|
|
193
195
|
> All critical/high in-scope findings have been fixed and committed. Pre-existing issues logged to `tasks/tech-debt.md`. Run `/sk:review` to proceed."
|
|
194
196
|
|
|
195
|
-
If
|
|
197
|
+
If no critical/high findings:
|
|
196
198
|
> "No critical or high performance issues found. N medium/low findings noted in `tasks/perf-findings.md`. Run `/sk:review` to proceed."
|
|
197
199
|
|
|
198
200
|
---
|
|
199
201
|
|
|
200
|
-
## Fix & Retest Protocol
|
|
201
|
-
|
|
202
|
-
When applying a performance fix, classify it before committing:
|
|
203
|
-
|
|
204
|
-
**a. Config/infrastructure change** (adding cache headers, enabling compression, changing CDN config, adjusting connection pool size) → commit and re-run `/sk:perf`. No test update needed.
|
|
205
|
-
|
|
206
|
-
**b. Logic change** (fixing N+1 query by changing data-fetching logic, refactoring algorithm, modifying data structure, changing pagination logic) → trigger protocol:
|
|
207
|
-
1. Update or add failing unit tests for the new optimized behavior
|
|
208
|
-
2. Re-run `/sk:test` — must pass at 100% coverage
|
|
209
|
-
3. Commit (tests + fix together in one commit)
|
|
210
|
-
4. Re-run `/sk:perf` to verify the fix resolved the finding
|
|
211
|
-
|
|
212
|
-
**Common logic-change performance fixes:**
|
|
213
|
-
- N+1 fix: changes how related data is fetched → update tests that assert on query count or data shape
|
|
214
|
-
- Algorithm change: O(n²) → O(n log n) → update tests that assert on output correctness
|
|
215
|
-
- Pagination: adding LIMIT/offset → update tests that assert on result set size
|
|
216
|
-
|
|
217
|
-
**Why:** Performance fixes often change how data is fetched or processed. Tests must verify the optimized path produces correct results.
|
|
218
|
-
|
|
219
|
-
---
|
|
220
|
-
|
|
221
202
|
## Model Routing
|
|
222
203
|
|
|
223
204
|
Read `.shipkit/config.json` from the project root if it exists.
|
|
@@ -8,124 +8,102 @@ model: sonnet
|
|
|
8
8
|
|
|
9
9
|
## Overview
|
|
10
10
|
|
|
11
|
-
Perform a rigorous, multi-dimensional review of all changes on the current branch.
|
|
11
|
+
Perform a rigorous, multi-dimensional review of all changes on the current branch. Quality bar: senior engineer at a top-tier tech company — thorough, specific, and honest.
|
|
12
12
|
|
|
13
|
-
**You are the reviewer, not the cheerleader.**
|
|
13
|
+
**You are the reviewer, not the cheerleader.** Find problems, not praise. If you find nothing wrong, look harder. Think about what could go wrong in production at scale, under adversarial conditions, and over time.
|
|
14
14
|
|
|
15
|
-
This is a **report-only** step.
|
|
15
|
+
This is a **report-only** step. Critical or Warning issues loop back to `/sk:debug` → `/sk:smart-commit` → `/sk:review` until clean. Then run `/sk:finish-feature`.
|
|
16
16
|
|
|
17
|
-
**exhaustiveness commitment:**
|
|
17
|
+
**exhaustiveness commitment:** Every dimension (Steps 3–9) must be fully analyzed before generating the report. Skipping a dimension is a failure. If nothing is found in a dimension, state `"No issues found"` explicitly.
|
|
18
18
|
|
|
19
19
|
## Allowed Tools
|
|
20
20
|
|
|
21
21
|
Bash, Read, Glob, Grep, Skill
|
|
22
22
|
|
|
23
|
-
**Step 0 only:** the `simplify` skill
|
|
23
|
+
**Step 0 only:** the `simplify` skill carries its own Write/Edit permissions. All other steps are read-only — no direct Write or Edit calls.
|
|
24
24
|
|
|
25
25
|
## Steps
|
|
26
26
|
|
|
27
|
-
You MUST complete these steps in order:
|
|
28
|
-
|
|
29
27
|
### 0. Run Simplify First
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
Invoke the built-in `simplify` skill on the changed files:
|
|
32
30
|
|
|
33
31
|
> "Review the changed files on this branch for reuse, quality, and efficiency. Fix any issues found."
|
|
34
32
|
|
|
35
|
-
Use `git diff main..HEAD --name-only` to identify
|
|
33
|
+
Use `git diff main..HEAD --name-only` to identify changed files, then run simplify on them.
|
|
36
34
|
|
|
37
|
-
If simplify makes
|
|
35
|
+
If simplify makes changes:
|
|
38
36
|
1. Verify the changes are correct
|
|
39
|
-
2. Auto-commit
|
|
37
|
+
2. Auto-commit with `fix(review): simplify pre-pass` — do not ask the user
|
|
40
38
|
3. Note in the review report: "Simplify pre-pass: X files updated"
|
|
41
39
|
|
|
42
|
-
If simplify makes no changes, proceed directly to step 1.
|
|
43
|
-
|
|
44
|
-
**Note:** Simplify runs automatically as part of `/sk:review` — users do not need to run it separately.
|
|
45
|
-
|
|
46
40
|
### 1. Read Project Context
|
|
47
41
|
|
|
48
42
|
```
|
|
49
43
|
CLAUDE.md — Coding standards, conventions, known patterns
|
|
50
|
-
tasks/lessons.md — Recurrent bug patterns
|
|
44
|
+
tasks/lessons.md — Recurrent bug patterns (if exists)
|
|
51
45
|
tasks/security-findings.md — Prior security audit results (if exists)
|
|
52
46
|
```
|
|
53
47
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
If `tasks/lessons.md` exists, read it in full. Use each active lesson's **Bug** field
|
|
57
|
-
as an additional targeted check during analysis — treat each lesson as a known failure
|
|
58
|
-
mode to explicitly scan for across all review dimensions.
|
|
48
|
+
If `tasks/lessons.md` exists, treat each active lesson's **Bug** field as an additional targeted check across all dimensions.
|
|
59
49
|
|
|
60
|
-
If `tasks/security-findings.md` exists,
|
|
61
|
-
Critical/High findings as additional targeted checks — verify the current diff doesn't
|
|
62
|
-
reintroduce previously flagged vulnerabilities.
|
|
50
|
+
If `tasks/security-findings.md` exists, verify the current diff doesn't reintroduce previously flagged unresolved Critical/High vulnerabilities.
|
|
63
51
|
|
|
64
52
|
### 2. Collect Changes + Blast Radius
|
|
65
53
|
|
|
66
|
-
|
|
54
|
+
Build a **blast radius** — the minimal set of files that could be affected by the changes.
|
|
67
55
|
|
|
68
56
|
**2a — Baseline git info:**
|
|
69
57
|
|
|
70
58
|
```bash
|
|
71
|
-
# Determine base branch
|
|
72
59
|
BASE=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo "main")
|
|
73
|
-
|
|
74
|
-
# Changed files and stats
|
|
75
60
|
CHANGED_FILES=$(git diff $BASE..HEAD --name-only)
|
|
76
61
|
git diff $BASE..HEAD --stat
|
|
77
62
|
git log $BASE..HEAD --oneline
|
|
78
|
-
|
|
79
|
-
# Full diff for reference
|
|
80
63
|
git diff $BASE..HEAD
|
|
81
|
-
|
|
82
|
-
# Check for uncommitted changes
|
|
83
64
|
git status --short
|
|
84
65
|
```
|
|
85
66
|
|
|
86
|
-
If
|
|
67
|
+
If uncommitted changes exist, warn:
|
|
87
68
|
> **Warning:** You have uncommitted changes. These will NOT be included in the review. Commit or stash them first.
|
|
88
69
|
|
|
89
70
|
**2b — Extract changed symbols:**
|
|
90
71
|
|
|
91
|
-
Use
|
|
72
|
+
Use git hunk headers as the primary extraction method:
|
|
92
73
|
|
|
93
74
|
```bash
|
|
94
|
-
# Phase 1: Enclosing scope names from hunk headers
|
|
75
|
+
# Phase 1: Enclosing scope names from hunk headers
|
|
95
76
|
git diff $BASE..HEAD -U0 | grep '^@@' | sed 's/.*@@\s*//' | \
|
|
96
77
|
grep -oE '[A-Za-z_][A-Za-z0-9_]*\s*\(' | sed 's/\s*(//' | sort -u
|
|
97
78
|
```
|
|
98
79
|
|
|
99
|
-
|
|
80
|
+
Supplement with new/modified definitions from added lines:
|
|
100
81
|
|
|
101
82
|
```bash
|
|
102
|
-
# Phase 2: Definitions from added lines
|
|
103
|
-
# JS/TS:
|
|
104
|
-
# Python:
|
|
105
|
-
# Go:
|
|
106
|
-
# PHP:
|
|
107
|
-
# Rust:
|
|
83
|
+
# Phase 2: Definitions from added lines
|
|
84
|
+
# JS/TS: function foo(, class Foo, interface Foo
|
|
85
|
+
# Python: def foo(, class Foo
|
|
86
|
+
# Go: func foo(, func (r *T) foo(
|
|
87
|
+
# PHP: function foo(, class Foo
|
|
88
|
+
# Rust: fn foo(, struct Foo, impl Foo, trait Foo
|
|
108
89
|
git diff $BASE..HEAD | grep '^+' | grep -v '^+++' | \
|
|
109
90
|
grep -oE '(function|class|interface|def|fn|func|struct|trait|impl)\s+[A-Za-z_][A-Za-z0-9_]+' | \
|
|
110
91
|
awk '{print $2}' | sort -u
|
|
111
92
|
```
|
|
112
93
|
|
|
113
|
-
Combine both phases. Filter
|
|
94
|
+
Combine both phases. Filter symbols shorter than 3 characters.
|
|
114
95
|
|
|
115
96
|
Classify each symbol:
|
|
116
|
-
- **Modified/removed** — existed before the branch, changed or deleted
|
|
117
|
-
- **New** — added in this branch, no prior callers
|
|
97
|
+
- **Modified/removed** — existed before the branch, changed or deleted. **Run blast radius.**
|
|
98
|
+
- **New** — added in this branch, no prior callers. **Skip blast radius.**
|
|
118
99
|
|
|
119
|
-
To classify, check if the symbol appears in the base branch:
|
|
120
100
|
```bash
|
|
121
|
-
# If symbol exists in base branch
|
|
101
|
+
# If symbol exists in base branch, it's modified/removed → needs blast radius
|
|
122
102
|
git show $BASE:$FILE 2>/dev/null | grep -q "\b$SYMBOL\b"
|
|
123
103
|
```
|
|
124
104
|
|
|
125
105
|
**2c — Find blast radius (modified/removed symbols only):**
|
|
126
106
|
|
|
127
|
-
For each modified/removed symbol, use **import-chain narrowing** to find dependents with minimal false positives:
|
|
128
|
-
|
|
129
107
|
```bash
|
|
130
108
|
# Step 1: Find files that import the module containing the changed symbol
|
|
131
109
|
CHANGED_MODULE_PATHS=$(echo "$CHANGED_FILES" | sed 's/\.[^.]*$//' | sed 's/\/index$//')
|
|
@@ -141,11 +119,10 @@ for symbol in $MODIFIED_SYMBOLS; do
|
|
|
141
119
|
rg -wl "$symbol" $(cat /tmp/importers.txt) 2>/dev/null
|
|
142
120
|
done | sort -u > /tmp/dependents.txt
|
|
143
121
|
|
|
144
|
-
# Remove files already in the changed set
|
|
145
122
|
comm -23 /tmp/dependents.txt <(echo "$CHANGED_FILES" | sort) > /tmp/blast_radius.txt
|
|
146
123
|
```
|
|
147
124
|
|
|
148
|
-
**Noise guard:** If a symbol produces >100 matches,
|
|
125
|
+
**Noise guard:** If a symbol produces >100 matches, note: "unable to determine blast radius for `symbol` — manual verification recommended."
|
|
149
126
|
|
|
150
127
|
Log the blast radius before reading:
|
|
151
128
|
```
|
|
@@ -165,14 +142,12 @@ Symbol → Dependents:
|
|
|
165
142
|
**2d — Read context (focused, not exhaustive):**
|
|
166
143
|
|
|
167
144
|
Read in this priority order:
|
|
168
|
-
1. **Changed files in full** — not just the diff.
|
|
145
|
+
1. **Changed files in full** — not just the diff. For files >500 lines, read the changed function + 30 lines of surrounding context.
|
|
169
146
|
2. **The diff** — for precise change tracking (already collected above).
|
|
170
|
-
3. **Blast-radius dependent files** —
|
|
147
|
+
3. **Blast-radius dependent files** — use `rg -B5 -A10 "\bsymbol\b" dependent_file` to get call sites with context, not the entire file.
|
|
171
148
|
4. **Test files** for changed symbols — verify existing tests still cover the changed behavior.
|
|
172
149
|
|
|
173
|
-
Do
|
|
174
|
-
|
|
175
|
-
Carry the blast-radius mapping (symbol → dependents) forward into Steps 3-9. When analyzing a changed function, always cross-reference its dependents.
|
|
150
|
+
Do not read unchanged files outside the blast radius. Carry the blast-radius mapping (symbol → dependents) forward into Steps 3–9.
|
|
176
151
|
|
|
177
152
|
> Before analyzing this dimension, use a `<think>` block to: (1) identify which changed files and blast-radius dependents are most relevant here, and (2) list 3–5 specific things to look for given the nature of the change. This reasoning is not shown to the user — it improves analysis depth.
|
|
178
153
|
|
|
@@ -180,7 +155,7 @@ Carry the blast-radius mapping (symbol → dependents) forward into Steps 3-9. W
|
|
|
180
155
|
|
|
181
156
|
The most important dimension. A bug that ships is worse than ugly code that works.
|
|
182
157
|
|
|
183
|
-
**Blast-radius check (mandatory):** For every modified/removed symbol, verify its dependents (from Step 2c)
|
|
158
|
+
**Blast-radius check (mandatory):** For every modified/removed symbol, verify its dependents (from Step 2c):
|
|
184
159
|
- Do callers pass arguments the changed function still accepts?
|
|
185
160
|
- Do callers depend on return values whose shape/type changed?
|
|
186
161
|
- Do callers rely on side effects the changed code no longer produces?
|
|
@@ -219,11 +194,9 @@ The most important dimension. A bug that ships is worse than ugly code that work
|
|
|
219
194
|
|
|
220
195
|
### 4. Analyze — Security
|
|
221
196
|
|
|
222
|
-
Load `references/security-checklist.md` and apply its grep patterns against the **diff and blast-radius files**
|
|
197
|
+
Load `references/security-checklist.md` and apply its grep patterns against the **diff and blast-radius files** only. Flag only patterns **newly introduced** in the diff.
|
|
223
198
|
|
|
224
|
-
**Blast-radius check:** If a validation or auth function was modified, check all its callers
|
|
225
|
-
|
|
226
|
-
Check for:
|
|
199
|
+
**Blast-radius check:** If a validation or auth function was modified, check all its callers — a weakened check affects every endpoint that depends on it.
|
|
227
200
|
|
|
228
201
|
**Injection (OWASP A03):**
|
|
229
202
|
- SQL, NoSQL, OS command, LDAP, template injection
|
|
@@ -233,7 +206,7 @@ Check for:
|
|
|
233
206
|
**Cross-Site Scripting (OWASP A03):**
|
|
234
207
|
- `dangerouslySetInnerHTML`, `innerHTML`, `v-html` without sanitization
|
|
235
208
|
- URL parameters reflected without encoding
|
|
236
|
-
- User content
|
|
209
|
+
- User content in `href`, `src`, or event handler attributes
|
|
237
210
|
|
|
238
211
|
**Authentication & Authorization (OWASP A01, A07):**
|
|
239
212
|
- Hardcoded secrets, API keys, tokens in source code
|
|
@@ -244,7 +217,7 @@ Check for:
|
|
|
244
217
|
**Data exposure (OWASP A02):**
|
|
245
218
|
- Credentials, PII, or tokens in logs
|
|
246
219
|
- Stack traces or internal errors leaked to clients
|
|
247
|
-
- Sensitive data in client-side bundles
|
|
220
|
+
- Sensitive data in client-side bundles
|
|
248
221
|
- Missing encryption for sensitive data at rest
|
|
249
222
|
|
|
250
223
|
**Configuration (OWASP A05):**
|
|
@@ -257,7 +230,7 @@ Check for:
|
|
|
257
230
|
|
|
258
231
|
### 5. Analyze — Performance
|
|
259
232
|
|
|
260
|
-
Think about what happens at 10x, 100x current scale.
|
|
233
|
+
Think about what happens at 10x, 100x current scale.
|
|
261
234
|
|
|
262
235
|
**Database & queries:**
|
|
263
236
|
- N+1 query patterns (fetching related data in a loop instead of a join or batch)
|
|
@@ -295,7 +268,7 @@ Think about what happens at 10x, 100x current scale. Performance bugs are often
|
|
|
295
268
|
|
|
296
269
|
### 6. Analyze — Reliability & Error Handling
|
|
297
270
|
|
|
298
|
-
|
|
271
|
+
The question isn't "does it work?" but "what happens when things go wrong?"
|
|
299
272
|
|
|
300
273
|
**Blast-radius check:** If error handling changed (e.g., function now throws instead of returning null, or error type changed), check all callers from Step 2c — they may not have matching try/catch or null checks.
|
|
301
274
|
|
|
@@ -307,7 +280,7 @@ Production code must handle failure gracefully. The question isn't "does it work
|
|
|
307
280
|
- Cleanup logic missing in error paths (connections, file handles, locks)
|
|
308
281
|
|
|
309
282
|
**Graceful degradation:**
|
|
310
|
-
- What happens when an external service is down?
|
|
283
|
+
- What happens when an external service is down?
|
|
311
284
|
- Missing fallback behavior for optional dependencies
|
|
312
285
|
- Timeout handling on external calls (HTTP, database, third-party APIs)
|
|
313
286
|
- Missing retry logic with backoff for transient failures
|
|
@@ -327,7 +300,7 @@ Production code must handle failure gracefully. The question isn't "does it work
|
|
|
327
300
|
|
|
328
301
|
### 7. Analyze — Design & Best Practices
|
|
329
302
|
|
|
330
|
-
Think about the next engineer who reads this code.
|
|
303
|
+
Think about the next engineer who reads this code.
|
|
331
304
|
|
|
332
305
|
**Separation of concerns:**
|
|
333
306
|
- Business logic mixed with presentation/routing/data access
|
|
@@ -336,7 +309,7 @@ Think about the next engineer who reads this code. Is the intent clear? Does the
|
|
|
336
309
|
|
|
337
310
|
**API design (if endpoints or function signatures changed):**
|
|
338
311
|
- Breaking changes to existing API contracts without versioning
|
|
339
|
-
- **Blast-radius check:** If a function signature changed,
|
|
312
|
+
- **Blast-radius check:** If a function signature changed, every dependent file that calls the old signature will break
|
|
340
313
|
- Inconsistent response format across endpoints
|
|
341
314
|
- Missing or inconsistent HTTP status codes
|
|
342
315
|
- Unclear or missing error response schema
|
|
@@ -349,7 +322,7 @@ Think about the next engineer who reads this code. Is the intent clear? Does the
|
|
|
349
322
|
- Deeply nested logic (>3 levels) that should be flattened with early returns
|
|
350
323
|
|
|
351
324
|
**Dependency management:**
|
|
352
|
-
- New dependencies
|
|
325
|
+
- New dependencies — necessary? Well-maintained? License-compatible?
|
|
353
326
|
- Are there lighter alternatives for heavy imports?
|
|
354
327
|
- Lock file updated when dependencies change?
|
|
355
328
|
|
|
@@ -357,12 +330,10 @@ Think about the next engineer who reads this code. Is the intent clear? Does the
|
|
|
357
330
|
|
|
358
331
|
### 8. Analyze — Framework-Specific
|
|
359
332
|
|
|
360
|
-
Based on what the project uses:
|
|
361
|
-
|
|
362
333
|
**React/Next.js:**
|
|
363
334
|
- Missing keys in list rendering (or using array index as key for dynamic lists)
|
|
364
335
|
- `useEffect` dependency arrays — missing deps cause stale data, unnecessary deps cause infinite loops
|
|
365
|
-
- Client vs server component boundaries (Next.js App Router) —
|
|
336
|
+
- Client vs server component boundaries (Next.js App Router) — hooks in server components, server-only code in client
|
|
366
337
|
- State updates on unmounted components
|
|
367
338
|
- Missing `Suspense` boundaries for async components
|
|
368
339
|
- Missing `ErrorBoundary` for component-level error isolation
|
|
@@ -399,18 +370,16 @@ Based on what the project uses:
|
|
|
399
370
|
|
|
400
371
|
If the diff includes test files, review them with the same rigor as production code.
|
|
401
372
|
|
|
402
|
-
- **Coverage gaps:**
|
|
403
|
-
- **Edge cases:**
|
|
373
|
+
- **Coverage gaps:** All new code paths exercised? Happy path AND error paths?
|
|
374
|
+
- **Edge cases:** Boundary conditions, empty inputs, invalid data?
|
|
404
375
|
- **Test isolation:** Do tests depend on external state, order, or other tests?
|
|
405
|
-
- **Assertion quality:**
|
|
376
|
+
- **Assertion quality:** Specific enough to catch regressions? (not just `toBeTruthy`)
|
|
406
377
|
- **Test naming:** Do test names describe the behavior being verified?
|
|
407
|
-
- **Mocking:**
|
|
378
|
+
- **Mocking:** Minimal and realistic? Over-mocking hides real bugs.
|
|
408
379
|
- **Flakiness risks:** Timing-dependent assertions, network calls, random data without seeding
|
|
409
380
|
|
|
410
381
|
### 10. Generate Review Report
|
|
411
382
|
|
|
412
|
-
Format findings with severity levels and review dimensions:
|
|
413
|
-
|
|
414
383
|
```markdown
|
|
415
384
|
## Code Review: [branch-name]
|
|
416
385
|
|
|
@@ -444,7 +413,7 @@ Format findings with severity levels and review dimensions:
|
|
|
444
413
|
**Severity guidelines:**
|
|
445
414
|
- **Critical:** Will cause bugs in production, security vulnerability, data loss, or crash. Must fix.
|
|
446
415
|
- **Warning:** Likely to cause problems at scale, makes future bugs likely, or degrades reliability/performance meaningfully. Should fix.
|
|
447
|
-
- **Nitpick:** Style, conventions, minor improvements. Won't break anything
|
|
416
|
+
- **Nitpick:** Style, conventions, minor improvements. Won't break anything.
|
|
448
417
|
|
|
449
418
|
**Rules:**
|
|
450
419
|
- Maximum 20 items total (prioritize by severity, then by category)
|
|
@@ -452,16 +421,15 @@ Format findings with severity levels and review dimensions:
|
|
|
452
421
|
- Use `[Blast Radius]` for issues found in dependent files — callers broken by changed signatures, importers affected by removed exports, tests that no longer cover the changed behavior
|
|
453
422
|
- Every item must reference a specific file, line, and symbol using `[FILE:LINE:SYMBOL]` format
|
|
454
423
|
- Every item must explain **why** it matters — the impact, not just the symptom
|
|
455
|
-
- Include
|
|
456
|
-
- If you genuinely find nothing wrong after all 7 dimensions, say so — but that's rare
|
|
424
|
+
- Include "What Looks Good" (2-3 items) — acknowledge strong patterns to reinforce them
|
|
457
425
|
|
|
458
426
|
### 11. Fix and Re-run
|
|
459
427
|
|
|
460
|
-
|
|
428
|
+
Fix **all** findings regardless of severity. Do not ask whether to fix nitpicks.
|
|
461
429
|
|
|
462
430
|
**For each finding:**
|
|
463
|
-
-
|
|
464
|
-
-
|
|
431
|
+
- Issue in a file **within** the current branch diff → fix it inline, include in auto-commit
|
|
432
|
+
- Issue in a file **outside** the current branch diff (pre-existing, found via blast-radius) → log to `tasks/tech-debt.md`, do NOT fix inline:
|
|
465
433
|
```
|
|
466
434
|
### [YYYY-MM-DD] Found during: sk:review
|
|
467
435
|
File: path/to/file.ext:line
|
|
@@ -469,28 +437,24 @@ After presenting the review report, fix **all** findings regardless of severity
|
|
|
469
437
|
Severity: critical | high | medium | low
|
|
470
438
|
```
|
|
471
439
|
|
|
472
|
-
After all in-scope fixes
|
|
473
|
-
|
|
474
|
-
Loop until the review is completely clean (0 findings across all severities for in-scope code).
|
|
440
|
+
After all in-scope fixes: make ONE squash commit `fix(review): address review findings`. Re-run `/sk:review` from scratch. Loop until 0 findings.
|
|
475
441
|
|
|
476
442
|
When clean:
|
|
477
443
|
> "Review complete — 0 findings. Run `/sk:finish-feature` to finalize the branch and create a PR."
|
|
478
444
|
|
|
479
|
-
> Squash gate commits — collect all fixes for the pass, then one commit. Do not commit after each individual fix.
|
|
480
|
-
|
|
481
445
|
### Fix & Retest Protocol
|
|
482
446
|
|
|
483
|
-
|
|
447
|
+
Classify each fix before committing:
|
|
484
448
|
|
|
485
449
|
**a. Style/naming/comment change** (rename variable, add doc comment, reorder imports, extract constant) → commit and re-run `/sk:review`. No test update needed.
|
|
486
450
|
|
|
487
|
-
**b. Logic change** (fix incorrect condition, add missing null check, change data flow, refactor algorithm, fix async bug)
|
|
451
|
+
**b. Logic change** (fix incorrect condition, add missing null check, change data flow, refactor algorithm, fix async bug):
|
|
488
452
|
1. Update or add failing unit tests for the corrected behavior
|
|
489
453
|
2. Re-run `/sk:test` — must pass at 100% coverage
|
|
490
|
-
3. Auto-commit tests + fix together with `fix(review): [description]
|
|
454
|
+
3. Auto-commit tests + fix together with `fix(review): [description]`
|
|
491
455
|
4. Re-run `/sk:review` from scratch
|
|
492
456
|
|
|
493
|
-
**Why:**
|
|
457
|
+
**Why:** Fixing a logic bug without updating tests leaves the test suite asserting on the old (wrong) behavior.
|
|
494
458
|
|
|
495
459
|
---
|
|
496
460
|
|