Claude Code Review: Catch Real Bugs, Not Style Nits
By: Evgeny Padezhnov
Most AI code reviews flag a missing semicolon and miss the null pointer three lines down. The tool comments on formatting. The real bug ships. This happens because the review runs with no scope, no context, and no verification step.
Claude Code ships a review workflow that inverts this. It reads the diff, understands the surrounding code, and reports correctness bugs first. Configured right, it catches logic errors, race conditions, and broken error handling. Configured wrong, it produces the same style noise as every other linter with a language model bolted on.
This guide shows the exact commands, the configuration that matters, and the failure modes. Every claim maps to a real command you can run.
Why most AI code reviews miss real bugs
A code review is only useful if it reasons about intent. Style checkers do not reason. They match patterns. An AI review that behaves like a style checker inherits the same blind spot.
Three problems cause the miss.
First, no scope. A tool asked to "review this repository" spreads attention across thousands of lines. It surfaces trivia because trivia is easy to find. Real bugs hide in the delta between what changed and what the rest of the code expects.
Second, no context. A function looks correct in isolation. It breaks because a caller passes an unvalidated value, or because a shared table has a constraint the diff ignores. Without the surrounding code, the reviewer cannot see the break.
Third, no verification. Language models generate plausible findings. A plausible finding is not a real one. A review that reports every hunch buries the two real bugs under twenty false positives. Engineers stop reading after the third wrong comment.
Here is the difference in one diff. A dropped await slips into a receipt sender:
async function sendReceipt(orderId) {
- const order = await db.findOrder(orderId);
+ const order = db.findOrder(orderId);
return mailer.send(order.customer.email, order.total);
}
- Trivial linter comment: nothing, or "prefer
constoverlet" — the syntax is valid, so a pattern-matcher stays quiet. - Real correctness finding Claude Code returns:
db.findOrderis async; withoutawait,orderis a Promise, soorder.customerisundefinedand.emailthrows at runtime — the receipt never sends.
What actually matters: the goal is not more findings. The goal is fewer findings that are all real.
Run your first Claude Code review
Claude Code exposes review as a command over the current git diff. The base command is /code-review. It reviews uncommitted and committed changes on the branch, not the whole repository.
/code-review
The default pass returns high-confidence findings. Two categories come back: correctness bugs, and cleanup suggestions for reuse, simplification, and efficiency. Correctness comes first because a broken feature costs more than a duplicated helper.
Two flags change what happens with the output:
/code-review --comment # post findings as inline PR comments
/code-review --fix # apply the findings to the working tree
--comment writes each finding to the exact line on the pull request. --fix edits the files directly. Use --fix only when the diff is small and you read every change. Blind application of AI edits is how a review tool introduces the next bug.
For a pull request that already exists on GitHub, /review targets the PR instead of the local branch. For changes that touch authentication, input parsing, or secrets, /security-review runs a dedicated pass focused on the pending changes.
Try it: run /code-review on your current branch before opening the PR. Read the correctness section only. Ignore the cleanup section on the first pass.
Give the review context so it catches logic errors
A review with no project context evaluates code against generic best practice. That finds generic bugs. Project-specific bugs need project-specific knowledge.
The mechanism is a CLAUDE.md file at the repository root. Claude Code reads it on every run. It is the single highest-leverage change for review quality.
Put the non-obvious rules there. Examples that change what the reviewer flags:
- "Never mutate the
projectstable with raw SQL — use the audited change path." - "All timestamps are stored in UTC. Local conversion happens only in the view layer."
- "
fetchUserreturns null for deleted accounts. Callers must handle null."
With those rules present, the review flags a raw UPDATE on a protected table as a real defect. Without them, it sees valid SQL and stays silent. In plain terms: the reviewer catches what you tell it to care about, plus the general class of bugs it already knows.
Where teams slip: treating CLAUDE.md as documentation for humans. It is context for the reviewer. Write the constraints that would fail a review, not the marketing description of the project. Anthropic documents this file and the review commands in the Claude Code docs.
Context also comes from the diff size. A 40-line diff gets a sharp review. A 4,000-line diff gets a shallow one, because attention spreads. Small pull requests are not just easier for humans. They produce better AI reviews for the same reason.
Effort levels: from a quick pass to a multi-agent audit
Not every change needs the same depth. A one-line config edit does not warrant a deep audit. A payment flow does. Claude Code review scales effort explicitly.
The levels, from lightest to heaviest:
- low / medium — fewer findings, each high confidence. Fast. Right for routine changes and pre-commit checks.
- high / max — broader coverage. May include uncertain findings you have to judge. Right for risky or large diffs.
- ultra — a deep multi-agent review that runs in the cloud. Multiple agents examine the change from different angles, then findings are cross-checked before they reach you.
/code-review medium
/code-review high
/code-review ultra
The trade-off is direct. Higher effort surfaces more real bugs and more false positives. Lower effort surfaces fewer of both. Match the level to the cost of a missed bug.
| Level | Findings volume | False positives | Runs | Best for |
|---|---|---|---|---|
| low | Minimal | Very low | Local / CI | Trivial or config-only diffs |
| medium | Moderate | Low | Local / CI | Routine changes, default CI gate |
| high | Broad | Some | On-demand | Risky or large diffs |
| max | Broadest single-pass | Higher | On-demand | Complex logic, security-sensitive code |
| ultra | Broad, cross-checked | Lowest at depth | Cloud multi-agent | Money, auth, data deletion, shared infra |
The ultra level matters most for the false-positive problem. It runs several independent reviewers and has them verify each other's findings before reporting. A finding that one agent raises and another cannot confirm gets dropped. This adversarial step is what separates a signal from a guess.
Rule of thumb: run medium on every branch and reserve ultra for changes that touch money, auth, data deletion, or shared infrastructure. Depth costs tokens and time. Spend it where a bug is expensive.
Automate reviews in CI so nothing ships unreviewed
Manual review depends on someone remembering to run it. Automation removes the human step. Claude Code runs headless in continuous integration.
The command-line entry point is claude in print mode:
claude -p "/code-review" --output-format json
Wire that into a pipeline stage that runs on every pull request. Parse the JSON output. Fail the build, or post a comment, based on whether correctness findings appear.
For GitHub specifically, Anthropic maintains a GitHub Action that runs Claude Code on pull requests. It posts review comments inline and responds when a reviewer mentions it. Setup requires an API key stored as a repository secret and a workflow file.
A complete, copy-paste .github/workflows/claude-review.yml. Option A uses the maintained action to post inline comments; Option B runs headless and fails the build only when a correctness finding appears:
name: Claude Code Review
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
pull-requests: write
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history so the diff base resolves
# Option A — maintained action, posts findings as inline PR comments
- name: Claude review
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: "/code-review medium"
# Option B — headless run that gates the merge on correctness only
- name: Review and gate
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
claude -p "/code-review medium" --output-format json > review.json
if jq -e '.findings[]? | select(.category == "correctness")' review.json > /dev/null; then
echo "Correctness findings present — blocking merge:"
jq -r '.findings[] | select(.category=="correctness") | "- " + .summary' review.json
exit 1
fi
echo "No correctness findings — merge may proceed."
Use Option A or Option B, not both. Keep the effort at medium in CI so only high-confidence findings block the pipeline; run deeper passes on demand.
A workflow triggered on pull_request events reviews the diff before a human opens it. The human then reviews a change that has already had its obvious bugs surfaced. That is the correct division of labor. The machine handles the mechanical scan. The human handles judgment the machine cannot make.
Seen in practice: teams that gate merges on an automated review pass catch broken error handling and forgotten null checks before those reach a reviewer's screen. The reviewer spends attention on architecture, not on spotting a missing await.
One caution on CI. An automated review that comments on every hunch trains engineers to ignore it. Keep the CI pass at medium effort so it only reports high-confidence findings. Reserve deeper passes for on-demand runs. A bot that is right 90 percent of the time gets read. A bot that is right 40 percent of the time gets muted.
What Claude Code review does not catch
An honest review of the tool has to state the gaps. The review is not a substitute for tests, and it is not a substitute for a human who understands the product.
It does not run the code. It reasons about the diff statically. A bug that only appears under a specific runtime state — a particular database row, a race between two requests — may pass a static review and still fail in production. For behavior, run the code and observe it. The review complements a test suite; it does not replace one.
It does not know requirements it was never told. If the spec says a discount caps at 50 percent and the code caps at 60, the review sees valid arithmetic. It flags nothing, because nothing in the code or CLAUDE.md encodes the cap. Business logic errors need business context. Put the invariant in the config, or the review cannot see it.
It produces false positives at high effort. high, max, and ultra are explicitly documented to include uncertain findings. Some will be wrong. A reviewer still has to judge each one. The tool narrows the search. It does not close it.
It can miss architectural problems. A single duplicated function is easy to spot. A design that spreads one responsibility across five files is not a diff-level defect. The review reads the change, not the shape of the whole system. Independent research on AI-assisted review, such as Google's work on ML-suggested code changes, points to the same boundary: the machine handles local, mechanical review well and leaves structural judgment to engineers.
Common mistake: shipping a change because the AI review came back clean. Clean means no bug the reviewer could see in the diff, given its context. It does not mean correct. Run the tests. Read the diff yourself. Then trust the review as a second set of eyes, not the only pair.
What to try right now
Pick your riskiest open branch. Write three project-specific rules into CLAUDE.md — the constraints a new engineer would violate on day one. Run /code-review high and read only the correctness section.
Count the real findings against the false positives. If the ratio is poor, the fix is almost always missing context, not the wrong effort level. Add the missing rule to CLAUDE.md and run again. The review gets sharper every time you teach it what your project actually cares about.
Related guides
- Claude Code — the complete guide.
- Claude Code Plan Mode
- Cursor vs Copilot
- Claude Code Mods Explained: hooks, mods, skills and MCP compared.
- Track, cap and alert on Claude Code costs: a 30-line mod.
Information is accurate as of the publication date. Terms, prices, and regulations may change — verify with relevant professionals.