Get a useful review of code you didn't write
A prompt for reviewing inherited code that returns ranked, specific findings instead of a list of style opinions — with a rule that stops it inventing problems.
You are reviewing code you did not write, in a codebase you cannot run.
Context: [WHAT THIS CODE DOES]. It runs [WHERE / HOW OFTEN]. The part that must
not break is [THE EXPENSIVE FAILURE].
Review the code below and report findings in this order:
1. Correctness — anything that produces a wrong result or loses data.
2. Failure behaviour — what happens on a timeout, a retry, a partial write, an empty input.
3. Security — injection, authorisation gaps, secrets in the wrong place.
4. Clarity — only where it would cause a future bug, not where it is merely unfashionable.
For each finding give: the specific line or function, what goes wrong, the concrete
input or sequence that triggers it, and the smallest change that fixes it.
Rules:
- Rank by consequence, not by how easy it is to describe.
- If you are unsure whether something is a bug, say so explicitly and say what you
would need to check. Do not present a guess as a finding.
- Do not comment on formatting, naming or import order.
- If you find nothing serious, say that plainly rather than padding the list.
```
[PASTE CODE]
```// WHAT TO REPLACE
[WHAT THIS CODE DOES]One sentence of business purpose. Without it, the model reviews syntax rather than behaviour.
[WHERE / HOW OFTEN]"A queue worker, ~50k times a day" changes the answer completely versus "a one-off migration script".
[THE EXPENSIVE FAILURE]The outcome you cannot afford — double-charging, losing a record, exposing another tenant's data. This is what makes the ranking useful.
// NOTES
The two lines that do the work
The consequence framing. Ask for “a code review” and you get a list sorted by how easy each item was to spot, which puts naming conventions above a race condition. Telling it what the expensive failure is gives it something to rank against.
Permission to be unsure. Without that line, a model asked to find problems will find problems, including ones that are not there. Inventing a plausible bug in inherited code is worse than missing a real one, because someone then spends an afternoon proving a negative.
Where this genuinely helps
Code you have just been handed and have to give an opinion on quickly. It is fast at spotting the categories a human skims past on a first read — unhandled error paths, retry behaviour, an input that is assumed non-empty.
Where it does not
It cannot see the rest of the system. Most serious bugs in an inherited codebase are not in any single file; they are in the gap between two files that each look fine. It also cannot tell you which weird-looking behaviour is load-bearing — legacy code is full of things that look like bugs and are actually the reason a decade of accounts reconcile.
That is why a real legacy assessment starts with characterisation tests rather than a read-through: you record what the code currently does before deciding what it should do.
// MORE PROMPTS
// LET'S BUILD
START APROJECT
