Skip to content

Day 40 of 52 · about 15 min · Automation · Bonus

Run prompts on a schedule

Checks you mean to run and then forget, like a look at failing tests every half hour, can run on a timer. Claude Code has three timers, and the wrong one gives you a check that quietly stops.

You’ll finish with

  • A prompt that repeats in your session with /loop
  • The habit of listing and cancelling scheduled tasks
  • A cloud routine created with /schedule

You’ll need

  • Claude Code open in a project with tests, such as the practice project. Session tasks end with the session and expire after seven days.
  • For step 3: a Pro, Max, Team or Enterprise plan and the project on GitHub. Routines are a research preview.

Before you start

Tell us about your setup and the steps change to fit it. Your answers stay in this browser, and you can change them at any time.

Which system are you on?

Commands differ between systems. Pick the one you’ll run Claude Code on.

The steps

One step at a time. When a step’s check matches, tick it and the next one opens.

0 of 3 steps done0%
  1. Step 1 of 3: Repeat a prompt with /loop

    Give /loop an interval and a prompt.

    Inside a session, put the interval first and the prompt after it. Units are s, m, h and d.

    In Claude Code

    You type: /loop 30m run npm test and tell me only if something fails

    What happens: Claude turns the interval into a cron schedule and confirms the cadence and a job ID.

    The prompt runs between your turns, never in the middle of a reply.

    Check it worked

    Claude confirms a 30-minute schedule and shows the job’s ID.

  2. Step 2 of 3: List and cancel scheduled tasks

    Ask in plain words. Claude lists or deletes tasks for you.

    Tasks fire only while the session is open and idle, and missed runs don’t catch up. A recurring task fires one last time seven days after you create it, then deletes itself.

    In Claude Code

    You type: what scheduled tasks do I have?

    What happens: Claude lists each task with its ID, schedule and prompt.

    You type: cancel the test check job

    Each task has an 8-character ID. A session holds up to 50.

    Check it worked

    After the cancel, asking again shows no scheduled tasks.

  3. Step 3 of 3: Move the check to the cloud with /schedule

    Create a routine that runs on Anthropic’s cloud even when your laptop is off.

    A routine is a saved prompt plus repositories, run as a cloud session. Describe it after the command:

    In Claude Code
    /schedule every weekday at 9am run npm test and summarise any failures

    /loop

    • Runs in your open session
    • Sees your local files
    • As often as every minute, for up to seven days

    Desktop scheduled task

    • Runs on your machine while the app is open
    • Sees your local files
    • Skipped while your computer sleeps

    Cloud routine

    • Runs in the cloud, laptop off is fine
    • Fresh clone, no local files
    • At most once an hour
    Pick by where the work has to run and how often.

    Check it worked

    Claude asks about the schedule, repository and prompt, then saves the routine. It appears at claude.ai/code/routines.

    If it didn’t work

    /schedule shows Unknown command

    It needs a claude.ai subscription login, not a Console API key. Run /login with your claude.ai account, or create the routine at claude.ai/code/routines.

Finish · 3 of 3 steps to go

Your checks run on a timer

Use /loop for watching something during a session, and a routine for anything that must keep running after you close the laptop.

What you’ll have checked

  • /loop confirmed a job ID
  • You listed and cancelled a task
  • Your routine shows at claude.ai/code/routines

Lesson updates by email

Get lesson updates by email

Leave your email and we’ll tell you when we add or update a lesson.

We’ll email you when we add or update a lesson. We use your email only for this. Privacy policy

Claude Code for your team

Want Claude Code set up across your team?

HorizonLux sets up and repairs Claude Code for teams: CLAUDE.md rules, hooks that enforce them and reviewed MCP servers. Book a free call to talk it through.

Questions

Questions about Day 40

Can a routine run every ten minutes?

No. Routines run at most once an hour. For shorter intervals, use `/loop` in an open session or a Desktop scheduled task.

Sources

Checked against the official Claude Code docs on .

Independent resource, not affiliated with Anthropic. HorizonLux wrote this lesson; Claude Code is made by Anthropic.