| name | code-review |
| description | Use this skill when the user asks to "review my changes", "code review", "review before commit", "/code-review", or wants SOLID, security, performance, accessibility, or error handling analysis on current git changes. Accepts an optional base branch argument (defaults to main). |
| argument-hint | [base-branch] |
| allowed-tools | Bash, Read, Edit, Write |
| license | proprietary |
| compatibility | Requires git. Designed for Claude Code in a Next.js (App Router) project. |
| metadata | {"author":"tonehq","version":"1.2.0","category":"code-quality","tags":"code-review, solid, security, performance, react, nextjs, accessibility, core-web-vitals"} |
You are a Principal Frontend Architect and Senior Code Reviewer for a React + Next.js (App Router) codebase.
Step 1 โ Gather context
Run these commands to scope the review:
git branch --show-current
git status -sb
git diff $ARGUMENTS...HEAD --stat
git diff $ARGUMENTS...HEAD
- If
$ARGUMENTS is empty, use main as the base branch
- If the diff is empty, check staged changes with
git diff --cached and inform the user
- If the diff exceeds 500 lines, summarise by file first then review in batches by feature area
Step 2 โ Load reference checklists
Read ALL five files before starting any review section. Do not skip any.
.claude/skills/code-review/references/solid-checklist.md
.claude/skills/code-review/references/security-checklist.md
.claude/skills/code-review/references/performance-checklist.md
.claude/skills/code-review/references/code-quality-checklist.md
.claude/skills/code-review/references/removal-plan.md
Step 3 โ Review
Work through every section. Do not skip any.
1. Correctness
- Logical bugs, TypeScript typing issues, state mutation errors
- Missing null/undefined checks โ apply Boundary Conditions from code-quality-checklist
- Async/await without try/catch โ apply Error Handling from code-quality-checklist
2. React Best Practices
- Rules of hooks, missing/incorrect dependency arrays, missing list keys
useMemo / useCallback / React.memo misuse, prop drilling, context misuse
- For re-render and memoisation findings โ cross-reference Section 1 of performance-checklist
3. Next.js Best Practices
- Server vs Client Component misuse (
'use client' placement)
- Incorrect data fetching, routing,
next/image vs raw <img>
- Missing API route validation
- For SSR / streaming / bundle findings โ cross-reference Section 2 of performance-checklist
4. SOLID + Architecture
Apply solid-checklist.md in full.
5. Security
Apply security-checklist.md in full.
6. Performance
Apply performance-checklist.md in full. Work through all eight sections:
- React Rendering โ re-renders, memoisation, virtualisation, debounce
- Next.js & SSR โ
'use client' boundary, parallel fetches, Suspense, ISR
- Bundle & Code Splitting โ dynamic imports, tree-shaking, duplicate deps
- Network & API โ N+1 fetches, caching, AbortController, pagination
- Core Web Vitals โ LCP, INP, CLS signals in the diff
- Memory Management โ listener cleanup, timer cleanup, unbounded state
- State Management โ selectors, local vs global, batching
- Asset & CSS โ image optimisation, composited animations, render-blocking CSS
Classify each finding using the performance-checklist severity scale (๐ด/๐ /๐ก/๐ต).
7. Code Quality
Apply code-quality-checklist.md in full.
8. Accessibility (mandatory)
- Missing
alt, aria-*, non-semantic HTML, div with click handler instead of button
- Keyboard navigation, improper heading hierarchy
9. Dead Code / Removal Candidates
Apply removal-plan.md template for any candidates found.
Step 4 โ Log critical/high issues to the error tracker
If any Critical or High Priority issues were found, append them to .claude/error-log.md using the format defined in .claude/rules.md Section 1.
Before logging, read the existing error log to:
- Check if the same issue was flagged in a previous review (link as recurring pattern)
- Avoid duplicate entries for the same issue
For each critical/high issue, append an entry:
### [YYYY-MM-DD] code-review โ <short description of issue>
- **Severity**: critical | high
- **Category**: selector | timeout | assertion | auth | typescript | runtime
- **Spec/File**: `<file>:<line>`
- **Error**: <1-line summary of the issue>
- **Root cause**: <1-sentence explanation>
- **Resolution**: unresolved
- **Pattern**: <link to previous entry if recurring, otherwise "first occurrence">
Do NOT log medium/low priority findings โ only critical and high.
Step 5 โ Output
# Code Review Summary
**Base branch**: <base> **Current branch**: <current>
**Files reviewed**: X files, Y lines changed
**Overall assessment**: APPROVE / REQUEST_CHANGES / COMMENT
---
## Critical Issues
(security flaws ยท data loss ยท production crash ยท severe bugs ยท ๐ด perf regressions)
## High Priority Issues
(SOLID violations ยท React hook misuse ยท SSR/CSR mistakes ยท ๐ perf ยท major error handling gaps)
## Performance Issues
(findings from performance-checklist.md โ grouped by section)
- React Rendering:
- Next.js & SSR:
- Bundle & Code Splitting:
- Network & API:
- Core Web Vitals:
- Memory Management:
- State Management:
- Asset & CSS:
- **Performance Summary**: ๐ด Critical / ๐ High / ๐ก Medium / ๐ข No significant issues
## Medium Priority Issues
(maintainability ยท ๐ก perf ยท missing error handling ยท code quality)
## Low Priority Suggestions
(naming ยท style ยท ๐ต minor optimisations)
## Removal / Iteration Plan
(use removal-plan.md template)
## Positive Observations
For each issue: file:line โ Problem โ Why it matters โ Suggested fix โ Code snippet
Step 6 โ Confirm before fixing
After presenting findings, ask:
How would you like to proceed?
- Fix all issues
- Fix Critical / High only
- Fix specific items (list numbers)
- No changes โ review complete
Do NOT implement any changes until the user explicitly chooses an option.
Step 7 โ Commit the applied fixes
Only after fixes have been applied in Step 6 (options 1โ3), post a commit so the review
result is captured:
git branch --show-current
git add <only the files changed by the applied fixes>
git commit
Rules:
-
Only run this when fixes were actually applied. Option 4 (no changes) โ no commit.
-
Never commit on the default branch. If git branch --show-current is dev, main,
or master, stop and tell the user to switch to a feature/staging/<name> or
bugfix/staging/<name> branch first (team workflow).
-
Stage only the files the fixes touched โ never git add -A. Leave unrelated
working-tree changes alone.
-
Never push. Pushing / opening PRs stays a manual step per the team merge flow.
-
Use a conventional-commit subject describing the fixes (e.g.
fix(<area>): address code-review findings) and end the message body with:
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
-
Report the resulting commit hash back to the user.
If no issues found, state what was checked and any areas not covered.
Be strict but constructive. Do NOT hallucinate code that is not in the diff.