Claude Code Mastery
20 partsTL;DR
Claude Code now has a native Loop feature for scheduling recurring prompts - from one-minute intervals to three-day windows. Fix builds on repeat, summarize Slack channels, email yourself Hacker News digests. All from the CLI.
Read next
Claude Opus 4.5 ran autonomously for 4 hours 49 minutes using stop hooks and the Ralph Loop pattern. Walk away, come back to completed work. Here's how it works.
10 min readHow to spec agent tasks that run overnight and wake up to verified, reviewable code. The spec format, pipeline, and review workflow.
11 min readHooks give you deterministic control over Claude Code. Auto-format on save, block dangerous commands, run tests before commits, fire desktop notifications. Here's how to set them up.
12 min readIf you've ever wanted Claude Code to do something more than once without babysitting it, you've probably hacked together a shell loop or a cron job wrapping claude -p. That worked. Barely. Claude Code now has a first-class Loop feature that handles recurring prompts natively - scheduling, intervals, expiry, and session scoping built in.
This is the evolution of the "Ralph Wiggins technique" (yes, that was its name) into something you'd actually ship a workflow around.
The core problem with wrapping Claude Code in external schedulers: context evaporates between runs. Each invocation is a cold start. No memory of the last run. No awareness of what changed. No ability to pick up where it left off.
Loops solve this by keeping the session alive. The prompt runs on a schedule within a persistent Claude Code session. Same context window, same tool access, same MCP connections. The agent remembers what it did last iteration and can build on it.

Two entry points. Natural language or the /loop command.
Natural language works exactly how you'd expect:
Every 5 minutes, check if my PR build is passing. If it fails,
read the error log, fix the issue, and push a new commit.
Claude Code parses the schedule, sets the interval, and starts executing. You can also be explicit with the command:
/loop "Summarize any new posts tagged #announcements in the team Slack channel" --interval 30m --expires 8h
The minimum interval is one minute. Maximum window is three days. After the expiry, the loop stops automatically - no orphaned processes, no runaway API bills.
Each loop gets a scheduled prompt, optional notes for context, and the auto-expiry timer. Clean and predictable.
Three new commands handle lifecycle management:
cron create # Create a new scheduled loop
cron list # See all active loops in the current session
cron delete # Kill a specific loop by ID
cron list shows you every active loop with its interval, next run time, and expiry. cron delete takes the loop ID and stops it immediately.
Fixing builds on repeat. Point a loop at your CI pipeline. Every few minutes, check the build status. If it's red, read the logs, identify the failure, fix it, commit, push. Keep going until green. This is the "leave it running overnight" play - wake up to a passing build instead of a Slack notification graveyard.
Slack channel summaries via MCP. If you've connected Slack through MCP, loop a prompt that pulls new messages from a channel, summarizes them, and writes the summary to a local file or posts it back to a different channel. Daily standup notes that write themselves.
Daily git recaps. Schedule a loop that runs once a day, pulls git log for the last 24 hours across your repos, formats a summary, and saves it to your desktop. Context on what your team shipped without opening GitHub.
Every day at 9am, run git log --since="24 hours ago" --oneline
across all repos in ~/Developer, summarize the changes by project,
and save to ~/Desktop/daily-recap.md

Get the weekly deep dive
Tutorials on Claude Code, AI agents, and dev tools - delivered free every week.
From the archive
This is where it gets interesting. Loops compose with everything Claude Code already has - skills, MCP tools, CLI access. Chain them together.
The Hacker News automation is a good example of this in practice:
Every day at 7am, use Firecrawl to scrape the Hacker News front page.
Summarize the top 10 posts most relevant to AI agents and developer tools.
Email me the summary using the Gmail CLI skill.
One prompt. Four tools. Runs daily until the session closes or the expiry hits. No glue code.
Loops are scoped to the active session. Close the terminal, close the session, loops stop. This is by design - it keeps the feature safe and predictable. No background daemons, no orphaned processes eating your API quota at 3am.
But it means loops aren't durable. If you need something that survives a reboot or runs when your laptop is closed, you need a different approach:
For anything that needs to run reliably for more than a working session, use those instead. Loops are for "I'm working and I want this thing happening in the background while I focus on something else."
A subtle but smart detail: Claude Code adds up to a 10% random offset to your scheduled interval. If you set a 10-minute loop, it might fire at 9:12, then 10:48, then 9:36.
Why? If a thousand developers all schedule a "every 10 minutes" loop, you don't want all of them hitting the API at exactly :00, :10, :20. The jitter spreads the load. Same principle as exponential backoff in distributed systems, applied preemptively.
You can disable this with a flag if you need precise timing, but for most use cases the offset is invisible and helpful.

