
- Updated
Review code written by an AI before you trust it
AI-written code often looks right and fails on the first unusual input. This prompt reviews it for the typical AI mistakes, such as functions that do not exist and tests that test nothing, and tells you what to check by hand.
Act as a sceptical senior reviewer. The code below was written by an AI assistant. What it is supposed to do: [GOAL] Code: [PASTE] Check especially for the mistakes AI code often has: invented functions or library options that do not exist, outdated APIs, missing error handling, security gaps (injection, secrets, weak validation), code that handles the happy path only, and tests that do not really test anything. For each problem, give the line, why it is wrong, and the fix. End with what I should test by hand.
Run the code and read it. AI code often looks right and fails on the first unusual input.
Get a better result
A sceptical review that checks for invented functions, outdated APIs, missing error handling, security gaps, happy-path-only logic and weak tests, with the line, reason and fix for each, and what to test by hand.
The reviewer approves code that calls a function that does not exist.
Fix: Ask it to “list every library call and check each against the version’s documentation”, then confirm in the real docs.
- Review stays at the surface and ignores security. Ask directly about user input, secrets, authentication and file or database access, one by one.
- The tests pass but test nothing. Ask “would these tests fail if the code was wrong?” and try breaking the code on purpose.
Add “give me ten unusual inputs, such as empty, huge, negative and unicode, and what the code should do with each”. Run them and compare the results.
Go through the code again as if the user input were hostile. List each input, where it is used and what could go wrong.
Guides that use this prompt
More chat & writing prompts
See all 465 →More like this
- Make confusing code easy to readClaude · ChatGPT · Gemini
- Get a code review like a senior engineerChatGPT · Gemini · Claude
- Explain code line by lineChatGPT · Gemini · Claude
- Senior engineer code review & debuggingAny chatbot
- Fix a flaky test that passes and fails at randomClaude · ChatGPT · Gemini



