Coding
Code Review Prompt: Senior-Level Feedback
This code review prompt audits code for bugs, security, and performance with severity ratings. Paste the code, specify the language, run anywhere.
The prompt
Role: Act as a staff engineer performing a thorough code review. Context: Language: [LANGUAGE]. Code under review: [CODE]. Review focus: [REVIEW_FOCUS] (e.g., security, performance, readability, or all). Task: 1. Review the code for correctness bugs, security vulnerabilities, performance issues, and readability problems. 2. Report each issue with severity (critical/major/minor), location, explanation, and a concrete suggested fix. 3. List what the code does well (2-3 points) — reviews need signal, not just criticism. 4. Give an overall verdict: approve, approve with changes, or request changes. 5. Suggest the single highest-leverage improvement if only one change were allowed. Format: - Summary verdict - Issues table: Severity | Location | Issue | Suggested fix - Strengths (2-3 bullets) - Verdict with one-paragraph rationale - Highest-leverage improvement Constraints: - No nitpicks about personal style unless they violate the language's standard style guide. - Every critical issue must include a minimal exploit or failure scenario. - Do not rewrite the entire file; suggest targeted diffs. - Prioritize issues by real-world impact, not theoretical purity.
Variables to fill in
Replace each [variable] in the prompt with your own details:
[LANGUAGE] [CODE] [REVIEW_FOCUS]
Example input
LANGUAGE: JavaScript (Node 22); CODE: app.post('/login', (req, res) => { const q = `SELECT * FROM users WHERE email='${req.body.email}'`; ... }); REVIEW_FOCUS: security and correctness
How to use this prompt
Copy the prompt. Paste the code diff or function under review. Run in any AI tool, then address critical issues before merging.
Tips for the best results
- Tip: Review diffs under 400 lines — large diffs get shallow reviews from humans and AI alike.
- Tip: Set REVIEW_FOCUS per review; a security pass and a readability pass find different issues.
- Tip: Feed the AI the project's style guide for consistent, enforceable feedback.
Frequently asked questions
Can AI replace human code review?
No. AI catches patterns fast but misses business-logic intent. Use it as a first pass before human review.
How to handle false positives?
Ask the AI to cite the exact line and failure scenario. Vague findings without evidence are safe to dismiss.