skills/ralph/SKILL.md
Implementation of the Ralph Loop technique - continuous self-referential AI loops for interactive iterative development. Run the agent in a while-true loop with the same prompt until task completion.
npx skillsauth add pitzcarraldo/skills ralphInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Implementation of the Ralph Loop technique for iterative, self-referential AI development loops.
Ralph is a development methodology based on continuous AI agent loops. As Geoffrey Huntley describes it: "Ralph is a Bash loop" - a simple while true that repeatedly feeds an AI agent a prompt file, allowing it to iteratively improve its work until completion.
The technique is named after Ralph Loop from The Simpsons, embodying the philosophy of persistent iteration despite setbacks.
This skill implements Ralph using a Stop hook that intercepts the agent's exit attempts:
# You run ONCE:
/ralph-loop "Your task description" --completion-promise "DONE"
# Then the agent automatically:
# 1. Works on the task
# 2. Tries to exit
# 3. Stop hook blocks exit
# 4. Stop hook feeds the SAME prompt back
# 5. Repeat until completion
The loop happens inside your current session - you don't need external bash loops. The Stop hook creates the self-referential feedback loop by blocking normal session exit.
This creates a self-referential feedback loop where:
/ralph-loop "Build a REST API for todos. Requirements: CRUD operations, input validation, tests. Output <promise>COMPLETE</promise> when done." --completion-promise "COMPLETE" --max-iterations 50
The agent will:
Start a Ralph loop in your current session.
Usage:
/ralph-loop "<prompt>" --max-iterations <n> --completion-promise "<text>"
Options:
--max-iterations <n> - Stop after N iterations (default: unlimited)--completion-promise <text> - Phrase that signals completionExecute the setup script to initialize the Ralph loop:
"~/.agents/skills/ralph/scripts/setup-ralph-loop.sh" $ARGUMENTS
Please work on the task. When you try to exit, the Ralph loop will feed the SAME PROMPT back to you for the next iteration. You'll see your previous work in files and git history, allowing you to iterate and improve.
CRITICAL RULE: If a completion promise is set, you may ONLY output it when the statement is completely and unequivocally TRUE. Do not output false promises to escape the loop, even if you think you're stuck or should exit for other reasons. The loop is designed to continue until genuine completion.
Cancel the active Ralph loop.
Check if .ralph/ralph-loop.local.md exists using Bash: test -f .ralph/ralph-loop.local.md && echo "EXISTS" || echo "NOT_FOUND"
If NOT_FOUND: Say "No active Ralph loop found."
If EXISTS:
.ralph/ralph-loop.local.md to get the current iteration number from the iteration: fieldrm .ralph/ralph-loop.local.mdThe Ralph Loop technique is an iterative development methodology based on continuous AI loops, pioneered by Geoffrey Huntley.
Core concept:
while :; do
cat PROMPT.md | coding-agent --continue
done
The same prompt is fed to the agent repeatedly. The "self-referential" aspect comes from the agent seeing its own previous work in the files and git history, not from feeding output back as input.
Each iteration:
The technique is described as "deterministically bad in an undeterministic world" - failures are predictable, enabling systematic improvement through prompt tuning.
To signal completion, the agent must output a <promise> tag:
<promise>TASK COMPLETE</promise>
The stop hook looks for this specific tag. Without it (or --max-iterations), Ralph runs infinitely.
The "loop" doesn't mean the agent talks to itself. It means:
❌ Bad: "Build a todo API and make it good."
✅ Good:
Build a REST API for todos.
When complete:
- All CRUD endpoints working
- Input validation in place
- Tests passing (coverage > 80%)
- README with API docs
- Output: <promise>COMPLETE</promise>
❌ Bad: "Create a complete e-commerce platform."
✅ Good:
Phase 1: User authentication (JWT, tests)
Phase 2: Product catalog (list/search, tests)
Phase 3: Shopping cart (add/remove, tests)
Output <promise>COMPLETE</promise> when all phases done.
❌ Bad: "Write code for feature X."
✅ Good:
Implement feature X following TDD:
1. Write failing tests
2. Implement feature
3. Run tests
4. If any fail, debug and fix
5. Refactor if needed
6. Repeat until all green
7. Output: <promise>COMPLETE</promise>
Always use --max-iterations as a safety net to prevent infinite loops on impossible tasks:
# Recommended: Always set a reasonable iteration limit
/ralph-loop "Try to implement feature X" --max-iterations 20
# In your prompt, include what to do if stuck:
# "After 15 iterations, if not complete:
# - Document what's blocking progress
# - List what was attempted
# - Suggest alternative approaches"
Note: The --completion-promise uses exact string matching, so you cannot use it for multiple completion conditions (like "SUCCESS" vs "BLOCKED"). Always rely on --max-iterations as your primary safety mechanism.
Ralph embodies several key principles:
Don't aim for perfect on first try. Let the loop refine the work.
"Deterministically bad" means failures are predictable and informative. Use them to tune prompts.
Success depends on writing good prompts, not just having a good model.
Keep trying until success. The loop handles retry logic automatically.
Good for:
Not good for:
development
Review a tech spec document written in the team's Notion template format (Summary, Background, Goals, Non-Goals, Plan, Measuring Impact, Security/Privacy/Risks, Other Considerations, Milestones, Open Questions). Use when the user asks to "테크 스펙 리뷰", "tech spec 리뷰", "스펙 문서 리뷰", "이 스펙 봐줘", or provides a Notion/Google Docs/Markdown tech spec link or file and asks for feedback, critique, or readiness check before sharing with the team.
tools
Draft a daily standup from the current user's Slack, GitHub, Linear, and Google Calendar activity. Use when the user asks to create, prepare, or summarize a standup/status update from connected app activity; to collect a user's work for a date; or to verify whether Slack, GitHub, Linear, and Google Calendar connectors/MCP tools are available before drafting a standup.
development
List and resume previous coding agent sessions by loading their context into the current session. Use when the user wants to (1) see previous sessions for the current directory with summaries, (2) continue work from a previous session by loading its full conversation context, (3) recover work from an interrupted session, or (4) transfer context between sessions. Supports Claude Code and Codex sessions.
development
Pre-push CodeRabbit review-fix loop. Runs local CodeRabbit review, fixes valid issues, and repeats until clean so the branch passes CodeRabbit review on push with no additional comments. Use when the user says "review and fix", "review loop", or wants to ensure the branch is CodeRabbit-clean before pushing.