DEV Community

Vildanden
Vildanden

Posted on

Give Claude Code a read-only reviewer subagent in one file

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.
Enter fullscreen mode Exit fullscreen mode

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 diff covers almost every review.
  • Commit .claude/agents/ so the whole team gets the same reviewer.
  • Pair it with a /review slash 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 (1)

Collapse
 
parsa_m profile image
Parsa Mohammadi •

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.