Code Review Prompt — the Review Contract
"Review this code" gets shallow comments. The review contract gets findings with severities, a checklist, and a verdict.
AI wrote it; review it with extra suspicion: strict correctness review of the diff, because generated code fails confidently.
AI-generated code has a signature failure mode: it looks right. It compiles, reads cleanly, handles the happy path — and invents an API, drops an edge case, or quietly changes behavior it wasn't asked to touch. This setup reviews AI-generated changes as diffs under strict correctness: the twelve correctness checks plus diff criteria (does the change do ONE thing? is changed behavior covered by changed tests? what's the regression risk in touched paths?), with every finding flagged and the verdict withheld until the checklist is done.
Review the diff, not the file
Diff scope flags unrelated changes — the assistant's favorite way to expand its own scope.
Verify every external call
Invented APIs are the signature AI failure: each external symbol the diff introduces deserves a checklist pass.
Demand changed tests for changed behavior
The diff criterion that catches the silent behavior change generated code loves to slip in.
It reports only — the instruction "Review only — report findings; do not rewrite the code" is explicit, and each finding is one bullet as [SEVERITY] location — what is wrong and why. It ends with an APPROVED or CHANGES REQUIRED verdict, but a human still decides whether to merge and does the fixing. It generates review text; catching every issue is not guaranteed.
Through the criterion "Whether the diff does one thing — unrelated changes flagged." Because the scope is the CHANGE, not the whole codebase, and "Removed lines matter as much as added ones," unrequested edits get surfaced as findings. It flags them for your judgment; you and your reviewers still confirm each one before the code lands.
This targets correctness of the change — logic errors, null dereferences, race conditions, invented APIs across the twelve-item checklist — not output shape. The notFor line points format checks ("JSON, structure") to the AI Output Validator instead. Here you paste a diff under CODE TO REVIEW; the generated prompt judges behavior, then you run it in your assistant and own the merge call.
"Review this code" gets shallow comments. The review contract gets findings with severities, a checklist, and a verdict.
Twelve security checks — injection, auth, secrets, SSRF, privilege escalation — reviewed the way an attacker would read the code.
Architecture review for the public surface: abstractions that earn their place, dependency direction, seams, and the patterns the codebase already has.
"Refactor this code" invites silent behavior changes. The refactoring contract preserves business rules, outputs, and side effects — and flags uncertainty instead of deciding it.
getByRole over CSS chains, auto-wait over sleep, web-first assertions — Playwright tests written the way Playwright wants.
A side-by-side way to decide between two ChatGPT prompt drafts — scored on clarity, specificity, output control, and risk instead of gut feeling.
Generate code review prompts for any scope — snippet, file, diff, or full pull request — with focused review rules.
AI-written code usually compiles and passes a quick test while hiding the real risks — a missing auth check, a destructive update, an untested edge case. Here's a review path that surfaces them before you merge.