Home/Blog/Claude Code Prompts for Code Review: 10 Prompts to Copy
Blog

Claude Code Prompts for Code Review: 10 Prompts to Copy

P
promptstudio

10 Claude Code prompts for code review: check your branch diff read-only, rank findings by severity, test security and coverage, and approve each fix.

Claude Code Prompts for Code Review: 10 Prompts to Copy

Claude Code prompts for code review work best when you keep the review read-only and specific. Ask Claude Code to compare your branch with the base branch, report findings ranked by severity with file and line, and wait for your approval before it edits anything. The 10 prompts below cover a full pre pull request review, from scope to security, tests, and the PR description.

Run them in Claude Code from the repository root on the branch you want reviewed. Because Claude Code can run commands in your terminal, tell it which checks are safe to run and that it should not edit, commit, or push until you say so.

Prompts to set up the review

1. Scope the diff

Compare [branch] with [base] using git diff --stat and git log. List the files changed, rough size of the change, and any file that looks unrelated to this goal: [what the change should do]. Do not edit anything.

2. Intent check

The change is supposed to [intent, ticket]. Read the diff and tell me what is missing, what is extra, and anything that behaves differently from the intent.

Prompts for the findings

3. Severity ranked review

Review the diff against [base] like a senior engineer. Report at most [number] findings ranked blocker, major, minor, nit. For each: file and line, what is wrong, why it matters, and a concrete fix. Quote code exactly.

4. Security pass

Review only the security of this diff: input validation, auth and permission checks, secrets, injection, unsafe deserialization, and information leaks in error messages. Say what you checked and what you could not verify.

5. Risk area deep dive

I am least sure about [area]. Trace every code path in the diff that touches it, list edge cases, and tell me which ones are not handled.

6. Convention check

Check the diff against CLAUDE.md and the patterns used elsewhere in this repo. For each mismatch, cite an existing file that shows the expected pattern.

Prompts for tests

7. Run the safe checks

Run only these commands: [test, lint, type check]. Report the actual output. Do not run migrations, deploys, or anything that sends messages.

8. Test gap list

List the behavior changed in this diff that has no test, and write the names and short descriptions of the test cases to add. Do not write the tests yet.

Prompts to finish

9. Approved fixes only

Turn the blocker and major findings into numbered fix steps. I will reply with the numbers to apply. Change only those, then rerun [checks] and show me the diff.

10. Pull request description

Write a pull request description for this branch: summary, what changed, how it was tested (only the checks you actually ran), and known risks.

Run the full review in one prompt

The Claude Code Review Prompt: Branch Diff Review Before a PR combines these steps into one read-only review: scope, intent check, ranked findings, a risk area pass, conventions, test review with real command output, open questions, a fix plan you approve by number, and a PR description draft. The example reviews a password reset branch and catches an expiry check that never runs, reusable tokens, and an endpoint that reveals which emails exist.

Make it a repeatable command

If you run the same review often, save it as a custom slash command in your project so the whole team uses the same checklist. Keep the read-only rule in the command text.

Related prompts

For reviewing someone else's pull request outside Claude Code, use the Pull Request Code Review Assistant. To package this review as a reusable command, see Claude Code Slash Command from a Repeatable Job, and for CI pipelines try the GitHub Actions Security Hardening Reviewer. Find more in the Coding prompts hub, browse more prompts, or share a prompt from your own review workflow.