Skip to content

How to Make AI Act Like Your Senior Engineer (Code Review Prompts)

Copy-ready prompts that get ChatGPT or Claude to review code like a careful senior engineer: real bugs, risky changes and clear fixes, not style nitpicks.

By Orgwyse Published Last updated 6 min read

On this page
  1. Why a plain "review my code" prompt falls short
  2. What to include every time
  3. The senior engineer review prompt
  4. Focused review prompts
  5. Make it a standing reviewer
  6. Check the review before you act on it
  7. FAQ

To get a useful code review from AI, give it the context a senior engineer would ask for (what the change is meant to do, the language and framework, and what "good" means on your team), tell it to rank problems by severity, and ask it to show the failing case for every bug it claims. Without that, ChatGPT and Claude tend to praise the code and list style tweaks. With it, they read like a careful reviewer who explains what breaks, why, and what to change.

Why a plain "review my code" prompt falls short

Paste a function and type "review this," and you usually get a polite summary, a few naming suggestions and a generic note about error handling. The model doesn't know what the code is supposed to do, what has already been decided, or which problems you care about, so it guesses.

Anthropic's prompting guide suggests treating the model like "a brilliant but new employee who lacks context on your norms and workflows," and notes that being specific about the output you want improves results (Claude prompting best practices). A good review prompt is mostly that missing context.

What to include every time

  • The goal of the change. One or two sentences: "This adds retry logic to the payment webhook handler."
  • The stack. Language, version, framework and anything unusual ("Python 3.12, FastAPI, async SQLAlchemy").
  • The diff, not just the final file. Reviewers look at what changed. Paste the output of git diff or the pull request diff, plus any file the change calls into if it matters.
  • What to focus on. Correctness, security, performance, concurrency, readability or tests. Pick the ones that matter for this change.
  • What to skip. "Don't comment on formatting; a linter handles that." This alone removes most of the noise.
  • The output format. Ask for a ranked list with severity, so the important findings come first.

Never paste secrets, API keys, customer data or code you aren't allowed to share. If you're using a work account, follow your company's rules about which AI tools are approved.

The senior engineer review prompt

Copy this and fill in the brackets.

Prompt
You are a senior [language] engineer doing a code review. You are careful, direct and specific. You care about correctness first, then security, then maintainability. You don't praise code and you don't comment on formatting.

Context:
- What this change does: [one or two sentences]
- Stack: [language, version, framework]
- Constraints: [e.g., must stay backward compatible, runs in a hot path, handles user input]

Review the diff below. For each problem you find:
1. Severity: Blocker, Should fix, or Nit
2. Where: file and line or function
3. What goes wrong, with a concrete input or sequence of events that triggers it
4. The smallest fix, as a code snippet

List Blockers first. If you aren't sure something is a bug, say so and explain what you'd need to know to be sure. If you find no real problems, say that plainly instead of inventing some.

Diff:
[paste diff]

Two lines do most of the work. "A concrete input or sequence of events that triggers it" forces the model to prove each bug instead of hand-waving, and it makes false alarms easy to spot. "If you find no real problems, say that plainly" stops it from padding the list.

Focused review prompts

A single review that tries to cover everything tends to be shallow. For an important change, run a few focused passes.

Edge cases and failure paths

Prompt
List every input or state this code doesn't handle: empty values, nulls, very large inputs, duplicates, unexpected types, timeouts, partial failures and retries. For each, say what the code does today and what it should do.

Security

Prompt
Review this code as a security engineer. Look for injection, missing authorization checks, unsafe deserialization, secrets in code or logs, unvalidated user input and insecure defaults. For each finding, describe how an attacker would use it. Don't list generic advice that doesn't apply to this code.

Concurrency and state

Prompt
Assume this code runs in several processes at once and can be retried after a crash. Where can two runs interfere with each other, leave data half-written, or do the same work twice? Suggest the simplest fix for each.

Readability for the next person

Prompt
Imagine a developer new to this codebase has to change this code in six months. Which parts will confuse them, and why? Suggest renames, smaller functions or comments only where they'd clearly help.

Tests

Prompt
List the test cases this change needs, starting with the ones most likely to catch a real bug. For each, give the input, the expected result, and why it matters. Then write the three most important tests using [test framework].

Make it a standing reviewer

If you review code often, put the reviewer instructions where they apply automatically instead of pasting them every time:

  • In ChatGPT, use a Project's instructions or your custom instructions.
  • In Claude, set project instructions in a Project, which Claude applies to every chat in that project (Claude Help Center: Projects).

Keep the role, priorities and output format in the standing instructions, and paste only the context and diff per review. For how to structure those instructions, see how to write a system prompt. For prompts that help you write and debug code rather than review it, see prompts for coding.

Check the review before you act on it

An AI reviewer can be confidently wrong. It can flag a bug that the surrounding code already prevents, or miss one because it didn't see the caller.

  • Reproduce before fixing. Turn each claimed bug into a failing test or a quick manual check. If you can't make it fail, ask the AI what you're missing, or drop it.
  • Watch for invented APIs. Suggested fixes sometimes call functions or options that don't exist in your library version. Check the documentation.
  • Give it the missing file. If a finding depends on code it can't see, paste that code and ask again.
  • Push back. If a finding seems wrong, say why. Asking it to argue against its own review is a good test; see how to get honest criticism from AI.

Use AI review as a first pass that catches things before a human reviewer does, not as a replacement for one on code that matters.

FAQ

Can ChatGPT or Claude replace a human code reviewer?

No. They're good at catching common bugs, missing edge cases and unclear code quickly, but they don't know your system's history or unwritten rules and can be confidently wrong. Use them before human review, not instead of it.

Should I paste the whole file or just the diff?

Start with the diff plus a sentence on what the change does. Add whole files only when a finding depends on code outside the diff, such as the caller or a shared helper.

How do I stop the AI from nitpicking style?

Say so directly: "Don't comment on formatting or naming unless it causes a bug." Asking for severity levels and listing blockers first also pushes small issues to the bottom.

Is it safe to paste company code into an AI chatbot?

It depends on your employer's policy and the account you're using. Check which tools are approved, never paste secrets or customer data, and prefer a work account your company manages over a personal one for work code.

Why ask for a concrete failing input?

It makes the AI prove each bug. A real bug comes with an input or sequence of events that triggers it, which you can test. Findings that can't produce one are often false alarms.

Last updated 9 November 2026 · Spotted something out of date? [email protected]