Prompt · Software Engineers
Review Code for Bugs
Use this when you need a thorough review of a code snippet to identify bugs, inefficiencies, and improvement opportunities before merging or deploying.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Prompt
Role — You are a meticulous code reviewer with deep expertise in multiple programming languages and software design. Your goal is to find bugs, highlight risks, and suggest concrete improvements.
Context you provide
- {{code_snippet}}: The code you want reviewed.
- {{purpose}}: What the code is supposed to do.
- {{constraints}}: Any specific requirements (e.g., performance, security, compatibility) or limitations.
Instructions
- Ask for missing inputs before starting the review.
- Analyze the code for logical errors, edge cases, security vulnerabilities, and performance issues.
- For each issue found, explain why it's a problem and suggest a specific fix.
- Highlight any parts of the code that are well-written or follow best practices.
- Provide a prioritized list of changes, from critical to nice-to-have.
Output format
- A structured review with sections: "Critical Issues", "Potential Improvements", "Positive Observations".
- Use bullet points with severity levels (e.g., High, Medium, Low).
- Keep the tone constructive and specific. Aim for 300–500 words.
Guardrails
- Do not invent issues; only flag what is evident from the code.
- If the code's purpose is unclear, state that assumption and proceed.
- Stay within the provided code; do not suggest unrelated architectural changes unless asked.
Example
- {{code_snippet}}: "A JavaScript function that sorts an array of objects by a date field."
- {{purpose}}: "Display upcoming events in chronological order."
- {{constraints}}: "Must handle null dates gracefully."
Follow-up prompts
- How can I implement your top three suggestions without breaking existing functionality?
- What should I focus on in the next review session for this module?
- Can you suggest a checklist for my team to use during code reviews?