Skip to main content
skill CX Codex

ralph-loop — Claude Code skill: iterate until the task is done

A skill that keeps feeding the same prompt back to the agent after every turn, so each pass builds on the previous one.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add cursor/plugins --skill ralph-loop -a claude-code
Open on GitHub

What ralph-loop does

Ralph Loop turns a single request into a repeating cycle. When a turn ends, the agent gets the same prompt again and can read what it produced last time, so work continues instead of restarting. Useful for tasks too large to finish in one pass.

The skill writes a state file at .cursor/ralph/scratchpad.md, creating the .cursor/ralph/ directory first. Its YAML header holds the iteration number, max_iterations, and completion_promise; your task prompt sits underneath. A stop hook does the looping: it catches the end of each turn and re-sends the prompt as a followup message tagged [Ralph loop iteration N.].

max_iterations defaults to 0, which means no cap. The skill recommends setting a limit anyway as a safety net. The only clean way out is <promise>TEXT</promise>, and it should appear when the condition is genuinely met — not as an escape hatch. Put the completion_promise value in quotes if it contains special characters.

What it helps with

  • push a large task through many agent passes to completion
  • keep context across iterations of the same job
  • define a stop condition instead of looping forever
  • cap the number of iterations so the agent does not spin
  • run unattended refinement from one prompt

Example prompts for the agent

  • Start a ralph loop to build a REST API for todos with CRUD, validation and tests, max 20 iterations, completion promise COMPLETE
  • Run a ralph loop on the payments module refactor with no iteration limit
  • Start an iterative loop to fix the failing tests in tests/api, stop on promise DONE

How to install ralph-loop

1Skills CLI (Vercel)

npx skills add cursor/plugins --skill ralph-loop -a claude-code

2Manually: put the files in place

~/.claude/skills/ralph-loop/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/ralph-loop/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about ralph-loop

How do I install ralph-loop in Claude Code?

Run npx skills add cursor/plugins --skill ralph-loop -a claude-code. The skill lands at ~/.claude/skills/ralph-loop/SKILL.md.

What does ralph-loop do?

It creates .cursor/ralph/scratchpad.md holding your prompt and loop settings, then a stop hook returns that prompt at the end of every turn until the stop condition fires or the iteration limit runs out.

How does the loop know when to stop?

Through completion_promise: the agent emits <promise>TEXT</promise> only once the condition is truly satisfied. False promises to break out are off limits, and max_iterations acts as a backstop.

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set47

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor