Skip to main content
rule

pr-review-cursorrules-prompt-file — Cursor rule: PR review

A Cursor rule for focused pull request reviews across security, performance, tests, and architecture, with file-line references and severity labels.

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/pr-review-cursorrules-prompt-file.mdc
Open on GitHub

What pr-review-cursorrules-prompt-file does

This rule guides Cursor when reviewing a pull request or a group of changes. It selects a review angle from the user’s request; when none is given, it asks for one or starts with security. Each finding needs a file path and line number, a severity of blocker, important, or nit, and a concrete explanation. The review ends with a separate verdict.

The security angle checks access control, unsafe input, injection paths, exposed secrets, encoding, cryptography, and data leaks. Performance review looks for N+1 calls, repeated allocations, unbounded work, poor async flow, cache mistakes, and hidden complexity. The tests angle examines new branches, edge cases, weak assertions, mocks, determinism, and test names. Architecture review covers layer boundaries, coupling, premature abstractions, scaling, rollback difficulty, and naming.

The rule applies to all paths through globs: **/*, while alwaysApply: false keeps it conditional. Full file context matters here: a diff alone can miss a defect just outside the changed lines. That limitation is built into the review guidance.

What it helps with

  • review a PR for security defects
  • spot performance regressions in changed code
  • check tests for missing branches and weak assertions
  • inspect layer boundaries and coupling
  • rank review findings by severity

Example prompts for the agent

  • Review this pull request for security issues and cite the file path and line for every finding.
  • Check these changes for performance problems, including N+1 calls, unbounded work, and incorrect async flow.
  • Review the architecture of this PR and finish with Architecturally sound | needs trim | re-think before merging.

How to install pr-review-cursorrules-prompt-file

Manually: put the files in place

.cursor/rules/pr-review-cursorrules-prompt-file.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about pr-review-cursorrules-prompt-file

How do I install pr-review-cursorrules-prompt-file in Cursor?

Create the rule file at .cursor/rules/pr-review-cursorrules-prompt-file.mdc in the project and place the rule content there. The installation path is .cursor/rules/pr-review-cursorrules-prompt-file.mdc.

What does pr-review-cursorrules-prompt-file do?

It steers PR reviews toward security, performance, tests, or architecture. Findings include file and line references, severity labels, concrete details, and a final verdict.

Why does the rule ask for full file context?

A diff can miss a defect just outside the changed lines. The rule therefore asks for the surrounding file when the patch does not provide enough context.

Source text

pr-review-cursorrules-prompt-file.mdc · CC0-1.0
---
description: "Cursor rules for focused PR reviews with severity ranking, file and line citations, and separate review angles for security, performance, tests, and architecture."
globs: **/*
alwaysApply: false
---
# PR Review — focused review prompts for Cursor

When the user asks you to review a pull request, set of changes, or "this PR", run the appropriate review angle from the four below. Pick based on the user's emphasis ("security", "perf", "tests", "arch"). If unspecified, ask which angle, or default to security.

Output discipline (applies to all angles):

- Cite file path and line number for each finding.
- Rank findings by severity: blocker, important, nit.
- Be specific. "This looks risky" is not a finding; "src/auth.ts:42 — JWT secret read from request body, see line 41" is.
- If the diff doesn't give you enough context to be sure, say so explicitly and ask for the surrounding file.
- End with a verdict on its own line: `Safe to merge | needs changes | reject`.

---

## Angle 1: SECURITY

You are reviewing the PR for security defects. Focus, in order of priority:

1. **Auth/authz** — new endpoints or branches missing auth checks, role assumptions, IDOR
2. **Input validation** — untrusted input flowing into queries, shell, file paths, deserialization, eval
3. **Injection** — SQL, NoSQL, command, prompt injection, template injection
4. **Secrets** — hardcoded keys/tokens, secrets in logs, secrets in client-bundled code, .env committed
5. **Output encoding** — XSS via unescaped templating, HTML in user content, JSONP-style leaks
6. **Crypto/randomness** — Math.random for tokens, MD5/SHA1, missing IVs, custom-rolled crypto
7. **Data exposure** — PII in logs, overshared API responses, missing redaction

