Back to the blog
TutorialsOctober 18, 20268 min read

How to Use Cursor for Code Review: Review Rules, Diff Checks and PR Workflows

Use Cursor for code review: review your branch before pushing, review PRs with the GitHub CLI, use Bugbot, and add a copy-ready .cursor/rules code review rule.

Cursor is built for writing code, but its codebase search is just as useful for reviewing it: the Agent can see how changed code connects to the rest of the project and whether it breaks patterns used elsewhere. Cursor itself recommends self-review before submitting PRs. What usually goes wrong is the prompt: "review this" produces generic advice. This guide gives you three workflows, a copy-ready review rule and an honest look at where the editor-chat approach starts to hurt.

Way 1: Review your branch in the Agent before you push

Open the Agent chat on your feature branch and give it an explicit scope. Telling it to run the diff itself means it reviews exactly what changed, not whatever files happen to be open.

Cursor Agent — review the current branch
Review the changes on this branch compared with origin/main.
Run git diff origin/main...HEAD to see them.
For each modified function, check its callers and tests.
Report bugs, security issues and missing tests with file and line.
Do not edit any files.

Once a prompt works well for your codebase, Cursor lets you save it as a custom command (for example /review) so you do not retype it before every PR.

Way 2: Review an existing Pull Request with the GitHub CLI

To review a teammate's PR, check it out locally so Cursor can read the full code around the change, then save the PR description and diff where the Agent can read them.

Terminal — prepare a PR for review
gh pr checkout 123
gh pr view 123 > /tmp/pr-123.md
gh pr diff 123 > /tmp/pr-123.diff
Cursor Agent — review the PR
Read /tmp/pr-123.md for the intent and /tmp/pr-123.diff for the changes.
Check whether the code does what the description says.
Follow the code-review rule. Do not edit files.

Way 3: Let Bugbot review PRs on GitHub

Cursor Bugbot reviews Pull Requests automatically when you push and looks for logic errors rather than lint issues. It reads its own instructions from .cursor/BUGBOT.md, not from your editor rules. Our tutorial on configuring BUGBOT.md for PR reviews covers the setup, and Bugbot vs Codex vs Claude Code compares it with other reviewers.

Create a code review rule in Cursor

Project rules live in .cursor/rules as .mdc files with a small frontmatter block (description, globs, alwaysApply). A plain .md file in that folder is ignored, and the single .cursorrules file is the legacy format. For reviews, use a rule the Agent pulls in by description, so it does not clutter normal coding tasks.

.cursor/rules/code-review.mdc
---
description: Strict code review of a diff or Pull Request. Use when asked to review changes.
alwaysApply: false
---

# Code review rule

You are reviewing changes, not writing them. Do not edit files.

## Scope
- Review only the diff you are given, but read callers, tests and types it touches.
- Compare with how similar code is handled elsewhere in the repository.

## Check, in this order
1. Correctness: logic errors, null/undefined, off-by-one, unhandled errors.
2. Security: authorization checks, input validation, secrets, injection.
3. Data: migrations, backwards compatibility, race conditions.
4. Tests: is the new behavior covered? Is a regression test missing?

## Output format
For every finding:
- Severity: critical | major | minor
- File and line
- What is wrong and why it matters
- Suggested fix (one or two lines)

If nothing important is found, say so. Skip formatting and naming nits.

Why this rule works

  • Read-only: the Agent reviews instead of silently "fixing" your code.
  • Ordered checks: correctness and security come before style.
  • Fixed output: every finding has severity, location and a fix, so it is easy to act on.

For language-specific variants (TypeScript, Python) and step-by-step setup, follow the tutorial Create a Code Review Rule in Cursor.

Where reviewing in the editor chat starts to hurt

  • Large PRs fill the chat context, and the Agent loses track of earlier files.
  • Findings live in a chat thread: no history per branch or per PR.
  • You repeat the same setup (checkout, diff, prompt) for every review.
  • Posting results to GitHub or GitLab is manual copy and paste.

How CodeCrab automates this on your machine

CodeCrab is a desktop app that runs these reviews with the AI tools you already use, including Cursor, Claude Code, Codex and Copilot. It prepares the diff and context for each PR, runs pre-push reviews on your branch, collects reviewer feedback in My PRs and keeps a history of every review. Your code stays on your laptop. See the Cursor integration guide or the Claude Code version of this workflow in Can Claude Code review PRs?

Quick questions

Does Cursor have a built-in code review?

Bugbot reviews PRs on GitHub; inside the editor, you review with the Agent and your own rules or commands.

Should I still use .cursorrules?

It still works but is legacy. Move rules into .cursor/rules/*.mdc and do not keep conflicting copies.

Does Bugbot read my .mdc rules?

No. Bugbot uses .cursor/BUGBOT.md.

What about Copilot or GitLab?

See GitHub Copilot code review and reviewing GitLab merge requests with AI.

Try it on your next Pull Request

Free Public Beta — runs 100% on your machine. No code leaving your laptop.

Download CodeCrab

KEEP READING