cd /news/ai-agents/how-to-review-claude-code-s-work-wit… · home › topics › ai-agents › article
[ARTICLE · art-179082] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

How to Review Claude Code's Work With a Subagent (Under 20 Lines, Copy-Paste)

A developer published a starter configuration for a Claude Code code-reviewer subagent that runs in its own context window with only Read, Grep and Glob tools, preventing it from editing files or running commands. The setup, saved as .claude/agents/code-reviewer.md and shared in a public ops-ai repo, has the main session run git diff and pass the changed-file list to the reviewer, which returns a severity-ranked list of bugs, missing tests and security issues. The author argues that a review by the same context that wrote the code is merely a re-read, and that restricting tools is what makes the reviewer useful.

recommendation

Run reviews in a separate subagent with only Read, Grep and Glob tools, and pass it the changed-file list from git diff in the main session so it cannot edit or execute commands.

more in playbook: Working with AI coding agents
by read4 min views10 publishedDec 1, 2026

You ask Claude Code to build a feature. It writes the code, runs the tests, and says it's done.

Then you type the obvious follow-up: "Now review what you just wrote."

It reviews it in the same conversation, with the same context, holding the same assumptions that produced the code. If it misunderstood the requirement an hour ago, it will misunderstand it again now. A review by the author, in the author's head, is a re-read.

Human teams solved this a long time ago: the reviewer is someone else. Claude Code lets you do the same thing with a subagent.

What you'll build: a code-reviewer subagent that runs in its own context window, can read and search your code, and cannot edit files or run commands.

Code: the file is in the ops-ai repo, inside a starter .claude/ folder you can copy whole.

A subagent is a helper Claude Code can hand work to. Two properties make it a good reviewer.

Save this as .claude/agents/code-reviewer.md in your repo:

---
name: code-reviewer
description: "Reviews changed files for bugs, missing tests and security issues. Use after finishing a feature or before a commit. Pass it the list of changed files."
tools: Read, Grep, Glob
model: sonnet
---

You are a careful senior reviewer seeing this code for the first time.
You were given a list of changed files. Read each one, and any file it
depends on that you need to understand it.

Report, in order of severity:
1. Bugs or logic errors
2. Missing or weak tests
3. Security issues (secrets, injection, unchecked input)

For each finding: file, line, what's wrong, and the fix in one or two lines.
Skip style nitpicks. If you find nothing serious, say so plainly.

You can read and search but not edit or run commands. Report; don't fix.

description is how Claude Code decides when to use the subagent, so it's written as a trigger: what it does, then when to use it. It also tells the main conversation what to hand over: the list of changed files.

tools: Read, Grep, Glob is the important line. Without it, a subagent inherits every tool the main session has, including Edit, Write and Bash. With it, the reviewer can open files and search the codebase, and that's all. It can't edit anything, and it can't run commands.

That last part has a consequence worth knowing. The reviewer can't run git diff itself, because that needs Bash. That's deliberate. Letting it have Bash "just for git diff" isn't something the tools field can express: as far as Anthropic's docs describe it, the field takes tool names, not command patterns. Give it Bash and it gets all of Bash. So the main conversation, which can run git, does that part and passes the result along.

model: sonnet picks the model for the review. You can also set opus, haiku, a full model ID, or inherit to match the main session.

The prompt body is the reviewer's whole job description. "Seeing this code for the first time" isn't decoration. It sets the stance you want: no benefit of the doubt.

Ask in plain words:

Run git diff --name-only, then use the code-reviewer subagent
to review those files.

Or mention it directly with @agent-code-reviewer. Claude Code runs git diff in the main session, hands the file list to the reviewer, and the reviewer works in its own context. What comes back is a short, ranked list of findings. Then you decide, in the main conversation, which ones to fix.

Two habits make it more useful. First, review before you commit, not after you push. It's cheapest when the change is still fresh and small. Second, tell it what the change was for. "Review these files; the goal was to add refund support without changing the invoice totals" gives the reviewer a requirement to check against, not just code to read.

The interesting thing about this subagent isn't what it's told to do. It's what it's not able to do.

Most of the ways people try to make AI behave are instructions: "be careful", "don't change anything", "only report". Instructions are requests. The tools line isn't a request. It's the set of things that physically exist for the reviewer, and Edit isn't in it.

So here's the question for your own setup: for each helper you've given your coding agent, which rules are written in its prompt, and which ones are written in what it can actually do?

The reviewer, plus a CLAUDE.md template, hooks and a permissions file, is in the starter folder of the ops-ai repo. Copy the .claude/ folder into your project and edit from there.

Originally published on Level Up Coding.

── more in #ai-agents 4 stories · sorted by recency
── more on @claude code 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/how-to-review-claude…] indexed:0 read:4min 2026-12-01 · —