Integrating AI agents directly into your development workflow is the next step in software automation. Anthropic's Claude Code is typically run interactively by developers at their desks β but with Claude Routines, launched in April 2026, you can package a Claude Code configuration once and have it run automatically to perform code reviews, analyze error logs, or audit documentation updates.
Instead of hand-building shell scripts, cron jobs, or CI/CD pipelines, a routine is a saved Claude Code setup β a prompt, one or more repositories, and a set of connectors β that runs on Claude Code's web infrastructure. That means your Mac does not need to be online for each task. This guide explains how to set up, secure, and budget these automated workflows.
By the end of this tutorial, you will be able to configure a Claude Routine to run automated tasks in the cloud while keeping your codebase secure.
How Claude Routines Work
A routine packages a prompt, the repositories it can touch, and the connectors it can use, then runs automatically on Claude Code's web infrastructure. You set one up from the web at claude.ai/code or via the CLI using the /schedule command.
Claude Routines support three trigger types, which can be combined on a single routine:
Trigger Type | Setup Method | Best For |
|---|---|---|
Scheduled | Recurring cadence (hourly, daily, weekday, or weekly) via | Daily repository cleanup, checking for dependency updates, weekly documentation reviews. |
API | Dedicated HTTP endpoint with a bearer token; POST to start a session | Triggering runs from your own apps, monitoring tools, or deployment platforms. |
GitHub | Runs on repository events (pull requests, releases) with filters for author, branch, labels, and draft status | Automated code review, security audits, PR labeling and triaging. |
Real-World Automation Examples
Here are the three most common workflows developers set up with Claude Routines:
1. Automated Pull Request Review
Using a GitHub trigger, a routine runs whenever a developer opens a pull request. Claude scans the diff and leaves inline comments highlighting security issues, styling consistency, or performance regressions before the human review begins. Filters let you target only certain authors, branches, or labels.
2. Weekly Documentation Drift Review
On a scheduled (weekly) trigger, the routine scans the git commit history and compares it with your project's markdown documentation. If it detects that API signatures or folder structures have changed without corresponding updates in the docs, it flags the drift and drafts the updated documentation automatically.
3. Automated Alert Triage
Using an API trigger, a monitoring system (such as Sentry or PagerDuty) POSTs to the routine's endpoint when an alert fires. Claude retrieves the error stack trace, queries your repository to find the file that caused the error, analyzes recent git commits, and outputs a diagnosis with a proposed fix.
Setting Up a Claude Routine
You can create a routine from the web interface at claude.ai/code or directly from the terminal. In Claude Code, run the /schedule command and follow the prompts to package your configuration:
# In Claude Code, create and schedule a routine
/schedule
# A routine bundles:
# - a prompt (what Claude should do)
# - one or more repositories
# - connectors it is allowed to use
# - one or more triggers (scheduled, API, or GitHub)Routines are available to Claude Code users on Pro, Max, Team, and Enterprise plans, provided Claude Code is enabled on the web. Daily caps apply: Pro users can run up to 5 routines per day, Max up to 15, and Team and Enterprise up to 25.
Built-In Security Defaults
Running Claude autonomously requires strict guardrails, and Claude Routines ship with sensible defaults:
Restricted Push Branches: By default, Claude can only push to branches prefixed with
claude/. This prevents routines from accidentally modifying protected or long-lived branches, so no AI code merges into production without a human pull request review.Scoped Connectors & Repositories: A routine can only access the repositories and connectors you explicitly attach to it, limiting its blast radius.
Daily Run Caps: Plan-based daily limits (5 to 25 routines per day) act as a natural budget guardrail against runaway automation.
How This Connects to Your Website
When you automate AI workflows to run tasks like documentation auditing or market research, these agents will browse websites and documentation pages to pull information.
For these automated crawlers to read your site efficiently without wasting API credits on scraping menus, footer links, and scripts, you need to serve them a clean, machine-readable format. This is the exact purpose of the llms.txt standard.
By publishing a curated llms.txt file at your domain root, you allow automated developers and crawlers to index your documentation, API guides, and specifications in seconds. This ensures your site is referenced correctly when developers query AI systems.
Generate your free llms.txt file in 60 seconds and optimize your website for the AI automation era.
Conclusion
Claude Routines turn your AI assistant into an active, trigger-driven teammate β without the overhead of hand-building cron jobs or CI pipelines. While automation requires careful security planning and token budgeting, the productivity gains of automated reviews, documentation checks, and log analysis are massive. Start with read-only review routines and expand to write-based automated pull requests as you build confidence in the guardrails.
As AI agents become a larger part of the software ecosystem, making your own documentation and website AI-readable is essential. Generate your free llms.txt file today to keep your site visible to automated agents.
Frequently Asked Questions
Can Claude run automated tasks without me being online?
Yes. Claude Routines run on Claude Code's web infrastructure, so your machine does not need to be online for each task. You configure a routine once with a prompt, repositories, and triggers, and it runs automatically on schedule, via an API call, or in response to GitHub events.
What does it cost to run Claude Routines?
Routines are available on the Pro, Max, Team, and Enterprise plans (with daily caps of 5, 15, and 25 runs respectively). Token usage depends on the size of your repository, conversation history, and reasoning depth of the model β using Claude Opus 4.7, standard API rates are $5/M input and $25/M output. Choose an appropriate effort level to control reasoning costs during automated runs.
Is it safe to run Claude on a schedule?
It is safe if you rely on the built-in guardrails. By default a routine can only push to branches prefixed with claude/ rather than merging directly into your main branch, and it can only touch the repositories and connectors you explicitly attach to it.
Do automated agents read llms.txt?
Yes. Automated developer agents and web crawlers check for an `llms.txt` file at the domain root to quickly retrieve structured Markdown maps of a site's content, bypassing the need to scrape complex HTML layouts.
