Review a pull request
Give Claude Code a pull request number; it reads the diff and the code around it, summarizes what changed and lists concerns, without posting anything.
Task: Review a pull request · Other tasks
Fill in the details
The number only, without the # sign. Run Claude Code inside a clone of the repository the pull request belongs to.
Optional. Paste the ticket summary if the pull request description is thin.
Optional. Areas you want more attention on than the rest.
Copy your prompt
This site doesn't run Claude or show model output. Results depend on your input and the model you use.
You've edited the prompt, so changes to the fields aren't applied.
Replace what you've entered for this task with the example? This can't be undone.
What you type is kept in this tab's session storage so a reload doesn't lose it. Use "Clear this task" to remove it. Browsers can restore session data when they reopen tabs, so closing a tab isn't a guaranteed way to erase it.
When to use this template
- A teammate has asked you to review a pull request and you want a first pass that reads the surrounding code, not only the lines in the diff.
- You opened the pull request yourself and want to find the obvious problems before a reviewer spends time on them.
- Before you start, the
ghCLI is installed and authenticated on your machine, or GitHub is added to Claude Code as a claude.ai connector, so Claude can read the pull request.
When not to use it
- Neither the
ghCLI nor a GitHub connector is set up. Claude cannot read the pull request; paste the diff into the code review template instead. - You only want a quick bug check of the change. The library suggests the bundled
/code-reviewcommand with the pull request number for that, in one step. - The pull request is very large, such as a vendored dependency or a generated migration. Ask Claude to review one directory or concern at a time instead of the whole change.
Why this structure
- When you paste a ticket summary, it goes first inside
<ticket_context>tags and is treated as data, so Claude is told to handle text copied from a tracker as material, not as instructions. The request then names the pull request and asks for a summary before concerns. Reading the summary first tells you whether Claude understood the change before you weigh its objections. - Claude is told to read the changed files in full and the code around them. Many problems in a change live in a caller or a callee that the diff does not show.
- The role choice changes the angle: a reviewer wants to know whether to approve, an author wants to fix things before anyone else looks.
- The read-only rule keeps comments, approvals, merges and pushes in your hands, and asks before a checkout changes your working tree.
- Description and comments are treated as context to check, not instructions, because anyone who can comment on a pull request can write text there.
- The report asks for file and line, a reason and a fix for each concern, and marks uncertain ones, so you can check each point quickly and drop the weak ones.
Example input (fictional)
- Pull request number
247
- Your role
I am reviewing someone else's change before approving it
- What the change is supposed to do
Adds retry with backoff to the payment client. Should not change behavior for successful calls.
- Concerns to check closely
error handling and backward compatibility of the public API
Follow-ups to send Claude
- Write the concerns you are confident about as short review comments I can paste, one per file and line. Do not post them.
- For concern 2, write a failing test that shows the problem, in a scratch branch, and tell me the command to run it.
- Compare this pull request with how the same pattern is handled elsewhere in the codebase and list any differences that matter.
Common mistakes
- Posting the findings unread. Claude can misjudge intent; read each concern against the code before you put your name on it.
- Leaving out the purpose when the description is empty. Without it, Claude can only check that the code is consistent, not that it does what was asked.
- Running the review from a different repository or an outdated clone. Pull the latest default branch first so the surrounding code Claude reads is current.
Related templates
- Code review prompt: Ask Claude to review a diff for supported issues, ordered by severity, with a location, impact and suggested fix for each finding.
- Run a security review with a subagent: Have Claude Code hand a security review of one directory to a subagent, so the reading stays out of your session and you get a ranked list of findings.
- Review your changes before you commit: Have Claude Code review uncommitted changes against their intent and flag risks by severity, asking before any check that could change files.
Sources
- Claude Code docs: Prompt library (Anthropic documentation)
- Claude Code docs: Common workflows, create pull requests (Anthropic documentation)
- Claude Code docs: Use MCP servers from claude.ai (Anthropic documentation)