.claude/skills/ralph-run/SKILL.md
Run RALPH autonomous development loop to implement features from the PRD.
npx skillsauth add doravidan/supreme-ralph ralph-runInstall 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 the RALPH autonomous development loop to implement features from the PRD.
For implementing features from a PRD file:
./scripts/ralph/ralph.sh 20
For quick one-off tasks without a PRD:
./scripts/ralph/ralph.sh --task "Fix the login button styling"
This skill activates when:
/ralph-run - Start RALPH with default iterations (10)/ralph-run 20 - Start RALPH with specified iterations/ralph-run --task "description" - Single-task mode# Check for PRD in multiple formats
if [ -f prd.json ]; then
echo "✓ Found prd.json (JSON format)"
# Validate JSON
cat prd.json | jq . > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "❌ prd.json is not valid JSON"
exit 1
fi
# Check for incomplete stories
REMAINING=$(cat prd.json | jq '[.userStories[] | select(.passes == false)] | length')
elif [ -f PRD.md ]; then
echo "✓ Found PRD.md (Markdown format)"
# Count unchecked tasks
REMAINING=$(grep -c '^\s*- \[ \]' PRD.md || echo "0")
elif [ -f tasks.yaml ]; then
echo "✓ Found tasks.yaml (YAML format)"
REMAINING=$(grep -c 'completed: false' tasks.yaml || echo "0")
else
echo "❌ No PRD found"
echo ""
echo "Create one first:"
echo " /prd [feature description]"
echo " or"
echo " Create prd.json, PRD.md, or tasks.yaml"
exit 1
fi
if [ "$REMAINING" -eq 0 ]; then
echo "✓ All stories already complete!"
exit 0
fi
echo "✓ Found $REMAINING incomplete stories/tasks"
# Check for .ralph/config.yaml
if [ -f .ralph/config.yaml ]; then
echo "✓ Found .ralph/config.yaml"
# Show configured commands
echo " Quality gates:"
grep -A4 "commands:" .ralph/config.yaml | tail -4
else
echo "⚠ No .ralph/config.yaml found"
echo " Run /setup-project to generate it"
fi
if [ ! -f PROJECT_SPEC.md ]; then
echo "⚠ PROJECT_SPEC.md not found"
echo " RALPH works better with project context"
echo " Run /setup-project to generate it"
fi
# Ensure clean working directory or uncommitted changes are intentional
git status --short
echo "=== PRD Status ==="
if [ -f prd.json ]; then
cat prd.json | jq '{
project: .project,
branch: .branchName,
total: (.userStories | length),
complete: ([.userStories[] | select(.passes == true)] | length),
remaining: ([.userStories[] | select(.passes == false)] | length)
}'
echo ""
echo "=== Stories to Implement ==="
cat prd.json | jq -r '.userStories[] | select(.passes == false) | " \(.id): \(.title) (Priority \(.priority))"'
elif [ -f PRD.md ]; then
echo "Remaining tasks:"
grep '^\s*- \[ \]' PRD.md
elif [ -f tasks.yaml ]; then
echo "Remaining tasks:"
grep -B1 'completed: false' tasks.yaml | grep 'title:'
fi
./scripts/ralph/ralph.sh 20
The script:
<promise>COMPLETE</promise> signal# Skip tests (faster iteration)
./scripts/ralph/ralph.sh --skip-tests 20
# Skip linting
./scripts/ralph/ralph.sh --skip-lint 20
# Custom branch
./scripts/ralph/ralph.sh --branch feature/my-feature 20
# Dry run (no commits)
./scripts/ralph/ralph.sh --dry-run 20
# Single-task mode (no PRD needed)
./scripts/ralph/ralph.sh --task "Add dark mode toggle to settings page"
node scripts/run-ralph.js 20
Additional options:
node scripts/run-ralph.js --status # Show PRD status
node scripts/run-ralph.js --validate # Validate prd.json
node scripts/run-ralph.js --reset # Reset progress.txt
node scripts/run-ralph.js --analyze # Re-analyze project
node scripts/run-ralph.js --skip-tests # Skip test quality gate
node scripts/run-ralph.js --skip-lint # Skip lint quality gate
node scripts/run-ralph.js --dry-run # Don't commit changes
RALPH configuration is stored in .ralph/config.yaml:
# Rules - AI MUST follow these on every task
rules:
- "Always use TypeScript strict mode"
- "Follow existing patterns in src/utils/"
- "Write tests for all new functions"
# Boundaries - AI should NOT modify these files
boundaries:
never_touch:
- "src/legacy/**"
- "migrations/**"
- "*.lock"
# Quality gate commands
commands:
test: "npm test"
lint: "npm run lint"
typecheck: "npx tsc --noEmit"
build: "npm run build"
# Execution settings
settings:
max_retries: 3
retry_delay: 5
auto_commit: true
For more control, run iterations manually:
# Run single iteration
claude -p "$(cat scripts/ralph/CLAUDE.md)"
# Check progress
cat prd.json | jq '.userStories[] | {id, title, passes}'
# Review changes
git log --oneline -5
git diff HEAD~1
# Continue if needed
claude -p "$(cat scripts/ralph/CLAUDE.md)"
Each RALPH iteration follows this flow:
┌─────────────────────────────────────────────────────────┐
│ RALPH ITERATION │
├─────────────────────────────────────────────────────────┤
│ │
│ 1. READ CONTEXT │
│ ├── prd.json (stories, completion status) │
│ ├── PROJECT_SPEC.md (tech stack, patterns) │
│ ├── progress.txt (learnings from prior iterations) │
│ └── git log (what was done before) │
│ │
│ 2. SELECT STORY │
│ └── Pick highest priority with passes: false │
│ │
│ 3. IMPLEMENT │
│ ├── Follow PROJECT_SPEC.md patterns │
│ ├── Write clean, production-ready code │
│ └── Meet ALL acceptance criteria │
│ │
│ 4. QUALITY GATES │
│ ├── Typecheck: npm run typecheck / npx tsc │
│ ├── Lint: npm run lint │
│ └── Test: npm test │
│ │
│ 5. COMMIT │
│ └── git commit -m "feat: US-XXX - Story Title" │
│ │
│ 6. UPDATE PRD │
│ └── Set passes: true in prd.json │
│ │
│ 7. LOG PROGRESS │
│ └── Append learnings to progress.txt │
│ │
│ 8. CHECK COMPLETION │
│ ├── If all stories pass: <promise>COMPLETE</promise>│
│ └── Otherwise: exit for next iteration │
│ │
└─────────────────────────────────────────────────────────┘
# Real-time monitoring
tail -f progress.txt
# Last 50 lines
tail -50 progress.txt
# All stories
cat prd.json | jq '.userStories[] | {id, title, passes}'
# Remaining stories
cat prd.json | jq '.userStories[] | select(.passes == false) | {id, title, priority}'
# Completion percentage
cat prd.json | jq '
(.userStories | length) as $total |
([.userStories[] | select(.passes == true)] | length) as $done |
{total: $total, done: $done, remaining: ($total - $done), percent: (($done / $total) * 100 | floor)}
'
# Recent commits
git log --oneline -10
# Commits on this branch
git log --oneline main..HEAD
# Show files changed
git diff --stat main..HEAD
# Look for recurring issues
grep -i "error\|fail\|stuck\|retry" progress.txt
# Review last iteration
tail -100 progress.txt
# If tests fail, fix them
npm test
# If typecheck fails, fix types
npx tsc --noEmit
# If lint fails, fix or auto-fix
npm run lint -- --fix
# Reset progress (preserves patterns)
node scripts/run-ralph.js --reset
# Or manually clear the stuck iteration
# Edit progress.txt to remove failed attempt
# Resume
./scripts/ralph/ralph.sh 20
If a story is too complex:
# Edit prd.json to split the story
# Set the original back to passes: false
# Add new smaller stories with higher priority numbers
When RALPH finishes:
=== RALPH Complete ===
Project: [Feature Name]
Branch: ralph/[feature-slug]
Stories: [N]/[N] complete
Commits:
abc1234 feat: US-001 - Story Title
def5678 feat: US-002 - Story Title
...
Next Steps:
1. Review the implementation:
git diff main..HEAD
2. Run full test suite:
npm test
3. Create PR:
gh pr create --base main --title "feat: [Feature Name]"
=== RALPH Paused ===
Completed: [X]/[N] stories
Remaining: [Y] stories
To continue:
./scripts/ralph/ralph.sh 20
To review progress:
cat progress.txt
cat prd.json | jq '.userStories[] | select(.passes == false)'
# Typecheck
npm run typecheck
# or
npx tsc --noEmit
# Lint
npm run lint
# or
npx eslint . --ext .ts,.tsx
# Test
npm test
# or
npx vitest run
# Type check
mypy .
# Lint
ruff check .
# or
pylint **/*.py
# Test
pytest
# Build
go build ./...
# Lint
golangci-lint run
# Test
go test ./...
# 1. Create PRD
/prd Add user authentication with email/password
# 2. Review generated PRD
cat prd.json
cat tasks/prd-user-authentication.md
# 3. Adjust if needed
# (edit prd.json)
# 4. Create feature branch
git checkout -b ralph/user-authentication
# 5. Run RALPH
./scripts/ralph/ralph.sh 20
# 6. Monitor (in another terminal)
watch -n 5 'cat prd.json | jq ".userStories[] | {id, passes}"'
# 7. When complete, review
git log --oneline main..HEAD
npm test
# 8. Create PR
gh pr create --base main
Create one with /prd [feature] or /ralph-convert tasks/prd-[name].md
Reset with --reset flag or edit prd.json to set passes: false
Check progress.txt for patterns, fix tests manually, then continue
Add explicit notes to progress.txt about the issue and correct approach
Split into smaller stories in prd.json, adjust priorities
Check acceptance criteria - may need more specific criteria
development
Run RALPH autonomous development loop. Converts PRD markdown to prd.json and runs autonomous implementation.
development
Run RALPH autonomous development loop to implement features from the PRD.
documentation
Generate detailed Product Requirements Documents (PRDs) through interactive conversation.
development
Initialize any project with Claude Code best practices and RALPH autonomous development