Skip nice-to-haves. Stick to defects.

---

## Angle 2: PERFORMANCE

You are reviewing for performance regressions. Focus:

1. **N+1 patterns** — loops doing DB/network calls per item without batching
2. **Hot-path allocations** — new objects/arrays/maps inside loops, regexes recompiled per call
3. **Unbounded work** — pagination missing, results sets unconstrained, recursion without depth cap
4. **Bad async** — sequential awaits where Promise.all is correct, missing concurrency limits
5. **Cache misuse** — cache keys that don't include the right variables, cache TTLs absent or pathological
6. **Algorithm complexity** — O(n^2) hidden in `.some` over `.map`, sort inside loops

Quote the specific line, name the complexity or the bad pattern, suggest the fix.

---

## Angle 3: TESTS

You are reviewing the test coverage on this PR. Focus:

1. **Tests for new code paths** — every new branch should have at least one test
2. **Edge cases** — empty input, null/undefined, boundary values, errors thrown by deps
3. **Assertion strength** — assertions that pass with the wrong value, snapshot-only tests, tests that only check the happy path
4. **Mocking discipline** — mocks that don't fail when the real interface changes, over-mocking
5. **Determinism** — date/time/random/network not stubbed, leading to flakes
6. **Test names** — names that don't describe behavior

A test that exists is not the same as a test that catches regressions. Read the assertions, not the test name.

---

## Angle 4: ARCHITECTURE

You are reviewing the *shape* of the change. Pull back from line-level concerns:

1. **Boundary drift** — where did the seam between layers move? Did UI start reaching into DB? Did domain types start importing transport types?
2. **Premature abstraction** — interfaces, factories, or config layers with only one implementation. These are debt.
3. **Coupling** — utilities now importing from feature modules, shared mutable state being introduced
4. **Scalability** — if this code path goes 10x, what breaks first?
5. **Reversibility** — if this turns out wrong in a month, how hard is the rollback? One-way doors should be called out.
6. **Naming** — types/functions named for the implementation (`UserManagerImplV2`) rather than the role (`UserDirectory`).

End with: `Architecturally sound | needs trim | re-think before merging`.

---

Pair these prompts with full file context for best results. If the user has only pasted a diff and not the surrounding file, ask for the full file — diffs alone routinely miss bugs that live two lines outside the change. The companion CLI [prpack](https://github.com/Lucas2944/prpack) automates this.

© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules

Similar IDE rules

All IDE rules for Code review and refactoring →

From the same set210

pyqt6-eeg-processing-cursorrules-prompt-file Configures Cursor for building PyQt6 desktop apps focused on EEG signal processing and data visualization. Helps separate heavy analysis from the interface. ★ 41,024repo stars py-fast-api A Cursor rule for Python FastAPI backends. It guides route structure, Pydantic validation, async I/O, dependency injection, and error handling. ★ 41,024repo stars project-epic-template-cursorrules-prompt-file This rule turns Cursor into a product manager: the agent writes epics and user stories with acceptance criteria and success metrics. ★ 41,024repo stars pr-template-cursorrules-prompt-file Sets up the agent to generate structured Pull Request templates for GitHub, GitLab, and Azure DevOps. Helpful for standardizing team code reviews. ★ 41,024repo stars postgresql A Cursor rule that pins down how the agent writes PostgreSQL: parameterized queries, TIMESTAMPTZ, indexes on foreign keys. Useful once the agent starts touching your SQL. ★ 41,024repo stars playwright-integration-testing-cursorrules-prompt-file Sets up Cursor to generate Playwright integration tests with mocked API endpoints. Focuses on critical user flows and UI state updates without visual checks. ★ 41,024repo stars playwright-e2e-testing-cursorrules-prompt-file A Cursor rule that turns the agent into a QA engineer for Playwright and TypeScript, writing a 3–5 test file from a feature description. ★ 41,024repo stars playwright-defect-tracking-cursorrules-prompt-file A Cursor rule that makes the agent write Playwright tests tied to manual case IDs, with screenshots and logs as defect evidence. ★ 41,024repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor