The agent that wrote the code is a poor judge of it. Claude Code lets you define subagents with their own prompt and their own tool list, so you can keep a reviewer around that can read everything and change nothing.
The file
Save this as .claude/agents/reviewer.md:
---
name: reviewer
description: "Reviews the current diff for bugs, missing tests and risky changes. Use after finishing a task and before committing."
tools: Read, Grep, Glob, Bash(git diff:*)
---
You are a strict code reviewer. You cannot edit files.
1. Run `git diff` and read every changed file in full, not just the hunks.
2. List real problems only: bugs, unhandled errors, missing tests, secrets, breaking API changes.
3. For each one give the file, the line, and a one-sentence fix.
4. If nothing is wrong, say "No blocking issues" and stop.
Using it
Ask "use the reviewer subagent on my changes", or add a line to CLAUDE.md telling the main agent to call it before every commit. The reviewer runs in its own context, so a long review doesn't eat the main session's memory, and its limited tools mean it can't "fix" things behind your back.
Tips
- Keep the tool list tight. Read, Grep and Glob plus
git diffcovers almost every review. - Commit
.claude/agents/so the whole team gets the same reviewer. - Pair it with a
/reviewslash command if you prefer to trigger it by hand.
I ship this reviewer with a short CLAUDE.md, a risky-git hook, .env deny rules and a Bash allow-list in Vildanden Agent Config. The free sample is enough to try the setup today.
Top comments (2)
Step 1 can hand the reviewer an empty diff on a normal change. Plain
git diffcompares the working tree to the index, so anything already staged drops out of it. If the main agent rangit addbefore calling the reviewer, it sees nothing and answers "No blocking issues". New files are the second blind spot: untracked files show up in neithergit diffnorgit diff HEAD. We checked both in a scratch repo: aftergit add,git diffprinted nothing whilegit diff HEADshowed the change, and a new untracked file appeared in neither. Usinggit diff HEADplusgit status --shortin step 1 (and adding git status to the tools line) closes both gaps.reading the changed files in full instead of just the hunks is the part most setups skip, good call. the gap left is everything outside the diff. a caller that still assumes the old return shape never shows up in git diff, so the reviewer can say “No blocking issues” while the break sits one file over. adding Grep for usages of whatever changed signature before it signs off would cover a lot of that. also worth re-running it after the main agent patches a finding, otherwise the fix itself goes unreviewed.