How to Automate Tasks with /loop in Claude Code — Practical Guide 2026
Imagine that you are developing a project, you deployed it for staging and you need to monitor whether the build passed. Or you're running a test suite and want Claude to check the results every few minutes. Or you need to periodically check whether an endpoint is back online.
Before, you would do this manually: alt-tab to the terminal, run the command, return to Claude Code, ask for the analysis, repeat. With the/loop, launched in March 2026, you configure it once and Claude Code does it alone, at the interval you define.
In this guide, you will learn exactly how to use the/loop, what the tometers are, see practical examples for development and marketing, and understand how to combine skills for specialized automation.
1. What is /loop in Claude Code
O /loopand a native Claude Code command that works as alightweight cron job within the active session. It executes a prompt or slash command at regular intervals, without requiring external configuration.
In practice: you tell Claude Code "run this every X minutes" and he does it. Just like that.
Quick definition: /loop= automated periodic execution of prompts or commands within Claude Code. It works as long as the session is active. Default interval: 10 minutes. Customizable.
Unlike a traditional operating system cron job, the/loopwheelwithin the context of the Claude Code. This means AI can interpret results, make decisions, and even take corrective actions -- it's not just blind execution of a script.
Basic example: you configure/loop 5m "verifique o status do build e me avise se falhou". Claude Code runs every 5 minutes, checks the build, and if it detects failure, it can analyze the error log and suggest (or apply) the fix.
2. Context: March 2026 updates
O /loopHe didn't come alone. It is part of an update package released in March 2026 that transformed Claude Code into a significantly more autonomous tool:
| Update | What it does |
|---|---|
| /loop | Execute prompts or commands at regular intervals (lightweight cron job) |
| Voicemod | Voice interaction with Claude Code -- speak instead of typing |
| Auto mode | AI executes with fewer checkpoints, decides which actions are safe on its own |
| 1M context | Context window expanded to 1 million tokens |
What makes the/loopEspecially powerful is the combination with the other updates. Withauto mode, Claude Code can run the loop without asking for confirmation at each iteration (for actions it considers safe). With1M of context, it maintains the history of all previous executions of the loop, being able to detect patterns and trends over time.
This combination transforms Claude Code from a reactive assistant ("ask me for something and I'll do it") into aproactive("I monitor, detect problems and let you know").
3. How /loop works in practice
The flow of/loopand straight:
- You configurethe loop with the range and prompt/command
- Claude Code performsthe prompt at the defined frequency
- With each iteration, Claude processes the result, interprets it and decides whether he needs to act or just record
- The loop continuesuntil you cancel or the session ends
> /loop 5m verifique o status do ultimo deploy
[Loop configurado: a cada 5 minutos]
[Iteracao 1 - 14:30] Deploy em andamento... aguardando.
[Iteracao 2 - 14:35] Deploy concluido com sucesso.
Deploy finalizado! Status: success. Todas as checks passaram.
# Executar um slash command em loop
> /loop 10m /review
[Loop configurado: /review a cada 10 minutos]
Important points:
- O
/loopwheelwithin the active session. If you close the terminal, the loop stops - You can continue using Claude Code normally while the loop runs in the background.
- Claude maintains context between iterations -- he knows what happened in previous runs
- To cancel, use the standard interrupt command or close the session
4. Complete syntax and tometers
The syntax of/loopand simple:
Interval
The interval defines the execution frequency. Accepted formats:
| Format | Meaning | Example |
|---|---|---|
5m | Every 5 minutes | /loop 5m ... |
30m | Every 30 minutes | /loop 30m ... |
1h | Every 1 hour | /loop 1h ... |
| (omitted) | Default: 10 minutes | /loop ... |
Prompt or command
After the break, everything that follows is treated as the prompt that will be executed. Could it be:
- Free text:any instruction in natural language
- Native slash command:as
/review,/cost - Custom Skill:as
/auditoria-seo,/code-review
> /loop 5m rode npm test e me diga se algum teste falhou
# Slash command nativo a cada 30 min
> /loop 30m /review
# Skill personalizada a cada 15 min
> /loop 15m /auditoria-seo
# Sem intervalo (usa padrao de 10 min)
> /loop cheque se o servidor de staging esta respondendo em /api/health
5. 6 practical examples of automation
Here are real scenarios where the/loopeliminates manual labor:
1. Monitor build/CI
You pushed and want to know when the CI ends:
Claude Code runsgh run listevery 3 minutes, it detects when the workflow ends and analyzes the result. If it failed, it reads the log and suggests a fix.
2. Check staging deployment
3. Run tests periodically
Useful when you are editing code and want continuous feedback without stopping to run tests manually.
4. Monitor token consumption
Simple and direct: every 15 minutes you will see how much you spent in the session. Useful for long sessions where consumption can get out of control.
5. Monitor changes in the config file
6. Check external API availability
Want to master this faster?
Everything you are learning here becomes 10x more powerful with ready-made skills. Instead of typing commands manually, skills do the heavy lifting for you. 748+ professional skills, installs in 2 minutes.
Quero as Skills — $96. Combining /loop with skills
O /loopbecomes exponentially more powerful when combined with costm skills. Instead of executing a generic prompt, you execute a skill with detailed and specific instructions.
Example: Automated SEO monitoring
Imagine you have a skill/check-indexacaowhich checks whether specific URLs are indexed on Google. With/loop:
> /loop 1h /check-indexacao
# Rodar code review a cada 30 min
> /loop 30m /code-review
# Rodar analise de performance a cada 20 min
> /loop 20m /lighthouse-audit
The difference between running a generic prompt and running a skill is theoutput quality and consistency. A skill has detailed instructions, a defined output format, restrictions and specialized context. Each iteration of the loop produces results in the same pattern, facilitating comparison between executions.
Real workflow: deploy + monitor + report
A complete scenario using/loopand skills:
- Do you deploy for staging
- Set up
/loop 3m "cheque o status do deploy e rode /smoke-tests quando estiver pronto" - Claude detects that the deployment is finished and runs smoke tests automatically
- If the tests pass, it reports success. If they fail, it analyzes and suggests corrections
- You didn't have to touch the terminal once after pushing
That's itreal automation-- not chained bash scripts, but an AI that understands the context and makes decisions based on the results.
7. Auto mode + /loop: automation without interruption
O auto mode, also released in March 2026, allows Claude Code to perform actions without asking for confirmation when it considers them to be safe. When combined with/loop, the result is an automation that runs without any human intervention.
In default mode, Claude Code asks for confirmation before executing commands in the terminal, creating files or making changes. In auto mode, it assesses the risk of each action and autonomously executes those it classifies as safe.
How does this affect /loop
- Without auto mode:At each iteration of the loop, Claude may ask for confirmation to run commands. You need to be present to approve
- With auto mode:Claude executes the loop iterations autonomously. It runs the command, analyzes the result and continues without interruption
The combination is ideal for scenarios where you want to "set it and forget it" for a period of time: monitor builds while having lunch, check deployments while in a meeting, run tests while focusing on another project.
Security:Even in auto mode, Claude Code maintains security guards. It will not perform destructive actions (such asrm -rf ou git push --force) without confirmation, even in auto mode. The loop remains secure.
8. Good practices and limitations
Good practices
- Be specific in the prompt:"check build" is vague. "Rode
gh run list --limit 1and tell me if the status is completed, the conclusion is success, and how long it took" is specific. The clearer the prompt, the better each iteration - Use reasonable intervals:1 minute may be excessive for most scenarios. 5-10 minutes is a good starting point. Adjust according to urgency
- Define stopping criteria:include in the prompt when the loop should stop being relevant. "Monitor until the deployment completes, then stop" avoids unnecessary iterations
- Combine with skills for consistency:skills ensure that each iteration follows the same pattern. Loose prompts can generate inconsistent output between iterations
- Monitor token consumption:each loop iteration consumes tokens. In frequent loops with complex prompts, the cost accumulates. Use
/costperiodically
Limitations
- Mandatory active session:the loop stops if you close the terminal or log out of Claude Code. It is not a persistent daemon
- Token consumption:each iteration uses tokens. Loops with large prompts at short intervals can consume credits quickly
- No tollelism:the loop executes one prompt at a time. If executing an iteration takes longer than the interval, the next one waits for the current one to finish
- Context limited to history:Although the context of 1M tokens is broad, very long loops with large outputs may eventually need compression
When NOT to use /loop
- For tasks that need to run 24/7 -- use traditional cron jobs or monitoring services
- For tasks that require response in milliseconds -- the loop has minute granularity
- For tasks involving sensitive data in uncontrolled environments
Next step: install skills and see the difference
You already know the basics. Now imagine Claude Code knowing how to do all this himself — SEO, copywriting, code review, deployment, data analysis. That's what skills do. Lifetime access, updates included.
Ver o Mega Bundle — $9FAQ
O /loopis a command released in March 2026 that works as a lightweight cron job within the Claude Code session. It runs a prompt or slash command at regular intervals (by default every 10 minutes). You can use it to monitor builds, check deployments, run tests periodically or any other repetitive task.
No. THE/loopruns within the active Claude Code session. If you close the terminal or end the session, the loop stops. It works as a lightweight cron job for the current session, not as a persistent daemon. For tasks that need to run continuously, consider combining with operating system background processes.
Yes. You can use/loopto execute any slash command, including costm skills. For example:/loop 15m /auditoria-seoruns your SEO audit skill every 15 minutes. This is useful for automated monitoring, periodic quality checks and workflows that need to run at regular intervals. Packages likeminhakills.iooffer hundreds of skills ready to combine with /loop.