Skip to main content
Prompt

Code Review Prompt: Correctness First

A review prompt that reports bugs with file, line, a failure scenario, severity and a fix, and skips style nitpicks.

By Matthews WongUpdated

Key takeaway

Paste this with a diff, a branch or a pull request. The agent reads the changed files in full, then looks for bugs, broken edge cases, missing error handling, security issues and missing tests. Each finding has a severity, a file and line, a concrete failure scenario and a suggested fix. It leaves style alone unless the style hides a bug, and it says plainly when it finds nothing.

1 file

The file

Exactly what the download contains. Read it first, then copy or download.

code-review-prompt.md
Review this change for correctness. I want the bugs, not a style pass.

What to review: [THE DIFF, BRANCH, PULL REQUEST OR FILES]
What the change is meant to do: [ONE OR TWO SENTENCES, OR THE TICKET TEXT]

## Before you judge

Read every changed file in full, not only the changed lines. Read the callers of anything whose behavior or signature changed, and the tests that cover it. If you only have the diff and need more to be sure, ask for the file instead of assuming what it contains.

## Look for, in this order

1. **Bugs:** wrong logic, wrong conditions, off-by-one errors, null or undefined values, wrong types, race conditions, broken callers.
2. **Broken edge cases:** empty input, zero, very large input, duplicates, retries, time zones, concurrent requests, partial failure.
3. **Missing error handling:** swallowed errors, unchecked results, no timeout, no rollback, failures the user never sees.
4. **Security:** unvalidated input, injection, missing authorization checks, secrets in code or logs, data shown to the wrong user.
5. **Missing tests:** changed behavior with no test, or tests that would still pass if the code were wrong.
6. **Intent:** compare the change with what it is meant to do, and name anything missing or extra.

## Report each finding like this

- **Severity:** blocker (wrong result, data loss, security), major (fails in a realistic case) or minor (unlikely, or low impact)
- **Where:** file path and line
- **What fails:** a concrete scenario: this input or this sequence, the result now, the result expected
- **Fix:** the smallest change that solves it, as a short snippet or a clear description

Start the reply with one line: the count per severity, and whether you would merge it. Then list the findings, blockers first.

## Do not

- No style, naming or formatting comments, unless the style hides a bug. If it does, say which bug.
- No finding without a failure scenario. If you cannot describe how it breaks, put it under "Questions", not under findings.
- Do not report a bug because you did not read the code that handles it. Check first.
- Do not pad the list. If you find nothing, say "No correctness problems found", then list what you checked.
- Do not edit any file. This is a review.

End with "Not verified": anything you could not confirm, such as code you could not see or tests you could not run.
How to use it

From download to working

Use it when

  • You want a second pass on your own branch before you open a pull request.
  • An agent wrote the change and you need a review that did not write it.
  • AI reviews keep giving you naming and formatting comments and miss the bugs.
  • You review a colleague's pull request and want a list of things to verify yourself.
  1. Give it the change

    In Claude Code or Cursor, name the branch or the commit range and let the agent read the files. In a chat window, paste the diff and, for anything that matters, the full changed files too.

  2. Say what the change is meant to do

    Fill the second placeholder with one or two sentences or the ticket text. Without the intent, the agent can check whether the code is consistent, but not whether it does the right thing.

  3. Read the first line, then the blockers

    The reply opens with the count per severity and whether the agent would merge. Findings follow, blockers first. Each one gives a scenario you can turn into a test: the input, the result now and the result expected.

  4. Verify before you fix

    Try the failure scenario for each blocker and major finding. A review model can be wrong about code it read too quickly. Fix what you confirm, then run the prompt again on the new diff.

What is inside

Why it is written this way

It reads whole files, not only the diff

The agent reads each changed file in full, the callers of anything whose behavior changed, and the covering tests. Many real bugs sit outside the changed lines: a caller that still passes the old argument, or a test that no longer tests anything.

A fixed order of concerns

Bugs, edge cases, error handling, security, tests, then intent. The order puts the things that cause incidents ahead of everything else, and the lists under each one name concrete cases such as retries, time zones and partial failure.

No finding without a failure scenario

Each finding must say which input or sequence breaks, the result now and the result expected. If the agent cannot describe how it breaks, the item goes under Questions. This rule removes most vague warnings from the list.

Severity has definitions

Blocker means a wrong result, data loss or a security problem. Major fails in a realistic case. Minor is unlikely or low impact. With definitions, the top of the list is what you must fix before merging.

It is allowed to find nothing

The prompt tells the agent not to pad the list and to say No correctness problems found, followed by what it checked. A closing Not verified section lists what it could not confirm, so a clean result does not claim more than it covers.

Watch for

What goes wrong

  • With only a pasted diff, the agent cannot see the callers or the tests. Expect more items under Not verified, and paste the files it asks for.
  • A finding is a claim, not a fact. Run the failure scenario before you change code because of it.
  • A review by the same session that wrote the code tends to agree with itself. Start a fresh session for the review.
  • It does not replace a human reviewer, tests or CI. It does not run the code unless you ask, and it knows nothing about decisions that were never written down.
Questions

Frequently asked

Short answers before you download it.

What is a good prompt for AI code review?

One that says what to look for, in what order, and what a finding must contain. This prompt puts correctness first and requires a severity, a file and line, a concrete failure scenario and a suggested fix for every finding. It also tells the agent what to leave out.

How do I stop the AI from nitpicking style in a review?

Say it in the prompt and give it a test for what counts. This one bans style, naming and formatting comments unless the style hides a bug, and requires a failure scenario for every finding. A comment about a variable name cannot pass that test.

Should I paste the diff or the whole files?

Give it both where you can. The diff shows what changed, and the full files show whether the change is correct in its surroundings. In an agent that can read the repository, name the branch and it will read the files and their callers itself.

Can I trust the result when it finds nothing?

Trust it for what it lists as checked, and no further. The reply ends with a Not verified section naming the code it could not see and the tests it could not run. A clean review of a diff is weaker than passing tests, so keep both.

Go deeper

Learn what this file packages

Free lessons and articles on this site that explain the ideas behind it.

More from the toolkit

Take these too

PromptFree

Plan Before Code Prompt

A planning prompt that covers business, domain, tech design and steps, then lists the decisions it needs from you.

  • Claude Code
  • Cursor
  • Claude.ai

1 file2.3 KB.md

PromptFree

Codebase Onboarding Prompt

A read-only prompt that maps an unfamiliar repository: what it does, how to run it, how a request flows, what is risky.

  • Claude Code
  • Cursor
  • Claude.ai

1 file2.3 KB.md

PromptFree

Debugging Prompt: Reproduce First

A debugging prompt that makes the agent reproduce the bug and prove the cause before it touches any code.

  • Claude Code
  • Cursor
  • Claude.ai

1 file2.3 KB.md

All toolkit items