Back to the blog
TutorialsOctober 18, 20269 min read

Can Claude Code Review PRs? How to Review a Pull Request with Claude Code (Step by Step)

Yes, Claude Code can review Pull Requests. Learn three ways to review a PR with Claude Code: pre-push branch reviews, GitHub CLI PR reviews and repeatable claude -p reviews, with copy-ready prompts.

Most people searching "can Claude Code review PRs" have already tried pasting a diff into a chat and got a generic answer. The difference between a useless review and a useful one is not the model — it is the context, the scope and the output format you give it. This guide shows three practical ways to review a PR with Claude Code, a prompt you can copy, and where the manual workflow starts to hurt.

What you need

  • Claude Code installed and signed in (run claude once in a terminal).
  • A local clone of the repository you want to review.
  • The GitHub CLI (gh) authenticated with gh auth login — only for reviewing PRs that already exist.

Way 1: Review your branch before you push

The cheapest bug is the one that never reaches a Pull Request. From your feature branch, start Claude Code and ask it to review what changed compared with main.

Terminal — review the current branch
git fetch origin
claude "Review the changes on this branch compared with origin/main.
Run git diff origin/main...HEAD to see them.
For every modified function, check its callers and its tests.
Report bugs, security issues and missing tests. Do not edit files."

Claude Code also ships a built-in /review slash command you can type inside a session. It is a good starting point, but the explicit prompt above gives you more control over scope.

Way 2: Review an existing Pull Request with the GitHub CLI

To review a teammate's PR, check it out locally so Claude Code can read the full code, not just the patch. Then let it read the PR description and comments — the intent matters as much as the diff.

Terminal — review PR #123
gh pr checkout 123
claude "Review PR #123.
First run: gh pr view 123 --comments
Then run: gh pr diff 123
Check whether the change does what the description says.
Read callers and tests outside the diff.
List findings with file, line, severity and a suggested fix.
Do not post anything to GitHub."

Way 3: Non-interactive reviews with claude -p

Print mode (-p) runs a single prompt and exits, which makes reviews repeatable and easy to save to a file. Restricting tools keeps the review read-only.

Terminal — repeatable review saved to a file
git diff origin/main...HEAD > /tmp/changes.diff
claude -p "Review the diff in /tmp/changes.diff against this repository.
Return markdown: verdict, then findings with file, line, severity, fix." \
  --allowedTools "Read,Grep,Glob" > review.md

How to use Claude Code for code review: a prompt that works

Whatever way you choose, a good review prompt covers four things:

  • Scope — exactly which changes to review (branch vs main, or PR number).
  • Context outside the diff — callers, tests, related modules.
  • Your rules — architecture boundaries, security checks, conventions.
  • A fixed output format — so every review is easy to scan.
Reusable review prompt
You are reviewing a Pull Request in this repository.
1. Read the diff and the PR description.
2. For each changed function, read its callers and tests.
3. Check: correctness, authorization on new endpoints,
   input validation, error handling, missing tests.
4. Ignore pure style issues unless they break a project rule.
Output:
## Verdict: approve | request changes
## Findings
- [severity] path/to/file.ts:42 — problem — suggested fix

Make it better with a review skill

Typing your rules into every prompt does not scale. Claude Code skills let you store them once in a SKILL.md file that Claude loads when it reviews code. Our step-by-step guide covers how to create, install and activate a Claude Code review skill, and you can split the work into security, performance and architecture subagents.

The limits of doing it by hand

  • You repeat the same setup for every PR: checkout, fetch, prompt, rules.
  • Findings live in the terminal, far from the lines they refer to.
  • There is no history of past reviews to compare against.
  • It is easy to post an unverified comment in a hurry.

How CodeCrab automates this on your machine

CodeCrab is a desktop app that runs this exact loop locally with the Claude Code you already use. It pulls the PR or your local changes via the GitHub CLI, applies your per-repository profile and review skills, and shows each finding next to the line in the diff. You decide what gets posted. Your code never leaves your laptop.

  • PR review — review any open Pull Request in one click.
  • Pre-push review — check local changes before the PR exists (see how).
  • My PRs feedback — turn reviewer comments on your PR into a clear fix.

Quick questions

Can Claude Code review PRs on GitHub automatically?

Yes. Anthropic offers a GitHub Actions integration (set up from Claude Code with /install-github-app) that can respond in PRs. That runs in GitHub's cloud; the workflows above run locally instead.

Does Claude Code need the whole repository?

It works best with a local checkout, because the most valuable findings come from code outside the diff.

Is this different from the "How to review code with Claude Code" guide?

That article explains why generic prompts fail and how to give Claude Code repository context. Read it for the strategy; this one gives you the concrete PR commands.

Can I do the same in Cursor?

Yes. How to use Cursor for code review shows the equivalent workflow with a reusable review rule.

Try it on your next Pull Request

Free Public Beta — runs 100% on your machine. No code leaving your laptop.

Download CodeCrab

KEEP READING