Claude Code: Watch CI and Fix It (/loop)

A /loop prompt that has Claude Code check CI every 15 minutes and, if the branch is red, pull the failing log, fix it and push.

  • 🤖 Claude Code
  • 🗂️ Coding

Last verified: write-up checked

Prompt by Anthropic · Original source (opens in a new tab)

Claude Code: Watch CI and Fix It (/loop) — prompt preview

The prompt

prompt
/loop 15m check CI on this branch, and if it's red pull the failing job's log, fix it and push

What it is

From the "Start runs on a schedule or an event" section of the Claude Code best-practices page. Claude can handle a run by itself, but it can't decide to start one; /loop repeats a prompt on an interval inside an open session. The example checks CI on the current branch every 15 minutes and, when it is red, pulls the failing job's log, fixes the problem and pushes.

Who it's for

  • Developers babysitting a red CI pipeline
  • Teams experimenting with scheduled agent runs

Requirements

Requirements

  • Claude Code

طلب /loop يجعل Claude Code يفحص CI كل 15 دقيقة، وإذا فشل الفرع يقرأ سجل المهمة الفاشلة ويصلحها ويدفع التعديل.

Examples

From the source

Prompt
prompt
/loop 15m check CI on this branch, and if it's red pull the failing job's log, fix it and push

Expected output: Exact prompt from Anthropic docs.

Pros & cons

Pros

  • Pro:Hands off the tedious watch-and-fix cycle on CI
  • Pro:Clear stop condition when the build is green

Cons

  • Con:Needs the /loop feature and CI access; watch for runaway fixes

Tips

  • Each run is another turn in the same session, so the source advises not leaving one going in a long conversation
  • For runs while your laptop is closed the source points to /schedule (cloud scheduled tasks); protect main with a branch rule the task can't bypass and watch the first few runs