CLAUDE LABJP
TEACHERS — Anthropic launches Claude for Teachers, giving verified US K-12 educators free premium access, teaching skills, and curriculum links aligned to standards in all 50 statesADMIN — The Admin API is now in beta for every Claude Enterprise organization: member and invite calls need no beta header, while group and custom-role calls doM365 — The Microsoft 365 connector gains write tools — draft, send, and organize email, manage calendar events and mailbox settings, and create or update files in OneDrive and SharePointMCP — Fixed servers from --mcp-config or .mcp.json ignoring a per-server request_timeout_ms, which left long-running tool calls timing out at the 60s default in fresh sessionsSUBAGENT — A new --forward-subagent-text flag and CLAUDE_CODE_FORWARD_SUBAGENT_TEXT variable include subagent text and thinking in stream-json outputDEADLINE — Opus 4.7 fast mode is removed on July 24, seven days out. speed: "fast" will error, so confirm your move to Opus 4.8TEACHERS — Anthropic launches Claude for Teachers, giving verified US K-12 educators free premium access, teaching skills, and curriculum links aligned to standards in all 50 statesADMIN — The Admin API is now in beta for every Claude Enterprise organization: member and invite calls need no beta header, while group and custom-role calls doM365 — The Microsoft 365 connector gains write tools — draft, send, and organize email, manage calendar events and mailbox settings, and create or update files in OneDrive and SharePointMCP — Fixed servers from --mcp-config or .mcp.json ignoring a per-server request_timeout_ms, which left long-running tool calls timing out at the 60s default in fresh sessionsSUBAGENT — A new --forward-subagent-text flag and CLAUDE_CODE_FORWARD_SUBAGENT_TEXT variable include subagent text and thinking in stream-json outputDEADLINE — Opus 4.7 fast mode is removed on July 24, seven days out. speed: "fast" will error, so confirm your move to Opus 4.8
Back to Blog

A Practical Guide to Automating Repetitive Tasks with Claude Code's /loop Command

Claude Codeautomationworkflow/loopscheduling

If you've been keeping up with Claude Code updates, you may have noticed the /loop command that quietly became one of the most talked-about additions in the March 2026 release. It lets you automate repetitive prompts within your session—without writing a single line of scheduling code.

In this post, I'll walk you through what /loop does, how to use it effectively, and where its boundaries are.


What Is the /loop Command?

/loop is a built-in Claude Code command that automatically re-runs a prompt at a specified interval for as long as your session stays open.

Instead of manually checking on something every few minutes—or writing a cron job—you hand the task to Claude and let it run in the background. Under the hood, Claude registers a cron job that fires at your chosen interval, executes the prompt, and reports back each time.


Basic Syntax

The syntax is refreshingly simple:

/loop [interval] [your prompt]

Interval Units

| Unit | Example | |------|---------| | Seconds (s) | 30s → every 30 seconds | | Minutes (m) | 5m → every 5 minutes | | Hours (h) | 1h → every hour | | Days (d) | 1d → once a day |

Example Commands

/loop 10m Run the tests and let me know if anything fails
/loop 1h Summarize today's commits so far

After you enter the command, Claude confirms the schedule and provides a job ID. You can use that ID to inspect or cancel the task later.


Real-World Use Cases

Here are some practical ways I've used /loop in my own workflow.

1. Monitoring Build Health During Development

/loop 3m Check for build errors and alert me immediately if anything breaks

This is probably the most natural fit for /loop. Rather than glancing at your terminal every few minutes, you can stay focused on writing code and only look up when Claude flags a problem. Particularly useful in TypeScript projects where type errors can creep in quietly.

2. Watching for API Response Changes

/loop 15m Send a request to the target endpoint and report any changes in the response

When you're working against an external API that's still in flux, having Claude poll it periodically saves you from writing a throwaway polling script. It's a lightweight way to catch unexpected changes before they cause bigger issues downstream.

3. Tracking Long-Running Processes

For tasks like large data migrations or batch processing jobs, this pattern is surprisingly handy:

/loop 30m Read the log file and give me a progress update

You can step away and work on something else, knowing Claude will surface the relevant details at regular intervals without you having to context-switch back constantly.


Important Limitations to Know

/loop is a session-scoped tool, and understanding that clearly will help you use it in the right situations.

Tasks Disappear When the Session Ends

All /loop tasks are tied to the current Claude Code session. Close the terminal, lose your connection, or restart the app—and every scheduled task is gone. There's no persistence between sessions.

For tasks you want to keep running beyond a single session, look at Desktop Scheduled Tasks or CI/CD tools like GitHub Actions.

Tasks Expire After 3 Days

Any task you register via /loop will automatically delete itself after 3 days, firing one final time before it's removed. This is a deliberate safeguard against forgotten loops running indefinitely.

Maximum 50 Tasks Per Session

A single session can hold up to 50 scheduled tasks. In practice, most workflows won't come close to this limit, but it's worth knowing if you're building something more complex.


/loop vs. Scheduled Tasks: When to Use Which

Both /loop and Desktop Scheduled Tasks handle recurring work, but they serve different needs.

| Scenario | Best tool | |----------|-----------| | Temporary checks during an active session | /loop | | Tasks that should survive a terminal restart | Scheduled Tasks | | Daily or weekly recurring automation | Scheduled Tasks | | Lightweight monitoring while you're working | /loop |

Think of /loop as a "while I'm working" automation, and Scheduled Tasks as a "keep running even when I'm not here" automation. Knowing which mode you need makes the choice obvious.


Wrapping Up

The /loop command fills a specific but genuinely useful niche: automating repetitive tasks for the duration of an active development session, with zero setup overhead.

The key to getting the most out of it is understanding its session-bound nature. Within that constraint, it's a remarkably effective way to offload routine monitoring and checking tasks to Claude, freeing your attention for deeper work.

Start simple—a short interval, a clear prompt—and build from there. Once you find a rhythm that suits your workflow, you might be surprised how often you reach for /loop during your day.