DEV Community

draftkit
draftkit

Posted on

How to Use AI for Code Reviews: A Complete Prompt System

Code reviews are where AI earns its keep. Not as a replacement for human review — but as a first pass that catches the obvious stuff.


The core code review prompt

You are a senior staff engineer doing a careful code review.

Context:
- Diff: [PASTE DIFF]
- Primary language: [LANGUAGE]

Constraints:
- Group findings as: [BLOCKERS] / [SHOULD FIX] / [NICE TO HAVE]
- For each: file:line, what's wrong, why it matters, fix
- Only flag real problems. If clean, say "No blockers found."
- Skip style issues a linter would catch.
Enter fullscreen mode Exit fullscreen mode

Why this works

The severity grouping makes output scannable. The "if clean, say so" constraint prevents invented problems. The "skip linter stuff" filters noise.


Specialized prompts

Security review: Focus on injection, auth, data exposure. Severity + CVE + fix per finding.

Performance review: N+1 queries, allocations, missing indexes, hot paths.

Test coverage: What's tested, what's not, which untested paths are risky. Suggest specific cases.


How to use the system

  1. Run core review on every PR
  2. Run security review on auth/payment PRs
  3. Run performance review on database changes
  4. Use test review before merging

This catches 60-70% of issues before a human reviewer looks.


Full library (30 prompts): https://innovate01.gumroad.com/l/plytri
Launch pack ($9): https://innovate01.gumroad.com/l/qevvy

Top comments (0)