15-Minute Setup for Claude Code Routine: Automated Workflow for Beginners

Claude Code Routines is one of the most underrated AI development features in 2026. In just 15 minutes, you can set up an automated code maintenance process that runs daily, from automated testing and issue categorization to PR review. This article guides you from scratch to create your first Routine.
(Background: xAI is pushing Grok Build to v0.2.11! Poaching Cursor’s core features, aiming to catch up with Claude Code)
(Additional context: Hands-on: Teach you how to upgrade Vibe Coding to an expert-level development process using 7 Agents)

Table of Contents

Toggle

  • What is Claude Code Routines?
  • Step 1: Install and verify environment
  • Step 2: Create Routine configuration file
  • Step 3: Register and activate
  • Practical Case 1: Automated Issue Categorization
  • Practical Case 2: Daily Code Health Check
  • Practical Case 3: Automated File Updates
  • Security Best Practices
  • Routines vs Dynamic Workflow
  • Conclusion

In the AI developer ecosystem of 2026, Claude Code has become a standard tool for many teams. However, most only utilize about 20% of its capabilities—instant Q&A and single-task execution. The key to evolving Claude Code from a “dialogue tool” to a “24/7 autonomous development partner” is the Routines feature.

Routines allow you to set scheduled programming tasks. Imagine: every morning at 9 AM, Claude Code automatically checks GitHub Issues, categorizes priorities, runs tests, and even initiates fix PRs. By the time you wake up, your code has already been maintained.

Sounds complicated? Actually, it only takes 15 minutes.

What is Claude Code Routines?

Routines are essentially “scheduled Claude Code tasks.” They launch a separate Claude session that repeatedly executes specific tasks according to your schedule (hourly, daily, or triggered by GitHub webhooks). Unlike regular Claude Code conversations, Routines operate autonomously in the background, without manual intervention.

Each Routine includes three elements: Schedule Trigger (when to run), Task Commands (what to do), Permission Restrictions (what tools can be used). These three define the behavior boundaries of a Routine.

Step 1: Install and verify environment

First, ensure your Claude Code CLI version is above v2.0:

claude, version

If not up-to-date, update using the official installation command: npm install -g @anthropic-ai/claude-code

The Routines feature is supported from v2.0 onward, and became more stable after the Opus 4.8 update in May 2026.

Step 2: Create Routine configuration file

Create a folder named .claude/routines/ in your project root directory, then create your first config file daily-tests.yml:

The YAML syntax for Routines is very intuitive. Key fields include: name (task name), schedule (cron expression), start_command (task command), allowed_tools (list of permitted tools), max_turns (maximum dialogue turns to prevent infinite loops).

For example, “Daily Test Execution” with schedule set to Monday through Friday at 9 AM, command “Check all tests for failures, attempt repairs, and rerun,” with permission restrictions for file editing, terminal operations, and search.

Step 3: Register and activate

After writing the config, register the Routine with a single command:

claude routines add -f .claude/routines/daily-tests.yml

Then start the background service:

claude routines start

You can view all registered Routines and their statuses with claude routines list, and check execution logs with claude routines logs --name daily-tests.

Practical Case 1: Automated Issue Categorization

A very practical Routine example is automatic GitHub Issue classification. Set it to scan new issues every 30 minutes, categorize and reply with initial info based on title and labels, and assign critical bugs directly to relevant developers.

The key here is setting trigger.type: polling (periodic polling of GitHub API), and restricting allowed_tools to only read and search (no direct code modification), ensuring safety.

Practical Case 2: Daily Code Health Check

Another common scenario is running daily at dawn to perform code health checks. The Routine sequentially runs linting, type checks, unit tests, and if errors are found, automatically creates a branch to fix issues and opens a PR.

This case is more complex; it’s recommended to set a higher max_turns (50-100), and use git sandbox strategies, allowing the Routine to operate on isolated branches, with manual review before merging into main.

Practical Case 3: Automated File Updates

For file maintenance needs, set up daily scans of new classes and functions, automatically update README and API docs. This is the safest Routine case, as file modifications carry less risk than code changes.

Security Best Practices

When using Routines, follow some strict security principles: First, always restrict allowed_tools—don’t grant push permissions to remote branches unless necessary. Second, set max_turns limits to prevent infinite loops consuming tokens. Third, use git isolation strategies: operate on separate branches, with manual review before merging. Fourth, start with simple tasks (like Issue categorization), verify behavior, then upgrade to more complex tasks (like auto-fixes).

Routines vs Dynamic Workflow

Routines are often confused with Dynamic Workflow, but they are complementary. Dynamic Workflow involves manual, real-time guided collaboration—during a conversation, you guide CI step-by-step through complex tasks. Routines are background automation that runs without human presence. In practice, it’s best to first test tasks with manual Dynamic Workflow, then encapsulate verified behaviors into Routine configs for periodic execution.

Conclusion

Building a Claude Code Routine in 15 minutes is not an exaggeration. From creating folders to writing YAML and starting the service, the entire process can be completed within 15 minutes. Once set up, it can save you hours of repetitive development work every day.

In the 2026 development environment, the greatest value of AI coding tools is no longer just “coding faster,” but “machines maintaining machines.” Routines are the starting point of this vision. Why not try today? Your first Routine could start with “Run tests every morning.”

This article is compiled by the Dongqu Editorial Team, referencing official Anthropic documents (docs.anthropic.com), Anthropic’s official blog, and Hacker News discussions.

View Original
This page may contain third-party content, which is provided for information purposes only (not representations/warranties) and should not be considered as an endorsement of its views by Gate, nor as financial or professional advice. See Disclaimer for details.
  • Reward
  • Comment
  • Repost
  • Share
Comment
Add a comment
Add a comment
No comments
  • Pinned