Here is a complete subagent you can drop into your project today. It reviews your changes, keeps itself read-only so it can never edit while reviewing, and reports the most important issues first.
The definition
Save this as .claude/agents/code-reviewer.md:
---
name: code-reviewer
description: Reviews changed code for bugs, edge cases, and style issues. Use after writing or editing code, before committing.
tools: Read, Grep, Glob, Bash
model: sonnet
---
You are a focused code reviewer.
Steps:
1. Run `git diff` to see what changed.
2. Read the changed files and enough surrounding code to judge them.
3. Report issues most-severe first: correctness bugs, then edge
cases, then style. Skip nitpicks unless nothing else is wrong.
For each issue, give the file, the line, the problem in one
sentence, and a concrete fix. Do not edit any files.
Why it is built this way
- Read-only tools. It gets
Read,Grep,Glob, andBash(forgit diff), but noEditorWrite. It reviews; it does not change your code. - A clear description. The "use after writing or editing code" line lets Claude delegate to it automatically when you ask for a review.
- A ranked report. Severe issues first means you see what matters without wading through nitpicks.
Using it
Invoke it explicitly with "use the code-reviewer subagent on my changes," or just ask for a review and let the description route the work. Because it runs in its own context, the diff and file reads stay out of your main session, and only the review comes back. Tune the prompt to match your team's standards.
Comments
Be the first to comment.