Home/Blog/Prompt for Code Review Agent: 10 Prompts and a Template
Blog

Prompt for Code Review Agent: 10 Prompts and a Template

P
promptstudio

A prompt for code review agent setups plus 9 more: severity rules, evidence rules, ignore lists, security and test reviewers, summary comments, and test diffs.

Prompt for Code Review Agent: 10 Prompts and a Template

A good prompt for code review agent setups is a system prompt that tells the agent what it can see, what to review first, how to rate severity, what to ignore, and when to stay silent. Without those rules, an AI reviewer fills pull requests with vague or noisy comments. Below are 10 copy-paste prompts to build, test, and tune a code review agent, plus a flagship prompt that writes the full system prompt from your repo conventions.

Fill every [bracket] with your real stack and rules. These prompts generate text for any agent or bot that accepts a system prompt or instructions file. Check your own tool's documentation for where that text goes and what the agent can access.

Prompts for writing the system prompt

1. Full review agent system prompt

Write a system prompt for a code review agent on a [stack] repo. It sees [diff only or full repo] and [can or cannot] run tests. Include review priorities: [priorities], severity levels with examples, an ignore list: [ignore list], and a rule to say the change looks good when nothing meets the bar.

2. Severity definitions

Define blocker, major, minor, and nit for a code review agent on [stack]. Give one concrete example of each from code like ours: [short snippet or description].

3. Evidence rule

Write a rule for my review agent that requires every comment to cite the file and line, describe the concrete failure, and suggest a fix. Include two examples of comments that pass and two that fail.

4. Convert team conventions into agent rules

Here is our contributing guide: [guide]. Turn the parts a reviewer can check from a diff into short, testable rules for a code review agent, and list the parts it cannot check.

Prompts for specialized reviewers

5. Security focused reviewer

Write a system prompt for a review agent that only looks for security issues in [stack]: injection, missing auth checks, secrets in code, and unsafe deserialization. It must stay silent on style.

6. Missing tests reviewer

Write instructions for an agent that checks whether a diff adds or changes behavior without a matching test in [test framework]. It must skip type only and comment only changes.

7. Database migration reviewer

Write instructions for an agent that reviews [ORM or SQL] migrations for locking risk, data loss, and missing rollback steps, using only what is in the diff.

Prompts for testing and tuning

8. Test diffs for the agent

Here is my review agent prompt: [prompt]. Write six small test diffs for [stack] with the expected output for each, including one clean diff where the correct output is no comments.

9. Fix noisy comments

My review agent keeps posting comments like these: [examples]. Explain which rule is missing from its prompt and write the exact lines to add.

10. Summary comment template

Write a summary comment template my review agent posts once per pull request: counts by severity, the biggest risk, open questions, and what it did not review.

Generate the whole system prompt in one pass

The Code Review Agent Prompt: System Prompt With Severity Rules combines prompts 1, 2, 3, 8, 9, and 10. You give it your stack, team conventions, review priorities, ignore list, agent setup, comment format, and the false positives your team is tired of. It returns a ready to paste system prompt under 600 words, a summary template, five test diffs with expected behavior, and tuning notes. The example on the page sets up a reviewer for a TypeScript Express API that uses Prisma and zod.

Tips for running a code review agent

  • Tell the agent exactly what it can see. A diff only agent should ask, not assume.
  • Cap the number of comments. A few precise comments get read; twenty get ignored.
  • Keep a clean test diff in your test set so you know the agent can stay quiet.
  • Keep human review for merges. The agent is a first pass, not an approver.

Related prompts and guides

Reviewing your own branch before opening a pull request? Use the Claude Code Review Prompt: Branch Diff Review Before a PR or the Pull Request Code Review Assistant, and see Claude Code Prompts for Code Review. Setting up repo instructions for coding agents? Try the Cursor AGENTS.md and Project Rules MDC Generator. Find more in the Agents prompts hub, browse all prompts, or share a prompt your review agent runs on.