DEV Community

정상록
정상록

Posted on

Claude Code Routines: Your AI Coding Assistant That Works While You Sleep

TL;DR

Anthropic released Routines for Claude Code (Research Preview, April 14, 2026). Configure once, runs on Anthropic's cloud. Three triggers: scheduled, API webhook, GitHub events. Your laptop can be closed.

What Problem Does This Solve?

Before Routines, Claude Code required either:

  • An open terminal session (CLI)
  • Desktop app running (Scheduled Tasks)
  • Active session (/loop)

All of these need your local machine to be on. Routines moves execution to Anthropic's cloud infrastructure.

The Three Trigger Types

1. Scheduled

Cron-style execution without managing cron. Set frequency (hourly/daily/weekly), Anthropic handles the infra.

# Example: Nightly issue triage
name: nightly-issue-triage
trigger: scheduled
frequency: daily at 03:00 UTC
prompt: |
  Scan open issues. Add labels. Assign owners.
  Send summary to #dev-updates Slack channel.
Enter fullscreen mode Exit fullscreen mode

2. API Trigger

Each routine gets a unique HTTPS endpoint. POST to it, Claude Code session starts.

curl -X POST \
  https://api.anthropic.com/v1/claude_code/routines/{trigger_id}/fire \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-beta: experimental-cc-routine-2026-04-01" \
  -H "Content-Type: application/json" \
  -d '{"context": {"alert_type": "high_cpu"}}'
Enter fullscreen mode Exit fullscreen mode

Hook this to PagerDuty, your CD pipeline, or Slack commands.

3. GitHub Trigger

Reacts to GitHub events. Currently supports:

  • Pull Request: opened, merged, etc.
  • Release: created

Rich filtering:

  • Author, Title, Body (equals, contains, regex)
  • Base/Head branch, Labels, Draft status, Fork origin
# Example: Auto code review on PR
name: auto-code-review
trigger: github_pr_opened
filters:
  is_draft: false
  base_branch: main
prompt: |
  Review this PR for security, performance,
  and coding conventions. Post inline comments.
Enter fullscreen mode Exit fullscreen mode

Real-World Use Cases

Use Case Trigger What Claude Does
Backlog triage Scheduled (nightly) Label, assign, prioritize issues
Alert triage API (monitoring webhook) Analyze stack trace, create fix PR
Code review GitHub (PR opened) Apply team checklist, inline comments
Post-deploy smoke API (CD pipeline) Health check, rollback PR if needed
Docs sync Scheduled (weekly) Scan merged PRs, update changed docs
SDK porting GitHub (PR merged) Port changes to other language SDK

Routines vs Existing Tools

Routines Desktop Tasks /loop
Execution Anthropic cloud Local machine Current session
Machine needed No App open Session active
Triggers 3 types Schedule only Session-only
MCP connectors Yes (Slack, Linear) Local only Local only
Branch policy claude/ prefix default Free Free

Getting Started

Three ways to create a routine:

  1. Web: claude.ai/code/routines → "New routine"
  2. CLI: /schedule in Claude Code terminal
  3. Desktop: Schedule page → New remote task

Requirements: Pro, Max, Team, or Enterprise plan. Claude Code on the web enabled.

Tips

  • Be specific in prompts — Routines run unattended. Use checklists, not vague instructions.
  • Keep claude/ branch prefix — Easy to filter AI-generated changes in PRs.
  • Start small — Issue labeling first, then code review, then alert triage.
  • Watch daily caps — Routines have daily execution limits. Don't set 1-minute intervals.

Wrapping Up

Routines shift Claude Code from "interactive tool" to "autonomous infrastructure." It's in Research Preview, so expect changes. But the direction is clear: delegate repetitive DevOps to AI, focus on creative problem-solving.

Official Blog Post | Docs

Top comments (0)