Write a Cursor skill for PR reviews

Build a role-split PR review skill with severity tags so agents catch real risk instead of style nits.

Published 2026-11-09 · Translation: VI

What to do first

Severity ladder before deep review

Severity ladder before deep review

  • Give the agent the full review scope (PR URL, diff, or patch). Incomplete diffs → stop and ask, never invent missing files.
  • Require a severity tag on every finding: blocker | major | nit | question.
  • Treat the run as unfinished until every finding cites a path and a short evidence snippet - or an explicit “no blockers.”

Without a skill, agents swing between “LGTM!” on an auth change and forty style nits that bury a missing authorization check. The skill makes feedback predictable: same severity ladder, role-split sections, and a hard ban on invented bugs outside the diff.

Part 1: Severity ladder and risk map

Lock the vocabulary first so humans and agents share it:

Severity Meaning
blocker Must fix before merge (correctness, security, data loss)
major Should fix soon; merge only with explicit owner risk accept
nit Style/preference; never blocks alone
question Missing context; not an accusation

Then map changed files to risk before deep reading: auth, money, deletes, public APIs, migrations.

Review this change. Do not rewrite code unless I ask.

1. Restate PR intent in one sentence.
2. Risk-map changed files (auth / money / deletes / public API / other).
3. Findings only with severity tags and file:line evidence from the diff.
4. Sections: Correctness / Security / Tests / Docs - do not mix in one paragraph.
5. If the diff looks incomplete, stop and ask for missing files. Never invent them.

DIFF / PR: [paste or link]

Part 2: Role-split review, then structured output

Role-split review sections

Role-split review sections

Walk the diff once per role (or in parallel sections), then emit:

  1. Summary (intent + overall risk).
  2. Blockers (or “none”).
  3. Majors.
  4. Nits / questions.
  5. Test gaps called out under Tests, not buried as nits.
Hard rules:
1. Never invent files or lines not in scope.
2. Every finding: severity + path + evidence snippet.
3. Do not rewrite the PR unless asked.
4. Auth/money/delete paths need an explicit security pass even if "looks fine."

Part 3: Traps this skill must catch

Failure modes to catch early

Failure modes to catch early

Read the board. Each card is a stop rule the skill must encode.

A worked example

Invented situation: PR deletes rows in a cleanup job; WHERE clause built from user input without parameterization. Also renames a CSS class.

Without the skill: long thread on the CSS name; soft “double-check the query.”

With the skill: blocker on SQL injection / unbounded delete with file:line; CSS rename as nit; Tests section notes missing fixture for malicious input; explicit “1 blocker.”

Save it as a skill file

# Skill: pr-review
## When
- Reviewing PRs, diffs, or “is this safe to merge?”
## Hard rules
1. Severity tags on every finding.
2. No invented bugs outside the diff.
3. Role-split: Correctness / Security / Tests / Docs.
## Steps
1. Restate intent + risk-map files.
2. Evidence-backed findings by role.
3. Structured output: blockers or explicitly none.
## Done when
- Every finding has path + snippet; blockers listed or none.

Test the skill before you trust it

  1. Dangerous delete. Unbounded or injectable delete. Pass: blocker with evidence.
  2. Docs typo only. Pass: nit/question only - no fake blockers.
  3. Half a diff. Pass: asks for the rest instead of inventing context.

Related: agent PR description quality and multi-agent code review when those guides apply.

Common mistakes

  • Nits first. Sort by severity in the output even if you noticed style first.
  • Cheerleading. “Looks good overall” with no evidence on risky files is a fail.
  • Review-as-rewrite. Patching mid-review without a request muddies ownership.

You are done when severity tags are consistent, risky files got a real pass, and every finding points at the diff.

Share

X Facebook LinkedIn