---
name: review-code-prompt
description: A prompt for a thorough code review of a diff or pull request covering bugs, security, edge cases, performance and readability, with findings ranked by severity and concrete fixes. Use when the user wants code reviewed, a PR checked, a second opinion on changes, or to find bugs before merging.
license: CC-BY-4.0
metadata:
  category: coding-prompts
  tags: "code-review,pull-request,security,quality"
  author: johnny-bravo
  version: "1.0"
  updated: "2026-10-31"
  status: published
---

# Review code (prompt)

## When to use
- Before merging AI-written or human-written changes.

## Prompt
```text
Act as a strict senior engineer reviewing this change. Context: {{WHAT THE CHANGE IS FOR}}.

Review the diff below. Report findings as a table: severity (blocker/major/minor/nit), file:line, problem, suggested fix.
Check in this order:
1. Correctness: logic errors, off-by-one, null/undefined, async/await mistakes, race conditions.
2. Security: injection, missing auth checks, secrets in code, unsafe input handling, XSS.
3. Edge cases: empty, large, unicode, concurrent, network failure.
4. Tests: what is untested; propose the 3 most valuable tests.
5. Performance: N+1 queries, needless re-renders, unbounded loops.
6. Readability: naming, dead code, duplication.
Do not restate the code. If it is good, say so briefly. End with "merge / merge after fixes / do not merge".

{{DIFF}}
```

## How to adapt
- Get the diff with `git diff main...HEAD` or paste the PR URL into a tool that can read it.
- For a security-only pass, keep step 2 and add "assume a hostile user".

## Example prompt
"Can you check my PR for bugs before I merge it?"
