Skip to content
89 changes: 24 additions & 65 deletions docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@
},
"favicon": "/images/favicon.png",
"contextual": {
"options": [
"copy",
"view",
"claude"
]
"options": ["copy", "view", "claude"]
},
"navigation": {
"dropdowns": [
Expand All @@ -40,11 +36,7 @@
"pages": [
{
"group": "Tasks",
"pages": [
"tasks/overview",
"tasks/schemaTask",
"tasks/scheduled"
]
"pages": ["tasks/overview", "tasks/schemaTask", "tasks/scheduled"]
},
"triggering",
"runs",
Expand All @@ -59,12 +51,7 @@
"errors-retrying",
{
"group": "Wait",
"pages": [
"wait",
"wait-for",
"wait-until",
"wait-for-token"
]
"pages": ["wait", "wait-for", "wait-until", "wait-for-token"]
},
"queue-concurrency",
"versioning",
Expand Down Expand Up @@ -110,9 +97,7 @@
},
{
"group": "Development",
"pages": [
"cli-dev"
]
"pages": ["cli-dev"]
},
{
"group": "Deployment",
Expand All @@ -124,9 +109,7 @@
"deployment/atomic-deployment",
{
"group": "Deployment integrations",
"pages": [
"vercel-integration"
]
"pages": ["vercel-integration"]
}
]
},
Expand Down Expand Up @@ -179,14 +162,13 @@
}
]
},
{
"group": "MCP Server",
"pages": ["mcp-introduction", "mcp-tools", "mcp-agent-rules"]
},
{
"group": "Using the Dashboard",
"pages": [
"run-tests",
"troubleshooting-alerts",
"replaying",
"bulk-actions"
]
"pages": ["run-tests", "troubleshooting-alerts", "replaying", "bulk-actions"]
},
{
"group": "Troubleshooting",
Expand All @@ -208,39 +190,23 @@
"self-hosting/kubernetes",
{
"group": "Environment variables",
"pages": [
"self-hosting/env/webapp",
"self-hosting/env/supervisor"
]
"pages": ["self-hosting/env/webapp", "self-hosting/env/supervisor"]
}
],
"tags": [
"v4"
],
"tags": ["v4"],
"tag": "v4"
},
{
"group": "Self-hosting",
"pages": [
"open-source-self-hosting"
]
"pages": ["open-source-self-hosting"]
},
{
"group": "Open source",
"pages": [
"open-source-contributing",
"github-repo",
"changelog",
"roadmap"
]
"pages": ["open-source-contributing", "github-repo", "changelog", "roadmap"]
},
{
"group": "Help",
"pages": [
"community",
"help-slack",
"help-email"
]
"pages": ["community", "help-slack", "help-email"]
}
]
},
Expand All @@ -261,10 +227,7 @@
},
{
"group": "Tasks API",
"pages": [
"management/tasks/trigger",
"management/tasks/batch-trigger"
]
"pages": ["management/tasks/trigger", "management/tasks/batch-trigger"]
},
{
"group": "Runs API",
Expand Down Expand Up @@ -310,9 +273,7 @@
"groups": [
{
"group": "Introduction",
"pages": [
"guides/introduction"
]
"pages": ["guides/introduction"]
},
{
"group": "Frameworks",
Expand Down Expand Up @@ -342,7 +303,6 @@
"guides/ai-agents/verify-news-article"
]
},
"guides/cursor-rules",
"guides/frameworks/drizzle",
"guides/frameworks/prisma",
"guides/frameworks/sequin",
Expand Down Expand Up @@ -429,9 +389,7 @@
},
{
"group": "Migration guides",
"pages": [
"migration-mergent"
]
"pages": ["migration-mergent"]
},
{
"group": "Community packages",
Expand All @@ -452,10 +410,7 @@
"href": "https://trigger.dev"
},
"api": {
"openapi": [
"openapi.yml",
"v3-openapi.yaml"
],
"openapi": ["openapi.yml", "v3-openapi.yaml"],
"playground": {
"display": "simple"
}
Expand Down Expand Up @@ -668,6 +623,10 @@
{
"source": "/management/projects/runs",
"destination": "/management/overview"
},
{
"source": "/guides/cursor-rules",
"destination": "/mcp-agent-rules"
}
]
}
}
116 changes: 116 additions & 0 deletions docs/mcp-agent-rules.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
title: "Agent rules"
sidebarTitle: "Agent rules"
description: "Learn how to use the Trigger.dev agent rules with the MCP server"
tag: "new"
---

## What are Trigger.dev agent rules?

Trigger.dev agent rules are comprehensive instruction sets that guide AI assistants to write optimal Trigger.dev code. These rules ensure your AI assistant understands best practices, current APIs, and recommended patterns when working with Trigger.dev projects.

## Installation

Install the agent rules with the following command:

```bash
npx trigger.dev@latest install-rules
```

## Available rule sets

