← Claude Skills Browser

Automate Tasks in Claude Code

Use /loop and /schedule to run any Claude Code task automatically — recurring reviews, nightly audits, scheduled agents, and event-driven hooks.

/loop

In-session recurring tasks

Runs any prompt or slash command on a repeating interval inside your live Claude Code session. Self-pacing available — Claude decides when to fire next.

/schedule

Background cron agents

Creates remote scheduled agents that run on a cron schedule — even when Claude Code is closed. One-time or recurring. Notifies you on completion.

/loop — Recurring tasks while you work

The /loop command keeps Claude running a task on repeat, so you can stay in flow while Claude monitors, reviews, or checks status in the background.

Review your branch every 10 minutes as you code
/loop 10m /review
Let Claude self-pace a long-running autonomous task
/loop Run the marketing agent iteration and handle one action
Poll a build every 2 minutes until it passes
/loop 2m Check if the CI build on branch feature/auth has passed yet

How /loop self-pacing works

When you omit the interval (e.g., /loop Run the tests and fix failures), Claude Code dynamically decides when to wake up next based on what it's waiting for. It considers cache window expiry, expected task duration, and idle time — choosing intervals that minimize cost and latency.

/schedule — Background cron agents

The /schedule command creates remote scheduled agents that execute on a cron schedule. Unlike /loop, these run entirely in the background — even when Claude Code is closed.

One-time scheduled run
/schedule run /security-review on this branch at 11pm tonight
Recurring nightly audit
/schedule run /deps every Monday at 9am and report outdated packages
List scheduled agents
/schedule list

Comparison: /loop vs /schedule

ScenarioUseWhy
Review as you code /loop 10m /review In-session; fires while Claude Code is open
Nightly security audit /schedule Background; runs even when you're offline
Wait for a 30-min build /loop (self-paced) Self-paces to avoid unnecessary wake-ups
Daily dependency check /schedule Cron-based; runs at a fixed time daily
Babysit a long migration /loop (self-paced) Monitors and acts on results in real time

Event-driven automation with hooks and /update-config

For true event-driven automation — triggering a Claude task when a specific shell event fires — use /update-config to add hooks to your settings.json. Hooks are shell commands that execute in response to Claude Code events.

Add a post-tool hook via /update-config
/update-config add a hook that runs `echo "Tool complete"` after every tool call

Common hook patterns: run a linter after every file edit, send a Slack notification when Claude stops, auto-stage files after a successful build.

Browse All Claude Code Commands

See /loop, /schedule, /update-config, and 19 more skills — searchable, with examples for each.

Open Claude Skills Browser →

FAQ

What is the /loop command in Claude Code?
The /loop command runs a prompt or slash command on a recurring interval inside a live Claude Code session. Specify an interval (e.g., /loop 5m /review) or omit it to let Claude self-pace. Use it for watching a build, polling for status, or running a task repeatedly while you work.
What is the /schedule command in Claude Code?
The /schedule command creates, lists, and manages scheduled remote agents that run on a cron schedule — even when Claude Code is not open. You can schedule one-time runs ("run this at 3pm") or recurring jobs ("run /security-review every night at 11pm"). Scheduled agents run remotely and notify you when complete.
What is the difference between /loop and /schedule?
/loop runs in your current live session — the task repeats while you're actively in Claude Code. /schedule runs remotely on a cron schedule, even when Claude Code is closed. Use /loop for active monitoring; use /schedule for background automation.
How do I set up automated hooks in Claude Code?
Use /update-config to add hooks to your settings.json. Hooks are shell commands that Claude Code executes automatically in response to events like tool calls completing or Claude stopping. This enables event-driven automation without manually running slash commands.

← All slash commands   |   How to use /review →

More free AI dev tools

⚡ Using Claude Code? 30 power prompts that 2× your output · £5 £3 first 10Get PDF £3 →