Code Review Prompt for Claude: Severity-Ranked Findings
A copy-paste code review prompt for Claude that returns severity-ranked findings with evidence, fixes and open questions. For claude.ai, Claude Code or API.
By Claudekit Team Published 2 min read
- Category
- Coding
- Use case
- Review a diff or file for bugs, security issues and maintainability before merging
- Tested with
- Claude Fable 5.1, Claude Opus 5.5, Claude Sonnet 5.5, Claude Haiku 5.5
Use this prompt when you want a fast, structured first-pass review of a pull request, a diff, or a single file. It asks Claude to rank every finding by severity, quote the exact lines it is talking about, and keep guesses separate from facts.
The prompt
You are a senior software engineer doing a careful code review. Your review will be read by the author before merge, so be specific, cite exact lines, and keep the tone direct and constructive.
<context>
Project / language: {{PROJECT_CONTEXT}}
What this change is supposed to do: {{CHANGE_INTENT}}
Team conventions or constraints (optional): {{CONVENTIONS}}
</context>
<code>
{{DIFF_OR_CODE}}
</code>
<instructions>
1. Read the whole change before writing anything.
2. Review for, in this order: correctness bugs, security issues, data loss or concurrency risks, error handling, performance, readability and naming, missing or weak tests.
3. Only report issues you can point to in the code above. Quote the relevant line(s) for every finding.
4. If something depends on code or intent you cannot see, put it under "Open questions" instead of guessing.
5. If the change intent is missing or unclear, say so first and ask up to 3 clarifying questions before the review.
</instructions>
<output_format>
## Summary
Two or three sentences: what the change does and your overall verdict (approve / approve with changes / request changes).
## Findings
For each finding:
- Severity: Critical | High | Medium | Low | Nit
- Location: file and line(s), with a short quote
- Problem: what is wrong and why it matters
- Fix: a concrete suggestion, with a code snippet when useful
Order findings from most to least severe.
## Missing tests
Specific test cases that should exist.
## Open questions
Things you could not verify from the provided code.
</output_format>
How to use it
- claude.ai: paste the prompt, replace the placeholders, and paste the diff (for example the output of
git diff main...HEAD) into the code block. - Claude Code: save the prompt as a skill at
.claude/skills/review-diff/SKILL.mdand replace the code block with$ARGUMENTSor a dynamic diff injection. See the Claude Code skills guide. Claude Code also ships a bundled/code-reviewskill you can try first. - API: put the role sentence in the system prompt and the rest in the user message.
Variables
| Variable | What to put there |
|---|---|
{{PROJECT_CONTEXT}} | Language, framework, and what the module does |
{{CHANGE_INTENT}} | The PR description or ticket summary |
{{CONVENTIONS}} | Style rules, banned patterns, performance budgets |
{{DIFF_OR_CODE}} | The diff or file under review |
Example output (illustrative)
## Summary
Adds retry logic to the payment webhook handler. Request changes: one High issue.
## Findings
- Severity: High
Location: webhook.ts L42 "await chargeCustomer(event)"
Problem: Retries re-run the charge without an idempotency key, so a timeout can bill twice.
Fix: Pass event.id as the idempotency key to the payment client.
Tips and variations
- Security-only pass: replace step 2 with a list of the risks you care about (injection, authz checks, secrets in code).
- Large PRs: review one file or module at a time. Quality drops when the diff is huge.
- Pair it with tests: follow up with the unit test generator prompt for the “Missing tests” section.
- More prompting techniques: Claude prompting best practices.
Frequently asked questions
Should I paste the whole file or only the diff?
Paste the diff plus any surrounding code Claude needs to judge it, such as the function being changed and its callers. A diff without context produces more questions and more false positives.
Can Claude replace human code review?
No. Use it as a first pass that catches obvious bugs and missing tests so human reviewers can focus on design and product intent. A person should still approve the merge.
Why does the prompt ask for open questions?
Some findings depend on intent the code does not show. Asking Claude to list them separately keeps guesses out of the findings list and tells you exactly what to clarify.