Claude-code-blueprint review-diff
Scan git diffs for project-specific anti-patterns. Triggers on: 'scan diff', 'check diff', 'anti-pattern check', 'pattern scan', 'review changes'.
install
source · Clone the upstream repo
git clone https://github.com/faizkhairi/claude-code-blueprint
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/faizkhairi/claude-code-blueprint "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/review-diff" ~/.claude/skills/faizkhairi-claude-code-blueprint-review-diff && rm -rf "$T"
manifest:
skills/review-diff/SKILL.mdsource content
Scan a git diff for project-specific anti-patterns. This is a fast, targeted scan (seconds) -- not a full code review. Use
/review for comprehensive analysis.
Step 0: Detect project
Ensure you are inside a git repository before running diff commands:
- If cwd is a git repo: use it
- If recent context references a project:
into it firstcd - Check
orCLAUDE.md
in the project root to identify the framework and project-specific patternspackage.json - If unclear: ask which project
Step 1: Get the diff
Determine the diff source from
$ARGUMENTS:
- No arguments: Run
(unstaged) +git diff
(staged). Combine both outputs.git diff --cached - Branch name (e.g.,
): Runfeat/xyzgit diff main...$ARGUMENTS - Commit range (e.g.,
): RunHEAD~3..HEADgit diff $ARGUMENTS - Single commit hash: Run
git diff $ARGUMENTS~1..$ARGUMENTS
If the diff is empty, report "No changes to scan." and stop.
Step 2: Scan for anti-patterns
Analyze ONLY
+ lines (additions) in the diff. For each pattern below, search the added lines and the surrounding file context when needed.
Pattern Table
| # | Pattern | What to look for | Severity |
|---|---|---|---|
| 1 | Filter logic mismatch | String comparisons where one value could be a prefix of the other (e.g., when value could be ). Also: inconsistent use of vs on the same field across the diff. This requires semantic understanding -- not just regex. | HIGH |
| 2 | Auth gaps | New , , , , , without a corresponding or in the same file. Read the full file if needed to check. | HIGH |
| 3 | Soft-delete violations | , , , in Prisma/SQL without corresponding or in the same block. Many projects require soft-delete: + . Check for the project's soft-delete convention. | CRITICAL |
| 4 | API call pattern | or in files when the project uses a custom API composable. Check for the project's API composable (e.g., a wrapper around ). Exception: server-side code in directories may use . | MEDIUM |
| 5 | Navigation pattern | or in files when the framework provides a preferred navigation function. Check for the framework-specific navigation function. | MEDIUM |
| 6 | Secrets in diff | Patterns like , , , , followed by a quoted string literal (not , , or env variable references). | CRITICAL |
| 7 | External route gap | New files added under or -- check if corresponding frontend navigation uses and instead of . Flag if unclear. | LOW |
| 8 | N+1 queries | , , called inside , , , , loops. Each iteration hits the DB separately instead of batching. | HIGH |
| 9 | CJS default import | or similar default imports from known CJS packages (, , ). In Nuxt 4 + Vite, use named imports: . | MEDIUM |
| 10 | DevServer binding | appearing in config files (, , sections). Binds to all network interfaces -- security risk. | HIGH |
Step 3: Build findings table
For each finding, extract:
- File: from the diff
header+++ b/... - Line: calculate from
hunk headers by counting@@ -X,Y +Z,W @@
lines+ - Pattern: the pattern name from the table above
- Finding: the specific line or code that triggered the match
- Recommendation: what to change
Output format:
| # | Severity | File | Line | Pattern | Finding | Recommendation | |---|----------|------|------|---------|---------|----------------| | 1 | CRITICAL | path/to/file.ts | 42 | Soft-delete | `.delete({ where: ... })` | Use `update({ is_active: false, deleted_at: new Date() })` |
If no findings: "No anti-patterns detected in the diff. GO."
Step 4: Summary
Review-diff: X findings (Y critical, Z high, W medium, V low) Verdict: GO / REVIEW NEEDED
- GO: 0 critical, 0 high findings
- REVIEW NEEDED: any critical or high findings present