Skip to content

Added cursor rules docs page #1965

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,11 @@
"guides/ai-agents/generate-translate-copy",
"guides/ai-agents/route-question",
"guides/ai-agents/respond-and-check-content",
"guides/ai-agents/verify-news-article",
"guides/ai-agents/translate-and-refine"
"guides/ai-agents/translate-and-refine",
"guides/ai-agents/verify-news-article"
]
},
"guides/cursor-rules",
"guides/frameworks/drizzle",
"guides/frameworks/prisma",
"guides/frameworks/sequin",
Expand Down
51 changes: 51 additions & 0 deletions docs/guides/cursor-rules.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: "Using Cursor with Trigger.dev"
sidebarTitle: "Cursor rules"
description: "This guide shows how to add Cursor rules to a project to help you write Trigger.dev tasks faster and more accurately."
icon: "hexagon"
---

## Overview

[Cursor](https://www.cursor.com/) is a powerful AI coding editor which understands your codebase and can help you write code faster and more accurately. This guide shows you how to add our Cursor rules to your project to help you write Trigger.dev tasks.

## Prerequisites

- [Cursor](https://www.cursor.com/) installed on your machine

## Installing our Cursor rules

1. Locate the `.cursor/rules` folder in your project root, or click the "add new rule" button in `Cursor Settings` > `Rules`.
2. Download the [writing-tasks.mdc](https://github.com/triggerdotdev/trigger.dev/blob/main/.cursor/rules/writing-tasks.mdc) file and place it in the `.cursor/rules` folder
3. For more help installing Cursor rules, see [Cursor's docs](https://docs.cursor.com/context/rules-for-ai)

<video
src="https://content.trigger.dev/cursor-rules-write-task.mp4"
preload="auto"
controls={true}
loop
muted
autoPlay={true}
width="100%"
height="100%"
/>

| <span style={{ color: '#28BF5C' }}>Helps with</span> | <span style={{ color: '#E11D48' }}>Don't use it for</span> |
| ---------------------------------------------------- | ---------------------------------------------------------- |
| Creating basic tasks | Deploying |
| Creating scheduled tasks | Project setup |
| Creating schema tasks | Infrastructure configuration |
| Triggering tasks from backend | API keys |
| Task lifecycle functions | Using tags |
| Using Realtime | |
| Idempotency patterns | |
| Metadata handling | |
| Using build extensions | |

## Tips for making the most of Cursor

1. **Turn on auto-run** in Cursor settings. This allows Cursor to act more like an agent that checks for errors, fixes them, runs commands to install packages, and it won't stop until the code is error-free and running. _NB: Use this mode with caution, as it can make changes without your approval._

2. **Use version control like GitHub or GitLab**, and commit frequently, so you can roll-back if something changes unexpectedly. Cursor can make changes to multiple files at once, so it's best to commit often to keep track of all your changes.

3. **Explicitly add context when needed** - Cursor should know when to use the rules file, but I recommend selecting it from the "@ Add context" button above the prompt window. Then select "Cursor Rules" and select your rules file.
5 changes: 1 addition & 4 deletions docs/guides/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Get set up fast using our detailed walk-through guides.
| [AI Agent: News verification](/guides/ai-agents/verify-news-article) | Orchestrate fact checking of news articles |
| [AI Agent: Route questions](/guides/ai-agents/route-question) | Route questions to different models based on complexity |
| [AI Agent: Translation refinement](/guides/ai-agents/translate-and-refine) | Evaluate and refine translations with feedback |
| [Cursor rules](/guides/cursor-rules) | Use Cursor rules to help write Trigger.dev tasks |
| [Prisma](/guides/frameworks/prisma) | How to setup Prisma with Trigger.dev |
| [Python image processing](/guides/python/python-image-processing) | Use Python and Pillow to process images |
| [Python PDF form extractor](/guides/python/python-pdf-form-extractor) | Use Python, PyMuPDF and Trigger.dev to extract data from a PDF form |
Expand Down Expand Up @@ -80,10 +81,6 @@ Task code you can copy and paste to use in your project. They can all be extende
| [Vercel AI SDK](/guides/examples/vercel-ai-sdk) | Use Vercel AI SDK to generate text using OpenAI. |
| [Vercel sync environment variables](/guides/examples/vercel-sync-env-vars) | Automatically sync environment variables from your Vercel projects to Trigger.dev. |

## Cursor rules

If you use Cursor, we have a set of Cursor rules which will help you build your tasks. You can find our installation guide [here](https://trigger.dev/changelog/cursor-rules-writing-tasks/).

<Note>
If you would like to see a guide for your framework, or an example task for your use case, please
request it in our [Discord server](https://trigger.dev/discord) and we'll add it to the list.
Expand Down