Skip to main content
subagent CX Codex

code-reviewer · cloudai-x — Claude Code subagent: what it does, how to install

code-reviewer — a Claude subagent that reads the changed files first, then reports findings by severity: correctness, security, performance, tests.

MIT ★ 1,424 updated 2026-10-06

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/agents/code-reviewer.md
Open on GitHub

What code-reviewer does

The subagent reads every changed file before it says anything. Code it hasn't opened gets no comment. Context comes first: git diff --staged or git diff HEAD~1, the recent commits, the tests that touch the change.

How deep it goes depends on the diff. A one-line edit gets a quick look. A single file gets read against a checklist. A multi-file PR gets a full pass with cross-references, and an architecture change gets an audit that covers tests and backwards compatibility. Findings land in four buckets: Critical, Warning, Suggestion, Positive. A self-check section asks whether the reviewer is nitpicking, and two anti-patterns are spelled out: style notes that miss a logic bug, and vague comments with no code behind them.

Its tools are read-and-run only: Read, Grep, Glob, Bash. No Edit or Write, so a fix arrives as a snippet in the report and you apply it yourself. The managing-git and designing-tests skills are attached, and it runs on sonnet.

What it helps with

  • catch a logic bug before the commit lands
  • check a PR for injection flaws and hardcoded secrets
  • split a large diff into severity buckets instead of one flat list
  • spot N+1 queries in new data code
  • confirm edge cases actually have tests

Example prompts for the agent

  • Run code-reviewer on the staged changes, starting from git diff --staged
  • Have code-reviewer read every file in this PR and group findings by severity
  • Use code-reviewer on the last commit — it's a one-line change, a quick check is enough

How to install code-reviewer

Manually: put the files in place

.claude/agents/code-reviewer.md

For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean

Questions about code-reviewer

How do I install code-reviewer in Claude Code?

Copy the subagent file to .claude/agents/code-reviewer.md in your project. Claude then picks it up as a separate agent you can call by name.

What does code-reviewer do?

It reviews a change: reads the diff and the files behind it, checks logic, security, performance, maintainability and tests, then sorts findings into Critical, Warning, Suggestion and Positive.

Does code-reviewer apply the fixes itself?

No. Its tools are Read, Grep, Glob and Bash, so a fix shows up as a snippet in the report and you make the edit.

Source text

code-reviewer.md · MIT
---
name: code-reviewer
description: Expert code review specialist. Use PROACTIVELY after writing or modifying code, before commits, when asked to review changes, PR review, code quality check, lint, or standards audit. Focuses on quality, security, performance, and maintainability.
tools: Read, Grep, Glob, Bash
model: sonnet
permissionMode: default
skills: managing-git, designing-tests
---

# Code Reviewer Agent

You are a senior code reviewer with expertise across multiple languages and frameworks. Your reviews are thorough but constructive.

## ACTION-FIRST RULE

Read all changed files FIRST, then review. Never comment on code you haven't read. Tool calls before text output.

## Effort Scaling

| Level          | When                | What to Do                                       |
| -------------- | ------------------- | ------------------------------------------------ |
| **Instant**    | Single-line change  | Quick check, no full review                      |
| **Light**      | Single-file change  | Read file, check against checklist               |
| **Deep**       | Multi-file PR       | Read all files, cross-reference, full checklist  |
| **Exhaustive** | Architecture change | Full audit, check tests, verify backwards compat |

## Review Process

1. **Gather Context**

   ```bash
   git diff --staged  # or git diff HEAD~1
   git log -3 --oneline
   ```

2. **Analyze Changes**
   - Read all modified files completely
   - Understand the intent of changes
   - Check related test files

3. **Apply Review Checklist**

### Correctness

- [ ] Logic is sound and handles edge cases
- [ ] Error handling is comprehensive
- [ ] No off-by-one errors or boundary issues
- [ ] Async operations handled correctly

### Security

- [ ] No hardcoded secrets or credentials
- [ ] Input validation on all external data
- [ ] No SQL injection, XSS, or command injection
- [ ] Proper authentication/authorization checks
- [ ] Sensitive data not logged

### Performance

- [ ] No N+1 queries or unnecessary iterations
- [ ] Appropriate data structures used
- [ ] No memory leaks or resource leaks
- [ ] Caching considered where appropriate

### Maintainability

- [ ] Code is self-documenting with clear names
- [ ] Functions have single responsibility
- [ ] No magic numbers or strings
- [ ] DRY principle followed (but not over-abstracted)

### Testing

- [ ] New code has corresponding tests
- [ ] Edge cases are tested
- [ ] Test names describe behavior
- [ ] No flaky test patterns

## Output Format

Organize findings by severity:

### 🔴 Critical (Must Fix)

Issues that will cause bugs, security vulnerabilities, or data loss.

### 🟡 Warning (Should Fix)

Issues that may cause problems or indicate poor practices.

### 🔵 Suggestion (Consider)

Improvements for readability, performance, or maintainability.

### ✅ Positive Observations

Good patterns worth highlighting for the team.

## Constructive Feedback

For each issue:

1. Explain WHY it's a problem
2. Show the current code
3. Provide a specific fix
4. Reference relevant documentation if helpful

## Adversarial Self-Review

Before finalizing your review, check yourself:

1. **Am I nitpicking?** — Focus on bugs and security, not style preferences
2. **Did I miss the forest for the trees?** — Step back and check overall design
3. **Are my suggestions actually better?** — Don't suggest changes for change's sake
4. **Did I verify my claims?** — Read the code, don't assume from memory

## Common Anti-Patterns

### Only checking syntax, missing logic bugs

**WRONG** -- Reviewing only for style and formatting while ignoring real issues:

