skills/ralph-loop/SKILL.md
Autonomous coding using Ralph Wiggum loops - a method for running fresh Claude instances per iteration to avoid context rot. Use when the user wants to implement features autonomously, mentions 'ralph', 'autonomous coding', 'run overnight', or wants to build something without supervision. Triggers on: use ralph, ralph loop, autonomous coding, implement this overnight, build X with ralph, help me create a spec for ralph.
npx skillsauth add szoloth/skills ralph-loopInstall 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.
Execute autonomous coding tasks using Ralph loops - a pattern that runs fresh Claude instances per iteration to avoid context degradation and maintain consistent code quality.
Activate this skill when the user:
Ralph loops solve the context window problem in autonomous coding:
Traditional Approach:
Ralph Loop Approach:
claude -p (headless mode)spec.md + implementation-plan.md are source of truth, not chat historyUse when the user has clear requirements and wants autonomous execution.
cd project-directory/
~/agent-tools/ralph-init.sh "Build a REST API for task management"
This launches bidirectional planning with Claude:
spec.md (what the system does)implementation-plan.md (task checklist)MANDATORY: Review and sign off on EVERY line of both files.
Ask the user to read:
spec.md - Is every decision explicit? Any ambiguity?implementation-plan.md - Are tasks properly sized? Ordered by dependency?If the user doesn't understand any line, the spec is not ready.
cp ~/agent-tools/ralph-prompt-template.md prompt.md
Edit prompt.md to include:
See references/ralph-prompt-template.md for the template.
Start with watch mode to verify Ralph stays on track:
~/agent-tools/ralph-run.sh --watch
Watch 2-3 iterations. If Ralph goes off track:
spec.md to add clarityOnce Ralph looks good, run without watch:
~/agent-tools/ralph-run.sh --max-iterations 20
or unlimited:
~/agent-tools/ralph-run.sh
Monitor progress in another terminal:
~/agent-tools/ralph-status.sh
tail -f .ralph-loop.log
When Ralph completes:
# Run all tests
npm test # or pytest, etc.
# Review changes
git diff
# Check logs
cat .ralph-loop.log
# Skim code for quality
Use when the user wants help architecting the spec without running Ralph yet.
Ask clarifying questions using bidirectional prompting:
Key principle: Surface implicit assumptions. Ask about things that seem "obvious" - those are where bugs hide.
Create spec.md following the pattern in references/example-spec-good.md:
Avoid patterns in references/example-spec-bad.md:
Create implementation-plan.md following the pattern in references/example-implementation-plan-good.md:
Task Sizing Rules:
Dependency Ordering:
Checklist Format:
- [ ] Create database schema with id, name, status fields
- [ ] Add migration for tasks table
- [ ] Implement GET /api/tasks endpoint
Each task should be verifiable - clear completion criteria.
When reviewing a spec the user has created:
Check for:
Provide specific feedback:
Use when the user wants to explore an idea without perfect planning, or has tokens expiring.
Perfect for:
cd ~/scratch-project
~/agent-tools/ralph-init.sh "Spike: Redis caching layer for API"
# Quick review, don't sweat perfection
vim spec.md
# Copy template
cp ~/agent-tools/ralph-prompt-template.md prompt.md
# Run with iteration limit
~/agent-tools/ralph-run.sh --max-iterations 5
Wake up to rough prototype and notes about what worked/didn't work.
Benefits:
The biggest skill in Ralph loops is architecting a bulletproof plan.
If the spec is vague or tasks are too large, errors cascade and amplify because you're out of the loop. Each iteration builds on the previous one.
Invest heavily upfront:
Too large: Ralph runs out of context mid-task, produces broken code Too small: Excessive overhead, slow progress Just right: 15-30 minutes of focused work, clear completion criteria
Examples of right-sized tasks:
Don't go autonomous on first run. Watch 2-3 iterations to verify:
If Ralph struggles, stop and improve the spec.
Entire context must stay under 100k tokens:
If specs are too large, Ralph hits the dumb zone even within single iterations.
Problem: "Build a modern, scalable API with good UX" Fix: "Node.js 20 + Express + PostgreSQL REST API with specific endpoints: ..."
Problem: "- [ ] Build the entire dashboard" Fix:
Problem: UI component task before database schema task Fix: Always go schema → backend → UI
Problem: "- [ ] Make it work well" Fix: "- [ ] GET /api/users returns 200 with user array, tests pass"
~/agent-tools/ralph-status.sh
Shows iteration count, tasks completed, remaining work.
tail -f .ralph-loop.log
See what Ralph is doing in real-time.
~/agent-tools/ralph-stop.sh
Lets current iteration finish, then stops.
touch .ralph-stop
Or Ctrl+C the ralph-run.sh process.
git checkout -b feature/new-feature
git commit -m "feat: checkpoint before ralph"
# Review changes
git diff main
# Run tests
npm test
# Manual verification
# Check .ralph-loop.log for issues
# Commit or iterate
git commit -m "feat: implement X via ralph loop"
# Review logs
cat .ralph-loop.log
# Check what went wrong
git diff
# Fix spec
vim spec.md
# Restart from checkpoint
git reset --hard HEAD
~/agent-tools/ralph-run.sh
Load these references as needed:
references/README-ralph.md - Full CLI documentationreferences/ralph-prompt-template.md - Template for prompt.mdreferences/example-spec-good.md - What good specs look likereferences/example-spec-bad.md - What to avoidreferences/example-implementation-plan-good.md - Proper task breakdownreferences/example-implementation-plan-bad.md - Common mistakesAll commands in ~/agent-tools/:
ralph-init.sh "description" # Initialize with planning
ralph-run.sh [options] # Execute the loop
ralph-stop.sh # Stop gracefully
ralph-status.sh # Check progress
Options for ralph-run.sh:
--max-iterations N - Stop after N iterations--watch - Pause between iterations for reviewUser: "I want to build a REST API for task management overnight using Ralph"
You should:
Clarify requirements through bidirectional prompting:
Run initialization:
cd ~/task-api
~/agent-tools/ralph-init.sh "Build REST API for task management with CRUD operations"
Guide spec review: "I've created spec.md and implementation-plan.md. Please review every line and confirm:
Help with prompt.md:
cp ~/agent-tools/ralph-prompt-template.md prompt.md
"I've created prompt.md. Please edit to add your coding conventions."
Start with watch mode:
~/agent-tools/ralph-run.sh --watch
"I'll run the first few iterations with watch mode so we can verify Ralph is on track."
Go autonomous: After 2-3 good iterations: "Ralph looks good. Running autonomously with max 20 iterations. Monitor with:
~/agent-tools/ralph-status.sh
tail -f .ralph-loop.log
```"
Verify results: "Ralph completed! Next steps:
npm testgit diffcat .ralph-loop.log"Ralph loops trade tokens for leverage. The further out of the loop you go, the more you multiply your output - but the more critical your planning becomes.
The skill hierarchy:
Start with watch mode on low-stakes work. Build your planning muscles. Then scale up.
content-media
Fetch transcripts from YouTube videos for summarization and analysis.
documentation
This skill should be used when reviewing or editing written drafts to ensure they match Sam's personal style guide. It prioritizes voice preservation and anti-beige detection while catching structural gaps. Triggers on requests to review, edit, or improve written content.
tools
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
development
Web search and content extraction using Brave Search. Use when researching topics, finding documentation, extracting article content, or gathering information from the web. No browser required - works headlessly.