✻Founding-member pricing: every lesson for $19/mo. The first 3 lessons are free. Start lesson 1 →
Unit 8 · Automate Repeat Work · Lesson 34 of 40

Scheduled Tasks: /loop & Cloud Routines

Schedule recurring Claude Code work: /loop for in-session repetition, cloud scheduled tasks (routines) and desktop schedules, plus safe patterns for each.

ACADEMY10 min+70 XP4-question quiz

🎯 By the end of this lesson you'll be able to

  • Repeat a prompt on an interval with /loop
  • Create cloud scheduled tasks that run without your machine
  • Choose between in-session, desktop, cloud and CI schedules
  • Write schedule-safe prompts

Work that happens on a clock

Some tasks recur: check the deploy every 10 minutes, triage new issues every morning, refresh dependencies weekly. Claude Code gives you several ways to put work on a schedule.

/loop: repeat inside a session

text
/loop 10m check whether the staging deploy finished; tell me if it failed and why

/loop re-runs a prompt on an interval within your current session, which is great for polling and babysitting. Leave out the interval and Claude paces itself.

Cloud scheduled tasks (routines)

Scheduled tasks, previously called routines, run on Anthropic's cloud infrastructure on a schedule, from an API call, or on a GitHub event. Your laptop can be closed. Create them with /schedule or from Claude Code on the web.

text
/schedule every weekday at 9am: triage new GitHub issues, label them, and post a summary

Each run works against your connected repository and can open pull requests for you to review.

Which scheduler?

OptionRuns whereBest for
/loopYour current sessionShort-term polling while you work
Desktop scheduled tasksThe desktop app on your machineRecurring local jobs
Cloud scheduled tasksAnthropic's cloudRecurring work that doesn't need your machine
GitHub Actions scheduleYour CI runnersJobs that belong to the repo's pipeline (next lesson)
◎Pick the schedulerpick the best fit
Watch this deploy for the next half hour while I work.
Short-term polling inside your session.
Every Monday, update dependencies and open a PR, even if my laptop is off.
Recurring work that runs in the cloud.
A nightly job that must use our self-hosted runners and org secrets.
It belongs in your CI pipeline.

Schedule-safe prompts

A scheduled run has nobody watching, so the prompt has to carry everything:

  • Define done: "open one PR with the updates; don't merge."
  • Give a check: "the PR must pass pnpm test."
  • Bound it: "if more than 20 packages are outdated, update only patch versions."
  • Say what to do when blocked: "if tests fail after updating, revert that package and note it in the PR."
!
Protect main

Scheduled agents should open pull requests, not push to main. Add a branch protection rule so even a misconfigured job can't land unreviewed changes.

⌨Type the command+15 XP

Write a /loop that checks "is the build green?" every 5 minutes

❯

Check your understanding

?Lesson quiz10 XP per correct answer · +25 for a perfect score
QUESTION 1 OF 4

What does /loop do?

Why: /loop repeats a prompt in-session, which suits polling.
QUESTION 2 OF 4

Where do cloud scheduled tasks run?

Why: They run in the cloud, so your machine can be off.
QUESTION 3 OF 4

What should a scheduled dependency-update job do?

Why: Scheduled agents propose changes through PRs, behind branch protection.
QUESTION 4 OF 4

What's essential in a scheduled prompt?

Why: No one is watching, so the prompt must carry everything.
0 / 4 correct
Academy lesson

Unlock lesson 34 and the next 6

You've finished the free lessons. Join the Academy for $19/month to unlock every lesson, quiz, terminal simulation and puzzle, plus the final exam and your certificate of completion.

  • All 40 lessons across 9 units
  • 165+ quiz questions
  • Final exam + certificate
  • New lessons as Claude Code evolves
  • XP, streaks and badges
  • Cancel anytime

Already a member? Log in to continue.

Key takeaways

  • /loop polls within your session; omit the interval to let Claude pace itself.
  • Cloud scheduled tasks run on a schedule, an API call or a GitHub event, without your machine.
  • Pick the scheduler by where the work belongs.
  • Scheduled prompts need done, a check, bounds and a blocked plan, and they open PRs.

Nice work. Lesson 34 done?

Mark it complete to earn +70 XP, keep your streak alive and unlock badges.

Written by Curtis Cornell from Anthropic's public Claude Code documentation. Last reviewed November 14, 2026. Claude Code changes fast; if something here differs from your version, the official docs win.

Start lesson 1 free →