๐ก What are Routines? Routines are saved AI agent configurations (prompt + repos + connectors + trigger) that run on Anthropic's cloud โ no laptop, no terminal, no you required.
๐ What You Need Before Starting
| Requirement | Details |
| Claude Plan | Pro, Max, Team, or Enterprise |
| Claude Code | Must be enabled on web (claude.ai/code) |
| GitHub Repo | Clean, focused repo per routine |
| API Keys | Added as environment variables in Claude Cloud |
| MCP Connectors | Slack, Gmail, Linear, ClickUp, etc. |
โก 3 Ways to Trigger a Routine
๐ 1. Scheduled (Time-Based)
- Pick a cadence: hourly, daily, weekdays, weekly
- Minimum interval: 1 hour
- Times auto-convert to your local timezone
- For custom intervals (every 2 hrs, 1st of month) โ use CLI:
<p> ```bash</p>
<p>/schedule update --cron "0 <em>/2 </em> <em> </em>"</p>
<p> ```</p></div></details>
๐ 2. API Trigger (HTTP Endpoint)
- Every routine gets its own HTTP endpoint + bearer token
- POST to it to fire the routine
- Pass extra context in the
textfield of the body - Response returns a session ID + URL to watch Claude work live
<p> ```bash</p>
<p>curl -X POST https://your-routine-endpoint \</p>
<p> -H "Authorization: Bearer YOUR_TOKEN" \</p>
<p> -H "Content-Type: application/json" \</p>
<p> -d '{"text": "New lead from Acme Corp โ check CRM"}'</p>
<p> ```</p>
<p> <strong>Use case:</strong> Your monitoring tool catches an error โ hits the endpoint โ Claude investigates and fixes.</p></div></details>
๐ 3. GitHub Events
- Fires on: PR opened, code pushed, issue created
- Granular filters: specific authors, branches, PR labels
- Requires: Claude GitHub App installed on your repo (separate from web setup)
<p> > โ ๏ธ If the app isn't installed, the trigger setup will flag it for you.</p></div></details>
๐๏ธ How to Create a Routine (Step-by-Step)
Access points:
- Web:
claude.ai/code/routines - Desktop app
- CLI:
/schedulecommand
๐ Note: CLI can only create scheduled routines. For API or GitHub triggers, edit on the web after.
Step 1 โ Write the Prompt
Write it like you're handing off to someone who cannot reach you. No approvals, no questions.
Check for any new form submissions in the last 24 hours
using the API key available as the environment variable FORM_API_KEY.
For each lead:
1. Research their company using web search
2. Draft a personalized welcome email
3. Add them to HubSpot CRM
4. Post a summary to #new-leads in Slack
If any step fails, post what went wrong to #alerts in Slack.
Step 2 โ Add Environment Variables
โ ๏ธ Critical: Your .env file is NOT available. Routines clone your repo fresh each run โ no local files.
- Add all API keys to the Claude Cloud environment as env vars
- Tell Claude explicitly:
use the API key from the environment variable, do not look for a .env file
Step 3 โ Configure the Repo
- Attach a lean, focused repo (not your massive main project)
- Any changes Claude makes โ pushed to a new branch, never straight to main
Step 4 โ Set Network Access
| Setting | What it means |
| Default (Trusted) | Anthropic's vetted domains only |
| Full | Open internet access |
| Custom | Your specified allowlist |
Step 5 โ Add Connectors
All your MCP integrations are included by default. Remove anything the routine doesn't need.
Step 6 โ Test Before Scheduling
Hit Run Now first. Watch the run log โ green = worked. Click in for full session detail (every tool call, every decision).
๐ฏ Best Routines to Run for Your Business
| Routine | Trigger | What It Does |
| ๐ Speed to Lead | New form submission (API) | Research lead โ draft email โ add to CRM โ notify Slack |
| ๐ Client Reporting | Weekly schedule | Pull data โ generate report โ send to client |
| ๐งน Pipeline Cleanup | Daily schedule | Flag stale deals โ update statuses โ post summary |
| ๐ฅ Inbound Triage | Hourly schedule | Check new emails โ categorize โ draft responses โ Slack drafts |
| ๐ Document Processing | GitHub push | New file in repo โ extract data โ update database |
| ๐ Error Response | API (monitoring tool) | Alert fires โ Claude investigates โ auto-fix or escalates |
๐ฆ Plan Limits
| Plan | Runs/Day | Extra Usage? |
| Pro | 5 | โ (metered overage) |
| Max | 15 | โ |
| Team / Enterprise | 25 | โ |
Each run gets: 4 vCPUs ยท 16GB RAM ยท 30GB disk
โ ๏ธ Routine runs draw from the same token pool as your interactive sessions.
โ 5 Tips Before Going Live
1๏ธโฃ Always test with Run Now first
Don't schedule anything you haven't watched run successfully at least once.
2๏ธโฃ Add a failure fallback to your prompt
If any step fails, post a message to #alerts in Slack
with what went wrong and which step failed.
```</code></pre></div></details>
3๏ธโฃ Keep a lean repo per routine
Your main project's CLAUDE.md may be massive. Every token Claude spends reading irrelevant context = fewer tokens on the actual task.
4๏ธโฃ Use setup scripts for dependencies
Add a script in Claude Cloud environment that runs before Claude launches โ pre-installs Python libraries, CLI tools, etc. Saves time every single run.
5๏ธโฃ Migrate from n8n / Make / Zapier instantly
1. Open your workflow in n8n / Make / Zapier
- Export / copy the workflow JSON
- Paste into Claude Code
- Prompt: "Convert this into a Claude Code routine prompt"
```
No rewriting from scratch.</code></pre></div></details>
๐ Routines vs. Local Tasks vs. /loop
Tool
Best For
Min Interval
Routines
Stateless, cloud, no hardware needed
1 hour
Local Scheduled Tasks
Needs local files, cookies, browser sessions
Minutes
/loop
Recurring tasks inside a single terminal session
1 minute
โ ๏ธ What Routines Can't Do
- No persistent memory between runs (stateless)
- No local file access
- No browser sessions or cookies
- No stored state from previous runs
โ For any of these, keep it as a local scheduled task.