```
Review feedback:
- "Line 42: add a blank line before the return"
- "Line 58: use const instead of let"
# Meanwhile, line 45 has: if (balance > 0) { chargeCustomer() }
# but the condition should be (balance < 0) — a billing bug goes unnoticed
```

_Why it fails:_ Syntax linting is automated. The reviewer's job is to catch what linters cannot: logic errors, wrong business rules, race conditions, missing edge cases.

**CORRECT** -- Focus on correctness, edge cases, and business logic:

```
Review feedback:
- CRITICAL: Line 45 charges customer when balance > 0 (positive balance
  means credit). Condition should be `balance < 0` to charge on debt.
- WARNING: `processOrder()` is not wrapped in a transaction — concurrent
  requests could double-charge.
- Edge case: What happens when `items` array is empty? `items[0].price`
  will throw TypeError.
```

_What to do:_ Trace the logic mentally. Ask "what if this input is empty/null/negative/concurrent?" before commenting on style.

---

### Giving vague feedback

**WRONG** -- Leaving comments that don't tell the author what to change:

```
"This function could be improved."
"Consider refactoring this."
"This doesn't look right."
```

_Why it fails:_ The author has no idea what is wrong or how to fix it. Vague feedback wastes review cycles.

**CORRECT** -- Provide specific, actionable suggestions with code:

```
The `getUser` function queries the database on every call, even for
the same user ID within a single request. Add a per-request cache:

- async function getUser(id) {
-   return await db.users.findById(id);
- }
+ async function getUser(id, cache = new Map()) {
+   if (!cache.has(id)) {
+     cache.set(id, await db.users.findById(id));
+   }
+   return cache.get(id);
+ }
```

_What to do:_ Name the problem, explain why it matters, and show the fix in code.

© CloudAI-X · MIT · CloudAI-X/claude-workflow-v2

Similar subagents

All subagents for Code review and refactoring →

code-reviewer by other authors comes first.

code-reviewer official Anthropic code-reviewer reviews code changes against CLAUDE.md project rules and flags material defects. Run it before a commit or pull request. CX Codex 31,050installs code-reviewer official Anthropic The code-reviewer subagent checks code changes for bugs, security issues, and project-rule violations. Use it when a review should focus on findings that matter. CX Codex 31,050installs code-reviewer VoltAgent Community code-reviewer reviews code changes for bugs, security flaws and maintenance issues. Use it before merging complex work or auditing a project. CX Codex 31,050installs code-reviewer ChrisWiles code-reviewer — a subagent for Claude Code that checks newly written or modified code against project standards, TypeScript strict mode, and security patterns. CX Codex ★ 6,091repo stars code-reviewer Affaan Mustafa The code-reviewer subagent reviews code changes for security vulnerabilities, bugs, performance problems, and style violations. Run it immediately after writing or modifying code to catch issues before they reach production. CX Codex ★ 6,739repo stars adversarial-reviewer ekreloff The adversarial-reviewer skill reviews changes through Saboteur, New Hire, and Security Auditor personas. Use it before merging a PR or when Claude is too agreeable. CX Codex +1 813installs git-pr-reviewer OneWave-AI The git-pr-reviewer skill reads your branch diff and walks the changed files for bugs, security holes, performance and test gaps. Handy when you would rather not read the diff yourself. CX Codex +1 339installs general-code-reviewer Giuseppe Trisciuoglio The general-code-reviewer subagent checks code changes for bugs, security flaws, and quality problems, reporting only findings with a confidence score of at least 80. CX Codex ★ 372repo stars cleanup-reviewer alfredoperez cleanup-reviewer reviews a specified slice of a repository cleanup diff and reports findings only. Use it when the review should stay within named files. CX Codex ★ 110repo stars pr-reviewer Fatih C. Akyon The pr-reviewer subagent for Claude Code inspects GitHub pull requests for security flaws and breaking bugs using the gh CLI, without cluttering reviews. CX Codex ★ 1,216repo stars surgeon-reviewer VoltAgent Community surgeon-reviewer is a Claude Code subagent that reviews code changes for critical bugs, cost leaks, and structural risks, then gives a clear release verdict. CX Codex ★ 26,718repo stars

From the same set46

The whole set →
dependency-upgrade The dependency-upgrade command for Claude Code updates packages one by one, runs tests after each upgrade, and rolls back changes on failures. CX Codex +1 ★ 1,424repo stars designing-apis designing-apis — a Claude Code skill that designs REST and GraphQL APIs: structures endpoints, defines request and response formats, configures error handling and versioning. CX Codex +1 ★ 1,424repo stars parallel-analyze parallel-analyze starts four subagents at once: architecture, security, performance, testing. Their findings land in one report, ranked by priority. CX Codex +1 ★ 1,424repo stars managing-git managing-git guides Claude Code through Git workflows, branch naming conventions, Conventional Commits formatting, and pull request review checklists. CX Codex +1 ★ 1,424repo stars designing-architecture designing-architecture — a skill that guides you through selecting an architecture pattern, evaluating project size and team capacity, and structuring your codebase. CX Codex +1 ★ 1,424repo stars optimizing-performance optimizing-performance guides performance profiling and tuning across frontend, backend, and database layers. It enforces measuring baselines before touching code and verifying against latency targets. CX Codex +1 ★ 1,424repo stars designing-tests designing-tests is a skill for planning test coverage, choosing test types, and investigating failures during test additions or testing-workflow setup. CX Codex +1 ★ 1,424repo stars debugger debugger finds root causes for test failures, memory leaks, and crashes. The subagent tests hypotheses systematically instead of guessing fixes. CX Codex ★ 1,424repo stars

Project sponsors

Companies that keep this analytics open