How to Review Code with Claude Code
Use Claude Code as a first-pass reviewer on a diff, then spend your own attention on the parts it cannot judge.
Goal
Run a Claude Code review on a pull request or a local diff without touching your working checkout. Then turn its findings and your own into feedback the author can act on.
What Claude Code offers for review
As of November 2026, Claude Code documents two separate review paths. These features change often, so check the Claude Code code review docs for current details.
| Path | Where it runs | What it reviews |
|---|---|---|
/code-review command | Your terminal, in a Claude Code session | The branch's commits ahead of upstream plus uncommitted changes, or a file, branch, PR number, or ref range you name |
| Managed Code Review | Anthropic's service, through the Claude GitHub App | Pull requests on GitHub, with comments posted inline on the PR |
The managed service is a research preview for Team and Enterprise plans. To run the review in your own CI, use the Claude Code GitHub Actions integration instead. Both paths read a CLAUDE.md or REVIEW.md file in the repository, so write your review rules there once.
Review in a separate worktree
For a pull request, create a worktree so the review can switch branches and run tests without changing your working files. Replace 123 with the pull request number.
git fetch origin pull/123/head:pr-123
git worktree add ../review-pr-123 pr-123
cd ../review-pr-123
claude
In Claude Code, run /code-review 123 with your PR number. When you finish, exit Claude Code, run cd - to return to your original checkout, then run git worktree remove ../review-pr-123. See when to use a worktree or a clone for review.
Delegate the mechanical checks
Ask Claude Code to look for these issues in the diff:
- Missed error paths, unchecked inputs, and off-by-one bugs
- Tests that do not exercise the changed code
- Drift from conventions written in
CLAUDE.mdorREVIEW.md - Dead code, leftover debug output, and unrelated edits
Treat each finding as a claim to verify, not a verdict. Open the line it cites and confirm the bug exists before you pass it on.
Check these yourself
The model sees the diff and the repository. It does not know why the change exists or what your team decided last month. Keep these checks for yourself:
- Does the PR solve the problem the task described?
- Is the change the right size, or did it grow past its scope?
- Does a migration, API change, or permission change carry risk the tests do not cover?
- Would you accept this design if a teammate proposed it?
A diff written by an agent and reviewed by an agent can share one wrong assumption. The checklist for AI-generated PRs covers that case in detail. The AI code review workflow shows how to split the work between you and the model.
How Treq fits
Treq gives each branch its own workspace, so the review never runs in your working copy. Create a workspace from the PR branch and open its Review tab. The diff shows GitHub review threads on matching hunks, and you can run Claude Code in the workspace terminal for a first pass. Leave inline comments on the lines you want changed, then send them to the Agent Terminal, where the agent works through them as instructions. The code review workflow tutorial walks through each step.
Next Steps
- How to run multiple Claude Code sessions: run the author and reviewer agents side by side
- How to use Claude Code subagents: define a read-only reviewer that cannot edit files
- Fix merge conflicts from coding agents: resolve conflicts after review feedback lands
- Changes and reviews: how Treq models the diff you review