Install
$ agentstack add skill-samqin123-claude-skill-pool-ralph ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
Ralph - Autonomous Agent Loop
Ralph is an autonomous AI agent loop that implements PRDs by repeatedly spawning fresh AI instances to complete user stories one by one.
What This Skill Does
This skill handles two phases:
- PRD Conversion: Converts a markdown PRD to
prd.jsonformat - Ralph Execution: Launches the autonomous loop that implements each story
Usage
/ralph [path-to-prd.md]
If no path is provided, looks for prd.json in the project root and runs directly.
Examples:
/ralph tasks/prd-my-feature.md- Convert PRD and run Ralph/ralph prd.json- Run Ralph with existing prd.json/ralph- Run Ralph (looks for prd.json)
Phase 1: PRD Conversion (if markdown provided)
Step 1: Read the PRD
Read the provided markdown PRD file.
Step 2: Archive Previous Run (if needed)
Check if prd.json exists with a different branchName. If so:
- Read current
prd.jsonand extractbranchName - Check if it differs from the new feature's branch
- If different AND
prd-progress.txthas content:
- Create archive folder:
.claude/archive/YYYY-MM-DD-[feature-name]/ - Copy current
prd.jsonandprd-progress.txtto archive - Reset
prd-progress.txtwith fresh header
Step 3: Convert to prd.json
Parse the PRD and generate prd.json in the project root:
{
"project": "[Project Name from PRD or auto-detected]",
"branchName": "ralph/[feature-name-kebab-case]",
"description": "[Feature description from PRD]",
"userStories": [
{
"id": "US-001",
"title": "[Story title]",
"description": "As a [user], I want [feature] so that [benefit]",
"acceptanceCriteria": [
"Criterion 1",
"Criterion 2",
"Typecheck passes"
],
"priority": 1,
"passes": false,
"notes": ""
}
]
}
Conversion Rules
- Each user story becomes one JSON entry
- IDs: Sequential (US-001, US-002, etc.)
- Priority: Based on dependency order (schema → backend → UI)
- All stories:
passes: falseand emptynotes - branchName: Derive from feature name, kebab-case, prefixed with
ralph/ - Always add: "Typecheck passes" to every story
- For UI stories: Add "Verify in browser using dev-browser skill"
Story Sizing is Critical
Each story MUST be completable in ONE Ralph iteration.
Right-sized stories:
- Add a database column and migration
- Add a UI component to an existing page
- Update a server action with new logic
- Add a filter dropdown to a list
Too big (must split):
- "Build the entire dashboard" → Split into: schema, queries, UI components, filters
- "Add authentication" → Split into: schema, middleware, login UI, session handling
Rule of thumb: If you cannot describe the change in 2-3 sentences, it is too big.
Story Ordering
Stories execute in priority order. Earlier stories must NOT depend on later ones.
Correct order:
- Schema/database changes (migrations)
- Server actions / backend logic
- UI components that use the backend
- Dashboard/summary views that aggregate data
Verification Before Proceeding
Before running Ralph, verify:
- [ ] Previous run archived (if applicable)
- [ ] Each story is completable in one iteration
- [ ] Stories are ordered by dependencies
- [ ] Every story has "Typecheck passes"
- [ ] UI stories have "Verify in browser using dev-browser skill"
- [ ] Acceptance criteria are verifiable (not vague)
Phase 2: Ralph Execution
Step 1: Pre-flight Checks
Verify the following before starting:
- Amp CLI installed
``bash which amp `` If not found, instruct user to install from https://ampcode.com
- jq installed
``bash which jq `` If not found, instruct user to install (brew install jq on macOS)
- Git working directory clean
``bash git status --porcelain `` If not clean, ask user to commit or stash changes
- prd.json exists and is valid
``bash cat prd.json | jq . `` If invalid, show error and exit
Step 2: Create or Checkout Feature Branch
Read branchName from prd.json:
jq -r '.branchName' prd.json
If branch doesn't exist, create it from main:
git checkout -b $(jq -r '.branchName' prd.json)
If branch exists, checkout it:
git checkout $(jq -r '.branchName' prd.json)
Step 3: Run Ralph Loop
Execute the Ralph script:
bash .claude/scripts/ralph.sh [max_iterations]
Default is 10 iterations. The script will:
- Spawn a fresh Amp instance with
.claude/scripts/prompt.md - Amp picks the highest priority story with
passes: false - Amp implements that single story
- Amp runs quality checks (typecheck, lint, test)
- If checks pass, Amp commits with message:
feat: [Story ID] - [Story Title] - Amp updates
prd.jsonto setpasses: truefor the story - Amp appends progress to
prd-progress.txt - Loop repeats until all stories pass or max iterations reached
Step 4: Monitor Progress
Show the user how to monitor:
# See which stories are done
cat prd.json | jq '.userStories[] | {id, title, passes}'
# See learnings from previous iterations
cat prd-progress.txt
# Check git history
git log --oneline -10
Step 5: Completion
When ALL stories have passes: true, Ralph will output:
COMPLETE
And the loop exits successfully.
Ralph's Inner Loop (What Happens During Execution)
Each iteration spawns a fresh Amp instance with instructions from .claude/scripts/prompt.md.
The Amp instance:
- Reads
prd.jsonto pick the next story - Reads
prd-progress.txtfor context - Implements that ONE story
- Runs quality checks
- Updates
AGENTS.mdfiles if patterns are discovered - Commits if checks pass
- Updates
prd.jsonto mark story complete - Appends learnings to
prd-progress.txt
Memory Between Iterations
The only memory between iterations:
- Git history (commits from previous iterations)
prd-progress.txt(learnings and context)prd.json(which stories are done)
Each iteration is a fresh Amp instance with clean context.
Key Files
| File | Purpose | |------|---------| | .claude/scripts/ralph.sh | The bash loop that spawns Amp instances | | .claude/scripts/prompt.md | Instructions given to each Amp instance | | prd.json | User stories with passes status | | prd-progress.txt | Append-only learnings log | | .claude/archive/ | Previous run archives |
Troubleshooting
Ralph stops mid-execution
Check prd-progress.txt for the last completed story, then resume:
# Just run ralph again, it will continue from where it left off
bash .claude/scripts/ralph.sh
Amp context fills up
Enable auto-handoff in ~/.config/amp/settings.json:
{
"amp.experimental.autoHandoff": { "context": 90 }
}
Story fails quality checks
Ralph won't commit broken code. Check:
prd-progress.txtfor errors- Git working directory for uncommitted changes
- Fix the issue and run Ralph again
Tips for Best Results
- Keep stories small - Each must complete in one context window
- Order by dependencies - Schema before backend before UI
- Verifiable criteria - "Typecheck passes" not "Works correctly"
- Clean git state - Start with a clean working directory
- Monitor progress - Check
prd-progress.txtand git log regularly
Example Session
User: /ralph tasks/prd-task-priority.md
Ralph Skill:
- Converting PRD to prd.json...
- Created prd.json with 4 user stories
- Checking prerequisites...
- Creating branch ralph/task-priority...
- Starting Ralph loop...
[Ralph executes iterations...]
Iteration 1: US-001 - Add priority field to database ✓
Iteration 2: US-002 - Display priority indicator on task cards ✓
Iteration 3: US-003 - Add priority selector to task edit ✓
Iteration 4: US-004 - Filter tasks by priority ✓
COMPLETE
All stories completed! Check prd-progress.txt for details.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: samqin123
- Source: samqin123/Claudeskill_pool
- License: Apache-2.0
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.