The red-pen review prompt: make AI tear apart its own diff
The best code reviewer I have ever worked with costs 20 bucks a month and never gets tired of my diffs. I build Settl, an expense-splitting app, solo with Claude, and nothing merges without this ritual: a fresh session, a cold diff, and a prompt that makes the reviewer hostile on purpose.
Never ask the author
The obvious move is to end a coding session with "review what you just wrote". It is also the weakest possible review. The session that wrote the code is attached to its own work in a very literal way: its context is full of the reasoning, the assumptions, and the trade-offs that produced the code. Ask it to review and it re-reads its own justifications and finds them convincing. Of course it does. It wrote them.
Human teams learned this a long time ago: the author presents, someone else reviews. Same model, same rule. The fix costs nothing: open a fresh session and paste the diff cold, with no history, no justifications, no "we decided X because". Just the code, facing a stranger.
The red-pen prompt
You are a skeptical senior engineer reviewing a diff before it merges. You
did not write this code and you have no attachment to it. Assume it contains
at least one real problem; your job is to find it.
Review for: edge cases and unhandled inputs, security (injection, auth gaps,
leaked secrets, unsafe defaults), race conditions and concurrency, error
handling that swallows failures, and anything that breaks in production at
2am under real traffic.
For each finding give: file and line, what goes wrong, a concrete scenario
that triggers it, and a severity of BLOCK, FIX SOON, or NIT.
Do not summarize what the diff does. Do not compliment the code. Findings
only, ordered by severity. If nothing rises above NIT, say so explicitly
and list what you checked.
<paste your diff here>
Every line of the persona is load-bearing. "Skeptical" and "assume at least one real problem" switch the model out of its default agreeable register. "You did not write this" severs the attachment. "2am under real traffic" points it at the failure modes that matter instead of naming conventions. And "do not compliment the code" saves you three paragraphs of throat clearing before the first finding.
What cold eyes actually catch
The gap between same-session and fresh-session review is not subtle. Cold review reliably surfaces the classics:
- Race conditions. The check-then-act on a shared row that is fine in the demo and corrupts data under two concurrent requests.
- Missing null checks on the path the author reasoned about once, decided was impossible, and stopped seeing. Fresh eyes have no memory of that decision, so they check.
- Real security holes. The endpoint that trusts a client-supplied user id, the error response that echoes internal paths, the query built with string concatenation.
The pattern across all three: they hide in the author's assumptions, not in the syntax. The writing session carries those assumptions in context. The cold session has to re-derive them from the code alone, and where it cannot, you get a finding.
Triage the findings
Three buckets, so review output becomes decisions instead of a wall of text:
- BLOCK: do not merge. Data loss, security, corruption, a crash on a common path. Fix now, re-run the review on the new diff.
- FIX SOON: merge is fine, but open a ticket now, dated this week. Missing retry on a flaky external call, an unbounded list that is fine until it is not.
- NIT: naming, style, structure. Batch them for a cleanup pass or drop them. Never let a NIT delay a merge.
Triage discipline matters more than it looks. Without severity labels every review reads as "here are eleven problems", which trains you to skim. With labels, most reviews read as "no blockers, two tickets, ignore the rest", and you keep doing them.
One more rule: review findings are claims, not orders. If a BLOCK looks wrong, push back in the review session and make it defend the triggering scenario. A finding that survives your pushback is real. One that folds immediately was noise, and pushing back is how you learn to tell the difference.
Make it a ritual
Reviews you have to remember to run stop happening by Thursday. Wire it to the merge instead: the diff against main IS the reviewable unit, and producing it is one command:
git diff main > review.diff
Then the ritual: fresh session, red-pen prompt, paste review.diff, triage, fix blockers,
merge. Ten minutes, most of which is the model typing. In Claude Code you can skip the file
entirely and have the fresh session pull the diff itself, which is what the prompt below does.
The ritual is also the honest answer to "can I trust AI-written code?". Not by reading every line yourself at 11pm, and not by trusting vibes. By making a second, unattached instance attack the diff before it ships, every time, including for the code you wrote yourself. My own diffs fail the red pen about as often as Claude's do.
Run this on your codebase
Open a fresh session (not the one that wrote the code) in your repo and paste this:
Run: git diff main
(If this branch is main, run git diff HEAD~1 instead.)
Then review that diff as a skeptical senior engineer who did not write it
and has no attachment to it. Assume it contains at least one real problem.
Check: edge cases and unhandled inputs, security (injection, auth gaps,
leaked secrets, unsafe defaults), race conditions, error handling that
swallows failures, and what breaks in production at 2am under real traffic.
For each finding: file and line, what goes wrong, a concrete triggering
scenario, and a severity of BLOCK, FIX SOON, or NIT. No summary of what the
diff does, no compliments, findings only, worst first. If nothing rises
above NIT, say so and list what you checked.