ipIterPrompt
SubagentQuality & SecurityVerified Last verified 2026-07-24

Code Reviewer Subagent

by Community pattern

A Claude Code subagent defined in `.claude/agents/` that specializes in code review. It runs with its own context window and system prompt, so a review never pollutes your main conversation, and it can be invoked automatically or on demand to critique the current diff for bugs, security issues, and style.

Works with

MCP servers, subagents, skills, slash commands, and hooks.

When to use it

  • Before opening a PR, to get a second pass on your own changes
  • On large diffs where you want review kept out of your main context
  • When you want a consistent review checklist applied every time

When not to

  • Trivial one-line changes where a full review is overkill
  • As a replacement for human review on high-risk code

What it does

  • Reviews the working diff in an isolated context window
  • Flags correctness, security, and maintainability issues
  • Can be auto-delegated or invoked by name

How to install

Setup steps with copy-paste config. Sources are cited under each method.

Add the subagent file

Claude Code

Requires: Claude Code installed · A project with a git repo

  1. Create the agents directory

    Subagents live in `.claude/agents/` at your project root (or `~/.claude/agents/` for all projects).

    shell
    mkdir -p .claude/agents
  2. Define the reviewer

    Create `code-reviewer.md` with frontmatter and a focused system prompt.

    config
    ---
    name: code-reviewer
    description: Reviews the current diff for bugs, security, and style. Use before committing.
    tools: Read, Grep, Bash
    ---
    
    You are a meticulous senior code reviewer. Review ONLY the changed lines.
    Report issues grouped by severity (blocker, warning, nit) with file:line refs.
    Never rewrite the code — describe the fix. Praise nothing; be terse.
  3. Invoke it

    Ask Claude Code to use it by name, or let it auto-delegate when the description matches.

    config
    > use the code-reviewer subagent on my staged changes

How to prompt it

Copy-paste prompts written to exercise this plugin, with what to expect.

Pre-commit review

You've finished a feature and want a review before committing.

Use the code-reviewer subagent to review my staged changes. Focus on error handling and any security implications.

What to expect: The subagent reads the diff in its own context and returns a severity-grouped list of issues with file:line references, without touching your main conversation.

  • Stage only what you want reviewed (`git add -p`) so the scope is tight.
  • Ask it to also propose test cases for the risky paths.

Tips for getting the most out of it

  • Keep the subagent's `tools` list minimal (Read/Grep/Bash) so it can't accidentally edit files.
  • Version the `.claude/agents/*.md` files so the whole team shares one review rubric.

Prompts to pair with it

Real prompts from the IterPrompt library you can copy or run.

Senior Code Reviewer

Get a staff-engineer-level review of any diff or file, ranked by severity.

5,830 copiesOpen ↗

Code Reviewer

Turn any AI chat into a code reviewer with this community persona prompt.

5,158 copiesOpen ↗

Code Review Assistant

Turn any AI chat into a code review assistant with this community persona prompt.

4,652 copiesOpen ↗

Code Review Agent

Turn any AI chat into a code review agent with this community persona prompt.

1,557 copiesOpen ↗

Code Review Expert

Turn any AI chat into a code review expert with this community persona prompt.

2,340 copiesOpen ↗

Code Review Specialist 2

Turn any AI chat into a code review specialist 2 with this community persona prompt.

2,418 copiesOpen ↗
See more prompts in the library

Frequently asked questions

How is a subagent different from just asking Claude to review?+

A subagent runs in a separate context window with its own system prompt, so the review is consistent and doesn't consume or clutter your main conversation's context.

Can it edit my code?+

Only if you give it write tools. Limiting `tools:` to Read, Grep, and Bash keeps it advisory — it describes fixes rather than applying them.

Pairs well with

Related guides

Alternatives to Code Reviewer Subagent

Sources & verification

The facts on this page and where they come from. Anything unverified is labeled — we'd rather say "unknown" than guess.

Install steps, pricing, and availability change often. Always confirm on the official page before relying on setup details.