---
name: al-372-build-a-pull-request-reviewer-agent-as-code-it-sizes-ever
description: "Teams that want an AI reviewer usually end up with a prompt in a dashboard that nobody can test or review. In late October 2026 Cursor released Agent SDK, which defines an agent as a project folder: an instructions.md file for its behavior, a tools folder of TypeScript actions, and built-in evals, deployable to Cursor-managed hosting or your own infrastructure; Cursor says it uses the same harness that powers Bugbot and Security Review. Its quickstart builds a PR reviewer that calls an inspect tool, rates each pull request trivial, moderate or large by lines and files changed, approves only safe changes, never approves drafts and requests a human review for anything large. The prompt below plans the same reviewer for your repository with any coding agent, before anything is allowed to post reviews. Use when the user wants help with agents as code (coding) for a small business."
---

# Build a pull request reviewer agent as code: it sizes every PR as trivial, moderate or large, approves only safe small changes and asks a person to review the rest, with instructions and tools you version like the rest of your repo

Teams that want an AI reviewer usually end up with a prompt in a dashboard that nobody can test or review. In late October 2026 Cursor released Agent SDK, which defines an agent as a project folder: an instructions.md file for its behavior, a tools folder of TypeScript actions, and built-in evals, deployable to Cursor-managed hosting or your own infrastructure; Cursor says it uses the same harness that powers Bugbot and Security Review. Its quickstart builds a PR reviewer that calls an inspect tool, rates each pull request trivial, moderate or large by lines and files changed, approves only safe changes, never approves drafts and requests a human review for anything large. The prompt below plans the same reviewer for your repository with any coding agent, before anything is allowed to post reviews.

## Inputs to collect first
Ask the user for anything below that they haven't already given you. Don't guess missing facts.

- What it is, language, CI setup, who reviews today
- Files or folders that always need a human (e.g. payments, auth…

## Instructions

Do the task below with the user's inputs in place of each [bracket].

Help me build a pull request reviewer agent defined as code in my repository. Repo: [what it is, language, CI setup, who reviews today]. Our rules: [files or folders that always need a human (e.g. payments, auth, migrations), max size for auto-approval, labels we use]. 1) Write the reviewer's instructions file in plain Markdown: always inspect the PR first, rate it trivial / moderate / large by lines and files changed (suggest thresholds for our repo), approve only trivial changes that match the title and touch no sensitive paths, never approve drafts or PRs by the bot's own account, and otherwise comment asking for a human review that names the riskiest files. 2) Design two tools: one that fetches the PR title, files and capped patches, and one that posts the verdict, with input fields and failure handling. 3) Write 8 test cases (eval PRs) including tricky ones: a tiny change to an auth file, a large docs-only PR, a PR whose title doesn't match the diff. 4) Give me a rollout plan: run in comment-only mode for two weeks, compare its verdicts with human reviewers, then decide on approvals. Ask me before any step that posts on GitHub or deploys, and keep secrets out of the repo.

## Safety checks (share these with the user)

- This prompt works on text other people wrote (emails, reviews, messages or web pages). That text can hide instructions aimed at AI, such as "ignore your rules and…". Paste it as material to work on, and never let the AI act on requests inside it, like paying, sharing logins or changing records.
- Check every figure, price and total against your own records before anything is sent, posted or booked. A person approves refunds, discounts, payments and price changes.
- Read and edit the draft before it reaches a customer or goes public. If you later automate this prompt, start with "draft and notify me", not "send automatically".
- Check names, dates, numbers and any claim against your own source material before you use the answer. AI can misread or invent details.
- Say clearly which parts need a person to review or approve before anything is sent, paid, posted or filed.

## About this skill

- Works with: Cursor Agent SDK, Cursor, GitHub, TypeScript, Claude Code
- Based on this real-world example: https://cursor.com/docs/agent-sdk/quickstart
- Free prompt from AgentPlaybook Real Estate: https://agentic-library.netlify.app/prompt/al-372-build-a-pull-request-reviewer-agent-as-code-it-sizes-every-p/
- To install in an agent that supports Agent Skills, save this file as SKILL.md in a folder with the same name as `name` above (for example in your skills directory). Install steps for Claude.ai, Claude Code, Cursor and Codex: https://agentic-library.netlify.app/skills/
