Skip to main content

Code Review Prompt Templates

Get actionable feedback: bugs, risks, and missing tests


1) Review a PR diff (bugs + tests + risks)

Act as a senior engineer doing a code review.

Input:
- PR goal: [GOAL]
- How tested: [COMMANDS]
- Diff (or changed files):
[PASTE DIFF]

Output:
- Findings ordered by severity
- Any missing tests
- Potential regressions
- Suggested follow-ups

2) Security-focused review

Review this code for security issues.

Focus on:
- auth/authorization mistakes
- injection risks
- secrets handling
- data validation
- unsafe defaults

Code or diff:
[PASTE]

3) Performance review

Review this change for performance risks.

Focus on:
- algorithmic complexity
- N+1 queries / repeated calls
- unnecessary re-renders (frontend)
- caching opportunities

Code or diff:
[PASTE]

4) Review for maintainability

Review this module for maintainability.

Focus on:
- clarity and naming
- separation of concerns
- error handling and observability
- public API design

Code:
[PASTE]

5) Test gap review

Given this feature change, list the test cases that should exist.

Feature:
[DESCRIBE]

Changed code/diff:
[PASTE]

Return:
- A prioritized list of tests to add
- Why each test matters

FAQ

What input produces the best reviews?

A diff or changed files, plus context about expected behavior and how it was tested.

How do I get less generic feedback?

Ask for file/line references, severity ranking, and concrete follow-up steps.

What should a review always include?

Behavioral risks, security concerns, and missing tests.