Code Reviewer Prompt
What this prompt does
This prompt gives your code a structured review, the way a careful colleague would: it looks for bugs, for code that is hard to read, and for places where a simpler approach would work better. It is designed for a single function or a short file — a review of a whole project in one prompt is too shallow to be useful.
The prompt
Act as a careful code reviewer. Review this code and give me honest, specific feedback.
Programming language: [LANGUAGE, e.g. "Python"]
What the code is supposed to do: [ONE OR TWO SENTENCES]
What I am worried about: [YOUR CONCERN, e.g. "it feels slow" or "I am not sure the error handling is right" — or "nothing in particular"]
Code:
```
[PASTE YOUR CODE HERE]
```
Review the code in this structure:
1. Summary: 2-3 sentences on what the code does and your overall judgement.
2. Bugs and risks: a list of anything that is wrong or could break. For each item, say where it is, why it matters, and how to fix it. If you cannot find a bug, say so.
3. Readability: a list of anything that makes the code hard to read or maintain — unclear names, long functions, missing comments where they are needed. Suggest a better name or structure for each one.
4. Improvements: 2-3 suggestions that would make the code better, in order of value. Do not suggest a rewrite for its own sake.
5. What is good: 2-3 things the code already does well.
Rules:
- Be specific. Quote the line or function you are talking about.
- Do not invent problems. If a part of the code is fine, say so.
- Do not rewrite the whole file. Suggest fixes, and only show a short corrected version for the most important bug, if there is one.
- Keep the whole review under [WORD COUNT, e.g. 600 words].
Which model
Written for both ChatGPT and Claude. Paste it as one message, including the code. Claude is often stronger at careful code review and catching edge cases; ChatGPT is also strong, especially for common patterns.
How to use it
- Copy the prompt into ChatGPT or Claude as one message.
- Paste one function or one short file section inside the code block. A focused review beats a shallow review of a whole project.
- Say what the code is supposed to do and what you are worried about. A reviewer who knows your worry gives you a better review.
- Send it and read the bugs section first. Fix the real bugs before you worry about style.
- Apply the readability fixes you agree with, then run your tests again to make sure nothing broke.
Example
Input: A Python function that reads a list of user names from a file and counts how many appear more than once. Concern: not sure the error handling is right.
Tips
-
- Review small pieces of code often. A review of 50 lines is far more useful than a review of 500.
- If the model suggests a fix you do not understand, ask it to explain the fix before you apply it. Never paste in a change you do not understand.