We provide five specialized rule sets, each optimized for different aspects of Trigger.dev development:

| Rule set | Tokens | Description | GitHub |
|:---------|:-------|:------------|:------------|
| **Basic tasks** | 1,200 | Essential rules for writing basic Trigger.dev tasks and fundamental patterns | [View](https://github.com/triggerdotdev/trigger.dev/blob/main/rules/4.0.0/basic-tasks.md) |
| **Advanced tasks** | 3,000 | Comprehensive rules for complex workflows, error handling, and advanced task patterns | [View](https://github.com/triggerdotdev/trigger.dev/blob/main/rules/4.0.0/advanced-tasks.md) |
| **Scheduled tasks** | 780 | Specialized guidance for cron jobs, scheduled workflows, and time-based triggers | [View](https://github.com/triggerdotdev/trigger.dev/blob/main/rules/4.0.0/scheduled-tasks.md) |
| **Configuration** | 1,900 | Complete guide for trigger.config.ts setup, environment configuration, and project structure | [View](https://github.com/triggerdotdev/trigger.dev/blob/main/rules/4.0.0/config.md) |
| **Realtime** | 1,700 | Using Trigger.dev Realtime features and frontend integration patterns | [View](https://github.com/triggerdotdev/trigger.dev/blob/main/rules/4.0.0/realtime.md) |

## Claude Code subagent

For Claude Code users, we provide a subagent called `trigger-dev-expert` that's an expert at writing well-structured Trigger.dev code.

### Installation

The subagent is available as an option when running the rules installation command. Select "Claude Code" as your client and choose to include the subagent when prompted.

### Usage

Activate the subagent in your prompts by requesting it explicitly:

```markdown
use the trigger-dev-expert subagent to create a trigger.dev job that accepts a video url, processes it with ffmpeg to extract the audio, runs the audio through a text-to-speech API like openai, and then uploads both the transcription and the audio to s3
```

The subagent works best when combined with the appropriate rule sets installed alongside it, providing both high-level architectural guidance and detailed implementation knowledge.

## Supported AI clients

The Trigger.dev rules work across a wide range of AI coding assistants and editors:

| Client | Rule activation | Docs |
|:--------|:----------------|:--------------|
| **Cursor** | Automatic when working in trigger directories | [Link](https://docs.cursor.com/en/context/rules#rules/) |
| **Claude Code** | Context-aware activation + custom subagent | [Link](https://docs.anthropic.com/en/docs/claude-code) |
| **VSCode Copilot** | Integration with GitHub Copilot chat | [Link](https://code.visualstudio.com/docs/copilot/overview) |
| **Windsurf** | Automatic activation in Trigger.dev projects | [Link](https://docs.windsurf.com/windsurf/cascade/memories#rules) |
| **Gemini CLI** | Command-line integration | [Link](https://ai.google.dev/gemini-api/docs) |
| **Cline** | Automatic context detection | [Link](https://github.com/cline/cline) |
| **Sourcegraph AMP** | Code intelligence integration | [Link](https://sourcegraph.com/docs) |
| **Kilo** | Custom rule integration | [Link](https://kilocode.ai/docs/advanced-usage/custom-rules) |
| **Ruler** | Rule management | [Link](https://github.com/intellectronica/ruler) |
| **AGENTS.md** | Universal format for OpenAI Codex, Jules, OpenCode, etc. | |

### Rule activation behavior

Different AI tools handle rules differently:

- **Automatic Activation**: Cursor, Windsurf, VSCode Copilot, and Cline automatically apply relevant rules when working in Trigger.dev projects or when `trigger.config.ts` is detected
- **Context-Aware**: Claude Code intelligently applies rules based on the current context and file types
- **Manual Integration**: AGENTS.md clients and others append rules to configuration files for manual activation

## Keeping rules updated

Trigger.dev rules are regularly updated to reflect new features, API changes, and best practices. The CLI includes automatic update detection.

### Automatic update notifications

When running `npx trigger.dev@latest dev`, you'll receive notifications when newer rule versions are available with a simple update command.

### Manual updates

Update rules anytime with:

```bash
npx trigger.dev@latest install-rules
```

The update process replaces existing rules without creating duplicates, keeping your configuration files clean and organized.

### Why updates matter

- **Current API patterns**: Access the latest Trigger.dev APIs and features
- **Performance optimizations**: Benefit from improved patterns and practices
- **Deprecated pattern avoidance**: Prevent AI assistants from generating outdated code
- **New feature support**: Immediate access to newly released capabilities

## Getting started

1. Install the rules:

```bash
npx trigger.dev@latest install-rules
```

2. Follow the prompts to install the rules for your AI client.

3. Consider installing the `trigger-dev-expert` subagent if using Claude Code.

## Next steps

- [Install the MCP server](/mcp-introduction) for complete Trigger.dev integration
- [Explore MCP tools](/mcp-tools) for project management and task execution

Loading