ralph
Interactive feature builder with subagent delegation and approval gates.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Interactive feature builder with subagent delegation and approval gates.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Interactive agent builder: guides the user through defining a new agent as a behavioral spec, then generates the agent .md and installs it.
Cross-repo investigation: research planning issues, break down into sub-issues, generate ralph session prompts per repo.
Three-phase QA orchestrator: parallel scan, interactive triage, guided fix.
Interactive rule builder: guides the user through defining a new rule as a constraint doc, then generates the rule .md and installs it.
Interactive skill builder: guides the user through defining a new skill as a structured SOP, then generates the SKILL.md and installs it.
Review code changes for architectural issues — module boundaries, coupling, and dependency direction.
| name | ralph |
| description | Interactive feature builder with subagent delegation and approval gates. |
Orchestrates feature development across multiple user stories. Spawns specialized subagents for exploration, planning, implementation, and review — with human approval gates between phases.
Replaces the old ralph.sh bash loop with an interactive, token-efficient approach that runs inside the user's session.
--issues N,N — build from specific GitHub issues--label X — build from issues with that label--prd path/to/prd.json — use an existing PRD--auto — auto-approve gates (CI mode, skip approval prompts)Read $ARGUMENTS and determine the input mode.
If no prd.json exists (and --prd not provided):
Fetch issues via gh CLI:
--issues N,N → gh issue view <N> --json number,title,body,labels,milestone--label X → gh issue list --label "X" --state open --json number,title,body,labelsDecompose issues into user stories with strategy mapping:
| Story type | Strategy |
|---|---|
| Simple feature, <= 3 criteria | tdd-workflow |
| Database/schema changes | migration-safety |
| Touches multiple modules | cross-module |
| Payment/subscription logic | billing-security |
| AI/LLM prompt changes | ai-prompt-design |
| Multi-step user flow | user-flow |
Order stories: backend before frontend, migrations before code, core before UI
Write prd.json following tools/ralph/prd.json.example schema
APPROVAL GATE: Show the PRD to the user (story count, order, strategies). Wait for approval before proceeding. In --auto mode, skip this gate.
If prd.json exists (or --prd provided): read it directly.
.claude-toolkit.json for project config (test/lint commands, MCP servers).claude/agents/ for available domain agents (filenames map to labels)CLAUDE.md for project conventionsralph/<slug>progress.txt if not present:
# Progress Log
Started: <date>
---
Process each story in priority order where passes == false and stuck != true.
For each story, run five phases:
Explore the codebase area relevant to this story.
Task(subagent_type="planner"):
"Explore the codebase to understand: <story title>.
Focus on: <acceptance criteria summary>.
Return: affected files, existing patterns, relevant tests, dependencies."
Domain Agent Discovery: If the story's labels match a filename in .claude/agents/ (e.g., label billing matches billing.md), also spawn that domain agent:
Task(subagent_type=<matched-agent>):
"Provide domain-specific context for: <story title>.
Story details: <acceptance criteria>."
Contract Truth Verification (blockchain projects only): If the story has a blockchain or solidity label, or the project has a blockchain domain agent, spawn a verification step:
Task(subagent_type=<blockchain-domain-agent>):
"List what the smart contract interface actually supports.
Compare against the story requirements: <acceptance criteria>.
Flag any mismatches — features the contract doesn't support,
missing functions, or incompatible return types."
This prevents hallucinating features the contract doesn't support. Any mismatches must be resolved before proceeding to Phase 2.
Summarize findings in < 500 words. This summary is passed forward to Phase 2.
Generate an implementation plan.
Task(subagent_type="planner"):
"Plan implementation for: <story title>.
Context from exploration: <Phase 1 summary>.
Acceptance criteria: <list>.
Constraints: TDD mandatory, conventional commits, one story only.
Return: ordered steps, files to change, test strategy, risks."
Present the plan to the user.
APPROVAL GATE: Ask the user to approve, revise, or skip this story.
In --auto mode: auto-approve.
Execute the approved plan using TDD.
For standard stories:
Task(subagent_type="tdd-guide"):
"Implement the following plan with strict TDD (test first):
Plan: <approved plan from Phase 2>.
Test command: <from .claude-toolkit.json or auto-detected>.
Lint command: <from .claude-toolkit.json or auto-detected>.
Acceptance criteria: <list>.
IMPORTANT: Write failing tests first, then implement, then refactor.
Commit with conventional format referencing issue #N."
For complex stories (cross-module, migration-safety, or stories that failed once with tdd-guide):
Task(subagent_type="planner"):
"Implement this plan. The story is complex — consider architecture implications.
Plan: <approved plan from Phase 2>.
Test/lint commands: <from config>.
Acceptance criteria: <list>.
TDD is mandatory. Commit with conventional format referencing issue #N."
If the agent reports failures after implementation, retry once with the error context. If still failing after 2 total attempts, mark the story as stuck.
Review the changes made in Phase 3.
Task(subagent_type="code-reviewer"):
"Review the changes for story: <title>.
Focus on: correctness, error handling, test coverage, style.
Changed files: <list from Phase 3>."
If the story touches auth, payments, user data, or secrets:
Task(subagent_type="security-reviewer"):
"Security review for story: <title>.
Focus on: OWASP top 10, auth bypass, data exposure.
Changed files: <list from Phase 3>."
Present review findings to the user.
APPROVAL GATE: Ask the user to approve, request fixes, or skip.
In --auto mode: auto-approve if no CRITICAL findings. If CRITICAL findings exist, pause and present to user regardless.
Commit (if not already committed by tdd-guide):
git add <specific files>
git commit -m "<type>(<scope>): <description>
Closes #<issue>
Co-Authored-By: Claude <noreply@anthropic.com>"
Update prd.json: Set passes: true for the completed story, increment iterations.
Append to progress.txt:
## [Date] - [Story ID]: [Title]
- Implemented: <summary>
- Files changed: <list>
- Tests: <what was added>
---
Save deep-think checkpoint (if MCP available):
checkpoint(operation="save", name="<story-id>")
On stuck stories: Set stuck: true and stuckReason in prd.json. Log the reason in progress.txt. Move to next story.
When all stories are either passes: true or stuck: true:
Story | Status | Iterations
---------|-----------|----------
US-001 | DONE | 1
US-002 | DONE | 2
US-003 | STUCK | 2 (reason)
gh issue create --title "<story title>" --body "<context>" --label "claude-ready"
| File | Purpose |
|---|---|
prd.json | Story definitions, status, strategy assignments |
progress.txt | Human-readable log, codebase patterns section |
| Deep-think checkpoints | Reasoning state per story (if MCP available) |