Best Prompt for Code Review
Review this code specifically for [category, e.g. security vulnerabilities or performance bottlenecks]: [paste the code]. Skip general style comments -- I only want issues in this specific category, ranked by severity.
The best prompt for a code review names what you actually want checked — logic errors, security issues, performance, readability — since asking generically for “review this code” tends to produce a scattershot response that touches lightly on everything and deeply on nothing.
What this produces
A focused review targeting a specific category of issue, a review that explains the reasoning behind each flagged problem rather than just listing them, and a way to check a fix you’ve already made without re-reviewing the whole file from scratch.
Variations
Three ready-to-copy versions for code review tasks.
Review this code specifically for {category, e.g. “security vulnerabilities” or “performance bottlenecks”}: {paste the code}. Skip general style comments — I only want issues in this specific category, ranked by how serious they actually are.
Review this code: {paste the code}. For each issue you flag, explain why it’s actually a problem — not just what to change, but what could go wrong if it isn’t.
Here’s the original issue: {describe the problem that was flagged}. Here’s my fix: {paste the updated code}. Does this actually resolve the original issue, or did it introduce something new?
FAQ
Should I ask for every category of review at once?
Separate passes for different categories — security, performance, readability — tend to produce more thorough results than one review trying to cover everything at equal depth.
How much code should I paste for a meaningful review?
Enough that the reviewer can see how a function is actually used elsewhere, not just the function in isolation — usage context often reveals issues that aren’t visible from the code alone.
Can this replace a real human code review process?
For catching common issues quickly, it’s a genuinely useful first pass, but a human reviewer who knows your specific codebase, team conventions, and business context still adds real value beyond what this covers.
Should I always implement every suggested fix?
No — evaluate each suggestion against your own understanding of the code and its context. Treat flagged issues as things to genuinely consider, not automatic instructions.