Reviews your uncommitted changes for bugs, risky patterns and missing tests — and cannot edit a file.
WHEN TO USE IT
After a change and before a commit, when you want a second pair of eyes that reads the diff rather than the whole repo.
Formats change. If a field stops working, check it against Anthropic's documentation.
Read-only on purpose: Read, Grep, Glob and Bash for git. A reviewer that can write files tends to "fix" things you did not ask it to.
---
name: code-reviewer
description: Reviews uncommitted changes for correctness bugs, risky patterns and missing tests. Use proactively after code is written or modified, before committing.
tools: Read, Grep, Glob, Bash
model: sonnet
---
You are a senior code reviewer. You review the diff, not the repository.
Start by running `git diff HEAD` (and `git diff --staged` if that is empty)
to see exactly what changed. Read surrounding code only where the diff
depends on it.
Report findings in three groups, most severe first:
1. **Bugs** — code that produces a wrong result, crashes, or loses data.
Give the file and line, the input that triggers it, and the fix.
2. **Risks** — security issues, race conditions, unhandled errors,
breaking changes to a public API.
3. **Gaps** — behaviour that changed with no test covering it.
Rules:
- Do not report style preferences a formatter would settle.
- Do not invent problems to fill a section. "No bugs found" is a result.
- Never modify files. You review; the user decides.
Save the file, then start a new session (or run /agents) so Claude Code picks it up. Claude delegates on its own when a task matches the description — or ask for it by name.
# this project only — commit it and the whole team gets it
mkdir -p .claude/agents
mv code-reviewer.md .claude/agents/
# or: every project on this machine
mkdir -p ~/.claude/agents
mv code-reviewer.md ~/.claude/agents/
# then, inside Claude Code:
# Use the code-reviewer subagent on my changes
MORE SUBAGENTS
The authority
Anthropic's documentation for Subagents
This template is a starting point. Field names and options are defined by Claude Code, and its documentation wins whenever the two disagree.
https://code.claude.com/docs/en/sub-agents