Most developers ask AI to "review my code" and get back vague suggestions like "consider adding error handling" or "this could be more readable." That's useless.

The problem isn't the AI — it's the prompt. A generic prompt gets a generic review. A specific, structured prompt gets findings with severity ratings, exact line references, and working fixes.

Here are 10 prompts I use daily that catch real bugs, security issues, and performance problems. Each one is designed to produce actionable output you can immediately apply.

1. SQL Injection Audit

This one has caught more real vulnerabilities in my PRs than any linter:

Review this code for SQL injection vulnerabilities. For each finding:
1. Show the exact line and explain how an attacker could exploit it
2. Provide the fixed version using parameterized queries
3. Rate severity as Critical/High/Medium/Low

Code:
[paste your code here]

Why it works: The structured output format forces the AI to be specific. Instead of "watch out for SQL injection," you get "Line 42: cursor.execute(f"SELECT * FROM users WHERE id = {user_id}") — an attacker can pass 1; DROP TABLE users as user_id." Plus a fixed version using parameterized queries.

2. Performance Bottleneck Detector

Analyze this code for performance bottlenecks. For each issue found:
1. Identify the specific line or pattern causing the bottleneck
2. Explain the performance impact (Big-O complexity, memory usage, I/O cost)
3. Provide an optimized version with before/after complexity comparison
4. Rate impact as Critical/High/Medium/Low

Focus on: unnecessary iterations, N+1 queries, missing indexes, memory leaks,
blocking I/O, excessive allocations, and redundant computations.

Code:
[paste your code here]

I ran this on a Django view last week and it found a classic N+1 query I'd missed in review — a for user in users: user.profile.name without select_related. In production, that would have been 500 extra database queries per page load.

3. XSS Vulnerability Scanner

Scan this code for Cross-Site Scripting (XSS) vulnerabilities. Check:
- Reflected XSS in user input rendering
- Stored XSS in database-backed content
- DOM-based XSS in JavaScript
- Missing output encoding/escaping
- Unsafe use of innerHTML, dangerouslySetInnerHTML, or v-html

For each finding, show the vulnerable code, an attack payload, and the fix.

Code:
[paste your code here]

The "attack payload" part is key. When the AI shows you the exact string an attacker would use, it makes the vulnerability visceral and impossible to ignore in code review.

4. Error Handling Review

Review this code's error handling strategy. For each issue:
1. Identify missing or inadequate error handling
2. Show what could go wrong (specific failure scenarios)
3. Provide the improved version with proper error handling
4. Rate risk as Critical/High/Medium/Low

Check for: bare except clauses, swallowed exceptions, missing null checks,
unchecked return values, missing timeout handling, and error messages that
leak internal details.

Code:
[paste your code here]

5. Dead Code Finder

Scan this codebase for dead code and unused imports. For each finding:
1. Identify the exact location (file, line, function/variable name)
2. Explain why it's unreachable or unused
3. Recommend: remove, refactor, or keep with justification
4. Estimate lines of code that can be safely removed

Code:
[paste your code here]

This consistently finds 10–20% more dead code than IDE tools, especially conditional branches that are technically reachable but logically impossible given business rules.

6–10: The Full Set

The remaining prompts cover:

Get All 10 Prompts (Free)

I've packaged all 10 prompts into a downloadable file you can keep in your project:

— completely free, no strings attached.

Want 100 More?

If these 10 prompts are useful, the full 100 Code Review Prompts for AI pack covers 10 complete categories including Go/Rust/Java-specific prompts, DevOps/infrastructure review, architecture review, and PR workflow automation. Every prompt is engineered to produce structured, actionable output.


What prompts do you use for AI-assisted code reviews? I'd love to hear what works for you in the comments.