June 3, 2026
How to Build Proactive Agent Workflows with Claude Code Routines
By Synthex
Claude Code is usually reactive.
You open it, describe the task, wait for it to inspect the project, and then steer the work from there. That is already useful, but some engineering work does not start with a person typing a prompt. It starts when a deployment finishes, a GitHub issue appears, a release is cut, or a weekly maintenance window arrives.
This guide is based on Anthropic's Claude Code workshop on building proactive agent workflows with Routines. The useful idea is not "let AI run wild." The useful idea is quieter: define the task, define the trigger, give Claude the right context, and keep a review path around the work.
What you'll learn
- What Claude Code Routines are in plain language.
- How routines differ from a normal Claude Code session.
- The three setup decisions that matter: trigger, context, and steering.
- How to think about scheduled, API, and GitHub event triggers.
- Why connectors and repository access should be chosen carefully.
- How to use routines for docs, deploy checks, on-call investigation, and backlog triage.
- Where to keep a human in the loop.
What this is really about
A routine is a saved Claude Code automation.
Instead of manually starting a session every time, you configure the work once: the prompt, the repositories, the connectors, and the condition that should start the run. Then Claude Code can run that work automatically from Anthropic-managed cloud infrastructure.
The practical mental model is:
A routine is a repeatable Claude Code session that starts from a trigger instead of a fresh human prompt.
That does not mean every task should become autonomous. It means some recurring or event-driven tasks can start earlier, gather context, propose changes, and leave you something concrete to review.
For a beginner, this is the safest way to understand it:
- A normal Claude Code session starts when you ask for help.
- A routine starts when a condition you configured becomes true.
- A good routine still leaves a review trail: session history, branch, pull request, notification, or summary.
You can create and manage routines from Claude Code on the web at claude.ai/code/routines, or from the CLI with /schedule. Current Claude Code documentation says routines are available on Pro, Max, Team, and Enterprise plans when Claude Code on the web is enabled.
Before you start: routines are not just cron
It is tempting to describe routines as "cron for Claude Code."
That is close, but incomplete.
Traditional cron can run a command on a schedule. A routine can run an agentic coding session with repository access, connectors, event context, and a conversation you can inspect later.
That difference matters because Claude is not only executing a fixed script. It can investigate, compare files, open a pull request, ask for direction, or stop when the evidence does not support a change.
Use routines when the task needs judgment.
Use a normal scheduled script when the task is deterministic and already solved.
| Use case | Better fit |
|---|---|
| Run a known backup command every night | Scheduled script |
| Check recent code changes against documentation and propose updates | Claude Code Routine |
| Ping an endpoint every five minutes | Monitoring tool or script |
| Investigate a deploy using logs, code, and monitoring context | Claude Code Routine |
| Format one file the same way every time | Script or formatter |
| Triage new GitHub issues and decide which ones need code or docs work | Claude Code Routine |
The three decisions every routine needs
A routine becomes easier to design when you answer three questions before touching the settings.
- What should trigger it?
- What context does Claude need?
- How will you steer or verify the result?
If one of those is vague, the routine will usually feel unreliable.
1. Choose the trigger
The trigger is the condition that starts the work.
Claude Code Routines can use different trigger styles, including:
- Schedule triggers for hourly, daily, weekday, weekly, or one-off runs.
- API triggers that start a routine from an HTTP POST request.
- GitHub triggers that react to repository events.
Start with the trigger that best matches the work.
If the work naturally happens on a cadence, use a schedule. Weekly documentation review is a good example.
If the work starts after another system finishes, use an API trigger. A deployment pipeline can call the routine after release.
If the work depends on repository activity, use a GitHub trigger. A new issue, pull request, release, or label can start the run.
A useful routine should start because something meaningful happened, not because automation feels exciting.
That small standard prevents a lot of noise.
2. Give Claude the right context
Context is the information Claude needs to do the job.
For coding routines, that usually means one or more repositories. For product or operations routines, it may also mean access to issue trackers, Slack, Google Drive, monitoring systems, or other connected tools.
The context should match the task.
For example, a documentation update routine might need:
- The source-code repository.
- The documentation repository.
- Recent merged pull requests.
- Changelog files.
- Existing docs style and structure.
- A place to open a pull request.
- A place to notify the owner when work is ready.
A deploy verifier might need:
- The service repository.
- Deployment metadata from CI/CD.
- Logs or dashboards from a monitoring tool.
- Error tracking.
- A safe notification channel.
- Clear instructions on whether Claude should only report, open a PR, or suggest rollback steps.
The mistake is giving Claude either too little context or too much.
Too little context makes it guess. Too much context increases noise and permissions. A good first routine should use the smallest set of repositories and connectors that can reasonably support the task.
3. Decide how steering works
Steering is how you keep the routine pointed at the right outcome.
This can be light or strict depending on the risk.
For low-risk tasks, Claude might create a draft PR and notify you. For higher-risk tasks, it should investigate and report, but wait for a human before taking action.
Useful steering patterns include:
- Ask Claude to summarize evidence before changing files.
- Require a pull request instead of direct pushes to important branches.
- Keep the default branch-push restriction unless you have a specific reason to remove it; current docs say routine-created branches are restricted to the
claude/prefix by default. - Ask for a short final report with what changed, what was not changed, and what needs review.
- Use a second routine or reviewer to comment on the first routine's PR.
- Watch the live session when the work is unfamiliar.
- Resume the session and redirect it when the assumptions are wrong.
The goal is not to remove human judgment. The goal is to move the repetitive investigation and first-draft work earlier.
Example: weekly documentation sync
A good first routine is a documentation sync.
Documentation often falls behind because the work is important but easy to postpone. New features land, APIs change, command names move, and the docs owner has to reconstruct what happened later.
A routine can check for that on a schedule.
The rough prompt might be:
The setup decisions are straightforward:
| Decision | Example choice |
|---|---|
| Trigger | Weekly schedule, such as Monday morning |
| Repositories | Product source repo and documentation repo |
| Connectors | GitHub, optionally Slack or another notification tool |
| Output | Pull request with a summary |
| Review | Human reviews the PR before merge |
This is a strong routine because the output is reviewable. Claude is not silently rewriting production systems. It is opening a proposed change.
Example: GitHub issue to docs PR
Another useful pattern is event-driven documentation.
Imagine someone opens a GitHub issue that says a command, tool, or feature is missing from the docs. A routine can start when that issue is created, read the issue body, inspect the documentation repo, compare against source code, and decide whether a docs PR is warranted.
The prompt should include the decision boundary:
That last sentence matters. A routine should know when not to act.
For beginners, this is one of the most important habits: do not only describe the happy path. Describe the stopping rule.
Example: deploy verifier
A deploy verifier is a slightly higher-risk routine.
The purpose is to check whether a recent deployment looks healthy. It might inspect monitoring dashboards, error rates, logs, CI/CD output, and recent code changes.
The first version should probably not roll anything back automatically.
A safer first version is:
That gives you value without pretending the routine is ready to own production decisions.
Later, if the routine proves reliable and your systems have proper safeguards, you can decide whether it should take more action. Start with evidence. Add authority slowly.
Example: on-call investigation
On-call work is full of repeated investigation:
- What changed recently?
- Which service is affected?
- Are errors rising?
- Is this tied to a deploy?
- Is there a known incident pattern?
- Who should be notified?
A routine can gather that context and prepare a first incident summary.
The useful output is not a dramatic answer. It is a compact handoff:
- What seems broken.
- What evidence supports it.
- What changed recently.
- Which logs or dashboards matter.
- What Claude tried.
- What remains uncertain.
- What a human should check next.
That kind of summary can save time without hiding uncertainty.
Example: backlog triage
Routines are not only for engineers.
A product manager or founder could use a weekly routine to scan GitHub issues, Linear tickets, Slack feedback, support notes, or customer requests. The routine can group themes, identify repeated pain points, and suggest a small set of issues worth prioritizing.
For this type of work, the prompt should ask Claude to preserve nuance:
The review path still matters. Claude can organize the pile. People still decide what the product should become.
Routines vs local scheduled tasks
Claude Code also has local scheduled-task features such as /loop and cron-style task tools inside a session.
Those are useful, but they are not the same as cloud routines.
| Feature | Local scheduled tasks | Claude Code Routines |
|---|---|---|
| Where it runs | Inside the current Claude Code session | Anthropic-managed cloud infrastructure |
| How long it lasts | Session-scoped | Saved routine configuration |
| Common use | Polling, reminders, repeating prompts while a session is open | Recurring or event-driven coding workflows |
| Triggers | Time-based inside the session | Schedule, API, and GitHub events |
| Best for | Short-lived follow-up work | Repeatable workflows tied to repos and connectors |
If you only need Claude to check something later in the same session, a local scheduled task may be enough.
If you need a saved automation that can run when your laptop is closed, use a routine.
Common misunderstandings
"A proactive agent means no human review"
No. A proactive agent can start work before you ask. That does not mean it should merge, deploy, or roll back without review.
The safer pattern is: investigate, propose, notify, then let a human decide.
"The prompt is the whole setup"
The prompt matters, but it is only one part. The routine also needs the right repositories, connectors, environment, trigger, and permission boundaries.
"More connectors make the routine smarter"
Only when the connectors are relevant.
Unused connectors create extra surface area and extra noise. Give the routine what it needs for the job, then remove the rest.
"A routine should always create a PR"
Not always.
Sometimes the correct output is a summary, a comment, a recommendation, or no action. A good routine should have a clear stopping rule.
"Routines are fully stable infrastructure"
Claude's current documentation marks routines as research preview. Treat the feature as powerful, useful, and still subject to change. Before building a critical workflow around it, check the current docs and test the routine on a low-risk task.
What to do first
Start with one low-risk routine.
A good beginner routine has five traits:
- It runs on a clear schedule or event.
- It has access to only the repos and connectors it needs.
- It produces a reviewable output.
- It cannot damage production if it is wrong.
- It saves you from repeated investigation, not from thinking.
Try this order:
- Pick one recurring task you already understand.
- Write the routine prompt in plain language.
- Define the trigger: schedule, API, or GitHub event.
- Add the minimum repository and connector access.
- Ask for a summary before changes.
- Require a PR or report, not direct high-risk action.
- Run it manually once.
- Review the output and tighten the prompt.
- Only then let it run automatically.
The first routine should feel almost boring. That is a good sign.
A starter prompt you can adapt
Use this as a plain first draft, then edit it for your project:
This is not fancy. It is intentionally clear.
Final takeaway
Claude Code Routines are useful when work should start from an event, not from your memory.
Use them for recurring checks, documentation updates, issue triage, deploy investigation, and other workflows where Claude can gather context and prepare reviewable work.
Start with a small routine. Give it the right trigger, the right context, and a clear review path. Let it earn trust before you give it more authority.
Further reading
- Source video:
- Claude Code Routines docs: https://code.claude.com/docs/en/routines (opens in new tab)
- Claude Code scheduled tasks docs: https://code.claude.com/docs/en/scheduled-tasks (opens in new tab)
- Claude Code commands docs: https://code.claude.com/docs/en/commands (opens in new tab)
