How to Use Claude Code's /loop and /schedule Commands for Automated Workflows
Problem
I kept checking my PRs every few minutes to see if there were new review comments. I’d refresh GitHub, check Slack for CI updates, and manually clean up stale branches. This context-switching was killing my productivity.
Then I found out Claude Code has built-in automation commands that can do all this for me.
What I Learned
Claude Code has two slash commands for automation: /loop and /schedule. According to Boris Cherny (the creator of Claude Code), these are “two of the most powerful features” - yet most people don’t know about them.
Here’s what each command does:
/loop → Runs a command at regular intervals (every 5m, 30m, 1h)/schedule → Runs a command at a specific time (daily, weekly)Both can run for up to a week without manual intervention.
How Boris Uses Them
In a recent Reddit thread, Boris shared his real setup:
| Command | Interval | Purpose |
|---|---|---|
/loop 5m /babysit | Every 5 minutes | Auto-address code review comments |
/loop 30m /slack-feedback | Every 30 minutes | Post PR updates to Slack |
/loop 1h /pr-pruner | Every 1 hour | Close stale PRs |
This means his PRs get attention even when he’s focused on other work.
My First Attempt
I started with a simple babysit loop:
/loop 5m /babysitThe output confirmed it was running:
Started loop: /babysit will run every 5 minutes.Use /loop stop /babysit to stop this automation.I went back to coding. Five minutes later, I saw Claude had already addressed two minor review comments on my PR. This was working.
Adding More Automation
Next, I added the Slack feedback loop for my team:
/loop 30m /slack-feedbackNow my team gets automatic updates about:
- PR approvals
- Build status changes
- Review comment counts
I didn’t need to manually post anything.
What Went Wrong
I got too excited and added everything at once:
/loop 5m /babysit/loop 5m /pr-pruner/loop 10m /slack-feedbackThe problem? /babysit and /pr-pruner sometimes conflicted. One would try to address comments while the other was closing the PR. Not good.
The Fix
I staggered the intervals:
/loop 5m /babysit/loop 30m /slack-feedback/loop 1h /pr-prunerThis works because:
- Babysit runs frequently (needs fast response)
- Slack updates don’t need to be instant
- PR cleanup is maintenance, runs hourly
Checking Active Loops
To see what’s running:
/loop statusOutput:
Active loops:- /babysit (every 5m, started 2h ago)- /slack-feedback (every 30m, started 2h ago)- /pr-pruner (every 1h, started 2h ago)Stopping Automation
When I need manual control:
/loop stop /babysitOr to stop everything:
/loop stop allThe Difference Between /loop and /schedule
I initially confused these two. Here’s the distinction:
/loop 5m /babysit → Runs every 5 minutes (recurring)/schedule daily /cleanup → Runs once per day (scheduled)Use /loop for:
- Active monitoring (PR babysitting)
- Frequent updates (Slack notifications)
- Background tasks (cleanup)
Use /schedule for:
- Daily summaries
- Weekly audits
- One-time future tasks
Best Practices I Learned
1. Don’t set intervals too short
/loop 1m /babysit # Too frequent, wastes resources5 minutes is a good minimum for most tasks.
2. Don’t overlap conflicting commands
/loop 5m /babysit/loop 5m /pr-pruner # May conflict with babysitSpace them out appropriately.
3. Monitor the output
Automations can fail. I check the logs every few hours to make sure things are working.
Real-World Scenarios
Solo Developer:
/loop 10m /babysit # Check PRs every 10 minutes/loop 1h /pr-pruner # Clean up hourlyTeam Development:
/loop 5m /babysit # Fast response to reviews/loop 30m /slack-feedback # Keep team informed/loop 1h /pr-pruner # Repository hygieneRelease Day (intensive monitoring):
/loop 2m /babysit # Very frequent checks/loop 15m /slack-feedback # Frequent updates/loop stop /pr-pruner # Pause maintenance during releaseWhy This Matters
Before these commands, I spent about 30 minutes per day on PR housekeeping. Now I spend 2 minutes setting up automation at the start of the day, and everything runs itself.
The key insight: these aren’t just convenience features. They change how you work. You can focus on deep work while Claude handles the repetitive monitoring tasks.
Summary
In this post, I showed how to use Claude Code’s /loop and /schedule commands for automated workflows. The key points are:
/loopruns commands at intervals (5m, 30m, 1h)/scheduleruns commands at specific times (daily, weekly)- Both can run for up to a week
- Use staggered intervals to avoid conflicts
- Start with
/loop 5m /babysitand add more as needed
Final Words + More Resources
My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
- 👨💻 Reddit: 15 New Claude Code Hidden Features from Boris Cherny
- 👨💻 Claude Code Official Documentation
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!
Comments