Loops - ephemeral, session-scoped, great for "while I'm working" background tasks. Zero setup.
System cron / LaunchAgents - durable, survives reboots, but you lose Claude Code's session context. Each run is a cold start.
GitHub Actions - cloud-durable, runs when your machine is off, integrates with repos natively. Best for CI/CD-adjacent automation.
Pick based on durability requirements. Most developers will use loops for the ad-hoc stuff and Actions for anything that needs to be reliable.
Official docs:
This article is based on a Developers Digest video. All feature behavior is based on direct testing with Claude Code at time of publication.
Further Reading:
Claude Code Loops are a native scheduling feature that lets you run recurring prompts at set intervals - from every minute to every three days. Unlike wrapping Claude Code in external cron jobs, loops maintain session context between runs, so the agent remembers what it did in previous iterations and can build on that work.
Two ways. Use natural language like "Every 5 minutes, check if my build is passing" and Claude Code parses the schedule automatically. Or use the explicit command: /loop "Your prompt here" --interval 30m --expires 8h. The minimum interval is one minute and maximum window is three days.
Loops are session-scoped - they run while your Claude Code session is active. Close the terminal or end the session, and loops stop. This is by design for safety. For durable automation that survives reboots or runs when your laptop is closed, use GitHub Actions or the Claude Desktop app's scheduling feature.
The minimum interval is one minute. This is a rate-limit guardrail to prevent runaway API costs. If you set a loop to run every minute for 8 hours, that's 480 API calls - plan your usage accordingly.
Yes. Loops compose with everything Claude Code has - skills, MCP tools, CLI access. A common pattern is a loop that fires daily, uses Firecrawl to scrape a webpage, summarizes the content, and emails you the digest via the Gmail CLI skill. One prompt, multiple tools, runs automatically.
Claude Code adds up to 10% random jitter to your scheduled interval. A 10-minute loop might fire at 9:12, then 10:48. This spreads API load across users who might all schedule similar intervals. You can disable this with a flag if you need precise timing.
Use loops for ephemeral, session-scoped background tasks while you're working - zero setup. Use system cron for durable scheduling that survives reboots but loses session context. Use GitHub Actions for cloud-durable automation that runs when your machine is off and integrates with repos natively.
Technical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.
Anthropic's agentic coding CLI. Runs in your terminal, edits files autonomously, spawns sub-agents, and maintains memory...
View ToolInteractive TUI dashboard that shows exactly where your Claude Code and Cursor tokens are going, in real time.
View ToolAnthropic's flagship reasoning model. Best-in-class for coding, long-context analysis, and agentic workflows. 1M token c...
View ToolOpenAI's coding agent for terminal, cloud, IDE, GitHub, Slack, and Linear workflows. Reads repos, edits files, runs comm...
View ToolTurn a one-liner into a working Claude Code skill. From idea to installed in a minute.
View AppUnlock pro skills and share private collections with your team.
View AppPro hooks for Claude Code. Private bundles, team sync, one-click install.
View AppConfigure Claude Code for maximum productivity -- CLAUDE.md, sub-agents, MCP servers, and autonomous workflows.
AI AgentsDeep comparison of the top AI agent frameworks - architecture, code examples, strengths, weaknesses, and when to use each one.
AI AgentsEliminate prompts with a background classifier that judges safety.
Claude Code
Claude Code “Loop” Scheduling: Recurring AI Tasks in Your Session The script explains Claude Code’s new “Loop” feature (an evolution of the Ralph Wiggins technique) for running recurring prompts that...

Nimbalyst Demo: A Visual Workspace for Codex + Claude Code with Kanban, Plans, and AI Commits Try it: https://nimbalyst.com/ Star Repo Here: https://github.com/Nimbalyst/nimbalyst This video demos N...

Composio: Connect AI Agents to 1,000+ Apps via CLI (Gmail, Google Docs/Sheets, Hacker News Workflows) Check out Composio here: http://dashboard.composio.dev/?utm_source=Youtube&utm_channel=0426&utm_...

Claude Opus 4.5 ran autonomously for 4 hours 49 minutes using stop hooks and the Ralph Loop pattern. Walk away, come bac...
How to spec agent tasks that run overnight and wake up to verified, reviewable code. The spec format, pipeline, and revi...

Hooks give you deterministic control over Claude Code. Auto-format on save, block dangerous commands, run tests before c...

Anthropic dropped a batch of updates across Claude Code and Cowork - remote control from your phone, scheduled tasks,...

AI-generated interfaces tend to look the same - gradient-heavy, emoji-laden, and generic. The style guide method gives y...

A practical guide to using Claude Code in Next.js projects. CLAUDE.md config for App Router, common workflows, sub-agent...

New tutorials, open-source projects, and deep dives on coding agents - delivered weekly.