# Recipes

> Triggers to set up by asking your agent: copy a prompt, paste it into Claude Code or any agent connected to Coordinate.

Each recipe is a prompt for an agent connected to Coordinate ([connect one](/agents)). Paste it into Claude Code, Cursor, or any MCP client; the agent creates the trigger with the `trigger` tool, and you can see and pause it on **Triggers**. Change where it sends to fit how you want to hear about it: a webhook, Slack, Discord, email, or Poke (see [actions](/docs/actions)).

## PR ready to merge

```text
Create a Coordinate trigger named pr_ready_to_merge: when github.pr.readiness arrives with payload.ready true and payload.author equal to <my GitHub username>, post "PR #{{event.payload.number}} in {{event.payload.repo}} is ready to merge: {{event.payload.url}}" to Slack using the secret SLACK_WEBHOOK.
```

```json
{"name": "pr_ready_to_merge",
 "when": {"event": {"source": "github", "type": "github.pr.readiness", "where": {"payload.ready": {"eq": true}, "payload.author": {"eq": "<username>"}}}},
 "then": {"slack": {"webhook_url": "secret:SLACK_WEBHOOK", "message": "PR #{{event.payload.number}} in {{event.payload.repo}} is ready to merge: {{event.payload.url}}"}}}
```

## Build or deploy failed

```text
Create a Coordinate trigger named ci_or_deploy_failed: when a GitHub Actions run completes with conclusion failure, or a Vercel deployment errors, or a Cloudflare Pages build fails, send a webhook to <my URL>.
```

```json
{"name": "ci_or_deploy_failed",
 "when": {"event": {"type": ["github.workflow_run.completed", "vercel.deployment.error", "cloudflare.pages.deployment"],
   "where": {"any": [{"payload.conclusion": {"eq": "failure"}}, {"type": {"eq": "vercel.deployment.error"}}, {"payload.status": {"eq": "failure"}}]}}},
 "then": {"webhook": {"url": "https://example.com/hooks/coordinate"}}}
```

## New stars on a repository

```text
Create a Coordinate poller named github_stars that checks <owner>/<repo> on GitHub every 15 minutes and records the star count when it changes, then a trigger named new_stars that posts "{{event.payload.repo}} now has {{event.payload.stars}} stars" to Slack using the secret SLACK_WEBHOOK.
```

```json
{"kind": "poll", "name": "github_stars", "poll": {
   "request": {"method": "GET", "url": "https://api.github.com/repos/<owner>/<repo>", "auth": {"connection": "github"}},
   "select": {"fields": {"repo": "full_name", "stars": "stargazers_count"}},
   "emit": {"type": "github.stars.changed", "key": "{{item.repo}}", "when": "changed", "compare": ["stars"]},
   "interval": "PT15M"}}
```

```json
{"name": "new_stars",
 "when": {"event": {"source": "github_stars", "type": "github.stars.changed"}},
 "then": {"slack": {"webhook_url": "secret:SLACK_WEBHOOK", "message": "{{event.payload.repo}} now has {{event.payload.stars}} stars"}}}
```

`{"connection": "github"}` works for any public repository, and for private ones the GitHub App is installed on. Only a private repository the app can't reach needs `{"bearer": "secret:GITHUB_TOKEN"}` with a personal access token.

## Email from someone important

```text
Create a Coordinate trigger named email_from_ana: when gmail.message.received arrives from ana@fund.vc, text me through Poke with the subject and snippet.
```

```json
{"name": "email_from_ana",
 "when": {"event": {"source": "gmail", "type": "gmail.message.received", "where": {"payload.from_address": {"eq": "ana@fund.vc"}}}},
 "then": {"poke": {"message": "Email from {{event.payload.from}}: {{event.payload.subject}} ({{event.payload.snippet}})", "api_key": "secret:POKE"}}}
```

## Sign-in alerts

```text
Create a Coordinate trigger named login_alerts: whenever someone requests, approves, denies, or completes a sign-in to this workspace, email me the summary.
```

```json
{"name": "login_alerts",
 "when": {"event": {"source": "coordinate", "type": ["login.requested", "login.approved", "login.denied", "login.signed_in"]}},
 "then": {"email": {"subject": "Coordinate sign-in", "message": "{{event.payload.summary}}"}}}
```

## Claude Code spend

```text
Create a Coordinate query trigger named claude_code_daily_spend: once a day, when today's Claude Code spend (claude_code.usage cost_microusd) passes $20, post the total to Discord using the secret DISCORD_WEBHOOK.
```

```json
{"name": "claude_code_daily_spend",
 "when": {"query": {"sql": "SELECT ROUND(SUM(json_extract(payload, '$.cost_microusd')) / 1000000.0, 2) AS dollars, local_date AS day FROM events WHERE type = 'claude_code.usage' AND local_date = (SELECT MAX(local_date) FROM events WHERE type = 'claude_code.usage') GROUP BY local_date",
   "test": {"dollars": {"gte": 20}}, "key": "day"}},
 "then": {"discord": {"webhook_url": "secret:DISCORD_WEBHOOK", "message": "Claude Code spend passed $20 today: ${{row.dollars}} on {{row.day}}."}}}
```

## Hand a finished task to an agent

```text
Create a Coordinate trigger named launch_post: when a Todoist task in the Launch project is completed, start my Claude agent <agent id> in environment <environment id> with the task as context, using the Anthropic key in the secret ANTHROPIC.
```

Stored keys are secrets: add them on **Settings → Secrets** or with `coordinate secret set NAME`. An agent can't read a secret's value, only use it by name.
