---
title: "Recipe: AI code review on pull requests with Cursor"
description: "TL;DR: When a pull request is opened, this playbook runs a Cursor-powered review of the diff, posts inline comments and a summary on the PR, and notifies the team in Slack. Trigger is a GitHub webhook; outputs are PR review comments and a Slack message."
canonical_url: "https://docs.ballet.dev/articles/recipe-ai-code-review-on-pull-requests-with-cursor-wTn3NSBGE6"
md_url: "https://docs.ballet.dev/articles/recipe-ai-code-review-on-pull-requests-with-cursor-wTn3NSBGE6.md"
---
# Recipe: AI code review on pull requests with Cursor

**TL;DR:** When a pull request is opened, this playbook runs a Cursor-powered review of the diff, posts inline comments and a summary on the PR, and notifies the team in Slack. Trigger is a GitHub webhook; outputs are PR review comments and a Slack message.

## Who this is for

Engineering teams that want a consistent first-pass review on every PR.

## What you'll need

- **Connectors:** GitHub, Cursor (first-party integration), Slack.
- **Secrets:** GitHub token, Cursor API key, Slack token.
- **Trigger:** Webhook on pull request opened/synchronized.

## How to build it with Ask Ballet

1. Open the Console on Home.
2. Paste the prompt below; set repos and review focus.
3. Review the plan and confirm.
4. Connect GitHub, Cursor, and Slack, then add the PR webhook.

```text
Build a playbook that triggers when a GitHub pull request is opened. Fetch the diff and
changed files, run a Cursor review focused on bugs, security, and missing tests, and
post a summary comment on the PR plus inline comments for specific issues. Add a label
"needs-changes" or "looks-good" based on the result, and post a short summary to
#code-reviews in Slack with the PR link and verdict.
```

## What the playbook does

1. **Webhook trigger** — receives the PR event.
2. **HTTP step (fetch diff)** — gets the changed files and diff from GitHub.
3. **Code step (Cursor review)** — runs the review and structures findings.
4. **HTTP step (comment + label)** — posts PR comments and sets a label.
5. **HTTP step (Slack)** — posts the verdict summary.

## Variations and tips

- Skip draft PRs and dependency-bump PRs with a filter in the trigger/Code step.
- Keep the review advisory — require human approval before merge.
- Route review findings that look like real bugs into [Error triage](/articles/recipe-triage-new-errors-into-tracked-issues-2RazVCF2Zk).

## Related articles

- [Error triage](/articles/recipe-triage-new-errors-into-tracked-issues-2RazVCF2Zk)
- [How do first-party integrations (Cursor, Freshdesk) work?](/articles/how-do-first-party-integrations-cursor-freshdesk-work-ufEctQFe4A)
- [How do I edit steps (Code and HTTP)?](/articles/how-do-i-edit-steps-code-and-http-47pGJ6HgKr)
- [What are Allow vs Ask permission modes?](/articles/what-are-allow-vs-ask-permission-modes-GYMSyh6ZZI)
