This skill should be used when the user wants to set up an automated Claude agent loop that works through a list of tasks iteratively. It scaffolds a ralph loop — a bash-driven harness that runs Claude repeatedly, picking up the next work item each iteration until all items are complete. Triggers on "set up a ralph loop", "create an agent loop", "ralph", "loop through tasks", "automate this work", or when the user has a list of items they want Claude to work through autonomously.
Ralph Loop is a task automation pattern: a bash script runs Claude in agent mode repeatedly, each iteration picking the next unfinished item from a source-of-truth document, doing the work, updating a progress file, and continuing until everything is done.
The pattern works for any list of discrete work items: bug fixes, PRD sections, Sentry issues, feature implementations, content generation, migrations, etc.
Follow these steps in order when setting up a new ralph loop.
Ask the user:
Ask the user if they already have a document listing the work items. This could be:
If they have a document: Read it, understand the structure, and use it as items.md.
If they don't have a document: Help them create one. Interview them about the work items and generate items.md following the format in assets/items-template.md. Each item needs at minimum: an identifier, a title/description, and enough context for Claude to act on it.
Ask the user about their specific workflow needs:
pnpm build, pytest, cargo test). If none, skip validation.fix/ISSUE-ID-description, feat/prd-section-name)Copy the following assets into the target directory and customize them based on the answers from Steps 1-3:
Copy assets/ralph.sh to the target directory. Make it executable. The script is ready to use as-is — it points to prompt.md in the same directory.
Generate prompt.md — Do NOT copy the template verbatim. Generate a tailored prompt based on the user's goal and workflow options. Use assets/prompt-template.md as structural inspiration but write instructions specific to their use case. The prompt must include:
items.md as the source of truthprogress.md for tracking<promise>COMPLETE</promise>Place items.md — either the user's existing document or the one generated in Step 2.
Create progress.md — initialize an empty progress file using the standardized format from assets/progress-template.md. Adapt the column headers to match the use case.
Present the user with a summary of what was scaffolded:
ralph-loop/
ralph.sh — loop harness (run with: ./ralph.sh <iterations>)
prompt.md — agent instructions (tailored to your use case)
items.md — source of truth (N items)
progress.md — progress tracker (empty, ready to go)
Remind the user:
./ralph.sh 10 (or however many iterations they want)progress.md to see what was done| Asset | Purpose |
|---|---|
assets/ralph.sh | The loop harness script — runs Claude iteratively, checks for completion |
assets/prompt-template.md | Structural reference for generating tailored prompts |
assets/items-template.md | Example formats for different source-of-truth documents |
assets/progress-template.md | Standardized progress tracking format |