Review AI-generated code before I merge it
Checks code written by an AI assistant for the specific mistakes these tools make: invented APIs, shallow tests, and hidden security gaps.
The prompt
Review code that was written with an AI coding assistant before I merge it.
The code or diff: [PASTE]
What I asked the assistant to do: [THE ORIGINAL TASK OR PROMPT]
Language, framework, and versions: [e.g. "TypeScript, Next.js 15, Prisma 6"]
Project conventions: [ERROR HANDLING STYLE, LOGGING, FOLDER STRUCTURE, EXISTING HELPERS - optional]
How much I understand this code: [FULLY / PARTLY / NOT REALLY]
Check specifically for problems that are common in generated code:
1. Invented or outdated APIs: functions, options, or imports that may not exist in my versions. List each one as "[VERIFY in docs]" rather than assuming.
2. Scope drift: changes beyond what I asked for, deleted or weakened code, disabled checks, removed error handling, or commented-out tests.
3. Tests that don't test: assertions that always pass, mocks that replace the code under test, tests that mirror the implementation instead of checking behavior.
4. Security: unvalidated input, injection, missing authorization checks, secrets in code, overly permissive CORS or file access, unsafe deserialization.
5. Silent failure: swallowed exceptions, fallback values that hide errors, retries without limits.
6. Duplication: reimplementing helpers that likely exist in my codebase, or adding new dependencies unnecessarily.
7. Edge cases: empty inputs, nulls, large inputs, concurrency, time zones.
Return:
- A verdict: merge, merge after fixes, or rewrite.
- A findings table (location, issue, severity, fix).
- The questions I should be able to answer about this code before I own it in production. If I said I don't fully understand it, explain the parts I most need to understand.
Highlighted [brackets] are blanks to replace with your own details.
Fill in the blanks and use this promptMore Software Development prompts
What to fill in
- PASTE
- THE ORIGINAL TASK OR PROMPT
- e.g. "TypeScript, Next.js 15, Prisma 6"
- FULLY / PARTLY / NOT REALLY
- VERIFY in docs
How this prompt is built
This prompt follows the RTF structure (Role, Task, Format). RTF tells the model who to be, what to do and what shape the answer should take. It is the quickest structure that still gives noticeably better results than a bare request.
Related prompts
- Reply to code review comments I disagree withDrafts calm, evidence-based replies to review feedback so you can resolve disagreements without stalling the pull request.
- Diagnose slow launches and API cold starts in my mobile appA codebase-specific diagnosis of startup time, serverless cold starts, and network waste, with fixes ranked by impact on perceived speed.
- Set up experiment tracking for a machine learning training runStep-by-step setup to log metrics, hyperparameters, and artifacts from your training script, locally or on a cluster.
- Diagnose and fix a flaky testWorks out why a test passes and fails intermittently, how to reproduce it, and how to fix the cause rather than adding retries.