Skip to content

Structured code review with risk ranking

Reviews a diff for bugs, security, readability and tests, and ranks findings by risk.

By Editorial team 4,800 uses 341 likes

Prompt

You are a senior {{language}} reviewer. Review the code below.

{{code}}

Return: (1) a one-paragraph summary, (2) findings ranked High/Medium/Low, each with the line, why it matters and a suggested fix, (3) missing tests, (4) anything you could not judge without more context. Do not nitpick formatting.

Example output

High: user input is passed to the query builder unescaped (line 42)...

Why this prompt works

  1. You are a senior {{language}} reviewer.Sets the reviewer's focus: idioms and common pitfalls of that language, not generic advice.
  2. a one-paragraph summaryChecks the model understood what the code does before it criticises it. A wrong summary is a quick signal to correct the context.
  3. findings ranked High/Medium/Low, each with the line, why it matters and a suggested fixRanking tells you what to fix first. Requiring the line and the reason keeps every finding checkable.
  4. missing testsReviews often skip this. Asking separately gets a list of cases to cover.
  5. anything you could not judge without more contextMakes uncertainty explicit and gives you a list of questions instead of confident guesses.
  6. Do not nitpick formatting.Linters handle style. This keeps the review on behaviour, security and clarity.

Variables

Placeholders in this prompt
PlaceholderWhat to putExample
{{language}} The language or framework, e.g. TypeScript with React TypeScript
{{code}} The function, file or diff to review. Paste the diff if you want line-level comments paste your code here

Fill in the fields below and the prompt updates as you type. Leave a field empty to keep its placeholder.

Your prompt

You are a senior {{language}} reviewer. Review the code below.

{{code}}

Return: (1) a one-paragraph summary, (2) findings ranked High/Medium/Low, each with the line, why it matters and a suggested fix, (3) missing tests, (4) anything you could not judge without more context. Do not nitpick formatting.

Variations

Short: security only

For a quick pass on code that handles input or secrets.

Review this {{language}} code only for security problems (injection, authentication, secrets, unsafe deserialisation, path handling). List each as High/Medium/Low with the line and a fix. Say "none found" if there are none.

{{code}}

Detailed: with project conventions

Paste your own rules so findings match your team.

You are a senior {{language}} reviewer on a team with these conventions:
[paste conventions]

Review the code below. Return a summary, findings ranked High/Medium/Low (line, why, fix), convention violations as a separate list, missing tests and anything you could not judge. Do not nitpick formatting.

{{code}}

Review for readability

For code a new teammate will have to maintain.

Read this {{language}} code as someone new to the project. List the 5 places that were hardest to understand and suggest a clearer name, comment or structure for each. Do not change behaviour.

{{code}}

Different use: review a pull request description

Check the explanation, not just the code.

Here is a pull request description and its diff:
[description]

{{code}}

Does the description match what the diff does? List anything in the diff that the description does not mention and anything described that the diff does not do.

How to use it in each model

  • Works as written. Paste related files under the code (types, the function's callers) and say they are context only, so the review can reason about how the code is used.

  • Paste the diff, not a screenshot. For files over a few hundred lines, split by file and say which file you are on in each message, so line references stay accurate.

  • Works as written. Ask it to quote the exact line it refers to in every finding, so you can verify each one quickly.

How to use this prompt

Use this prompt as a starting point and adapt the variables to your project.

  1. Fill in the variables so the prompt matches your situation.
  2. Run it in Claude and review the first result.
  3. Ask for one change at a time, such as tone, length or composition, rather than rewriting the whole prompt.

Tip: keep a copy of the version that worked so you can reuse it.