💻

Senior Code Reviewer

Performs a thorough senior-level code review covering security, performance, readability and best practices.

💻 Programming Advanced Claude ChatGPT Gemini

The prompt

You are a senior software engineer with 15+ years of experience across multiple languages and architectures.

Review the following code and provide a comprehensive analysis:

**1. Security Vulnerabilities**
- Identify any injection risks, auth flaws, data exposure issues
- Rate severity: Critical / High / Medium / Low

**2. Performance Issues**
- N+1 queries, memory leaks, unnecessary re-renders, inefficient algorithms

**3. Code Quality**
- Readability, naming conventions, function length, DRY violations

**4. Best Practice Violations**
- SOLID principles, design patterns, error handling gaps

**5. Improved Code**
- Provide refactored snippets with explanations

Be specific. Cite line numbers. Provide improved code examples for each issue.

---
Code to review:
[PASTE YOUR CODE HERE]

Replace everything in [SQUARE BRACKETS] before you run it. The bracketed fields are not optional — they are what the output is built from.

Why this prompt is built this way

The prompt opens by assigning seniority — "15+ years across multiple languages" — and that single line changes the register of everything that follows. Without it, a model asked to review code tends to produce style notes: naming, formatting, a missing semicolon. Framed as a senior engineer, it reaches for the issues a senior engineer reaches for first, which are the ones that cost money.

The five numbered sections are doing the real work, though. An open-ended "review this code" gets you whatever the model noticed first, which is usually whatever is most superficially visible. Naming the five categories forces coverage: security gets looked at even when the code is pretty, and performance gets looked at even when the logic is correct. The severity rating in section 1 matters more than it appears — it makes the model commit to a judgement rather than listing everything as equally concerning, which is what turns a review into a to-do list you can actually prioritise.

The closing instruction — be specific, cite line numbers, provide improved code — exists because models default to describing problems abstractly. "Consider adding input validation" is not actionable. A rewritten function is.

What to use it for

  • Pull request reviews
  • Learning best practices
  • Security audits
  • Junior developer mentoring

Adapting it to your situation

  • Name the language and framework in the role line. "Senior Rails engineer" produces different and better findings than the generic version — it knows about strong parameters, N+1 in ActiveRecord, and mass assignment.
  • Drop sections you do not need. Reviewing a pure utility function? Cut section 1. A shorter prompt focuses the model's attention rather than diluting it.
  • Add a sixth section for your own standards. If your team has a style guide or architectural rules, paste them in as an explicit category to check against.
  • Change the severity scale to match whatever your issue tracker already uses, so the output drops straight in.

Where this goes wrong

The biggest one is pasting too much. A whole file of 800 lines produces a shallow pass over everything; one function produces a genuinely useful review. Work in small units.

The second is treating the output as authoritative. A model cannot see your database schema, your middleware, or the validation that happens two layers up, so it will report vulnerabilities that your actual system already handles — and miss ones that depend on context it was never given. Every finding is a hypothesis to check, not a defect to fix on sight.

Which model to run it on

Works well on all three. Claude tends to be the most thorough on the reasoning behind each finding; ChatGPT is usually fastest to a refactored snippet. Whichever you use, paste the code as a fenced block so indentation survives.

Practical tips

For best results, specify the programming language and framework. Include surrounding context (e.g., database schema, imports). Paste one function or file at a time for focused analysis.