Claude Code background loops with /loop command

Claude Code's /loop command: schedule recurring Claude background tasks

Claude Code's /loop command lets you run prompts on a time-based schedule. Here's why this is an exciting feature for mundane dev tasks.

by on

Up until now, one of the biggest pain points that devs have had with Claude Code was that it couldn’t repeat tasks on a time-based schedule. It could “approximate” this, but it was very token-costly. Anthropic just shipped a /loop command, which lets a user define a task and specify how often to repeat it.

It’s similar to a cron job, in that it’s a background loop that runs persistently. Claude loops run for up to three days, important since tokens are expensive and this can quickly add up.

For example, here’s /loop being used to visualize changes roll out over a design sprint:

/loop every 3 hours take a screenshot of my staging site with the Playwright MCP server to capture new frontend changes from the design overhaul, and caption each screenshot

How /loop works

/loop is a Claude skill for scheduling tasks. You define your task in natural language with an interval (or without, to default to every 10 min), which CC will parse out of your prompt. Claude will then schedule it as a recurring cron job within your session.

You can use s, m, h, or d intervals, e.g. /loop 2h send a summary of my latest build logs from Shipyard MCP to the #logs Slack channel.

/loop also lets you schedule existing slash commands to run:

/loop 10m /update-status-page

You can schedule up to 50 tasks per CC session.

Managing your loops

Claude lets you manage tasks in natural language. Claude interprets these then uses CronCreate, CronList, and CronDelete tools. You can also use a task’s 8-character ID to cancel it.

list all my upcoming scheduled tasks
cancel the check logs task

The PR babysitting use case

Anthropic mentions that PR babysitting will be one of the most valuable use cases for this. This is because many devs find it hard to switch between reviewing/patching PRs and doing feature work. Instead, CC can take this on autonomously, as changes get pushed and tests run.

For example:

/loop 10m babysit all the PRs authored by me on the core repo. Resolve any build issues and use a worktree agent to attend to comments

Do I need to leave my computer on?

Claude Code scheduled tasks need to exist within a CC session, so they won’t run in the background when your computer is off or CC isn’t running. This also confines your loops to your own “workday”, e.g. do you need PR babysitting to happen overnight? Anthropic suggests using Claude within GitHub Actions to run scheduled tasks with full automation.

Staying in the inner loop

Claude’s /loop command helps you offload any Claude-friendly continuous tasks so you can stay focused on higher-impact work.

To get ephemeral environments set up for higher-quality dev/test feedback loops, start a 30-day free Shipyard trial and tell Claude what to do.

Try Shipyard today

Get isolated, full-stack ephemeral environments on every PR.

About Shipyard

Shipyard manages the lifecycle of ephemeral environments for developers and their agents.

Get full-stack review environments on every pull request for dev, product, agentic, and QA workflows.

Stay connected

Latest Articles

Shipyard Newsletter
Stay in the (inner) loop

Hear about the latest and greatest in cloud native, agents, engineering, and more when you sign up for our monthly newsletter.