/specs.ralph-loop
Ralph Loop orchestrator for spec-driven development (WHAT: runs the SDD state machine one step at a time). Use WHEN: automating the implement-review-fix-sync cycle for specification tasks.
$ npx -y skills add giuseppe-trisciuoglio/developer-kit --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/specs.ralph-loop
Context preview
What this command does when you run it.
Ralph Loop orchestrator for spec-driven development (WHAT: runs the SDD state machine one step at a time). Use WHEN: automating the implement-review-fix-sync cycle for specification tasks.
Command definition
specs.ralph-loop.mddescription: "Ralph Loop orchestrator for spec-driven development (WHAT: runs the SDD state machine one step at a time). Use WHEN: automating the implement-review-fix-sync cycle for specification tasks."
argument-hint: '[--wait|--background] [--spec <path>] [--action start|loop|next|status] [--from-task <id>] [--to-task <id>]'
allowed-tools: Read, Glob, Grep, Bash(python3:*), Bash(git:*), AskUserQuestion
Overview
The Ralph Loop applies the "Ralph Wiggum as a Software Engineer" technique to specification-driven development. It solves context window explosion by executing **one step per invocation**, persisting state in `fix_plan.json`.
State machine: `init → choose_task → implementation → review → [fix | escalate] → cleanup → sync → update_done → (loop)`
**States**:
- `fix`: Normal review feedback — implementation needs fixes (Ralph Loop)
- `escalate`: Design-level problem detected — requires returning to spec-to-tasks (Circuit Breaker)
- **Ralph Loop Circuit Breaker**: If the same issue persists for 3+ iterations, force `escalate` even if review says `needs_fix`
**State transitions**:
review_status = passed → cleanup
review_status = needs_fix → fix (if iteration < 3) OR escalate (if iteration >= 3)
review_status = partial → fix (if iteration < 3) OR escalate (if iteration >= 3)
review_status = escalate → escalate (always, regardless of iteration count)
Usage
# Initialize a new loop
/developer-kit-specs:specs.ralph-loop --action=start --spec=docs/specs/001-feature/ --from-task=TASK-001 --to-task=TASK-010
# Run one step (execute shown command, then run loop again)
/developer-kit-specs:specs.ralph-loop --action=loop --spec=docs/specs/001-feature/
# Advance state after executing the shown command
/developer-kit-specs:specs.ralph-loop --action=next --spec=docs/specs/001-feature/
# Check status
/developer-kit-specs:specs.ralph-loop --action=status --spec=docs/specs/001-feature/
Arguments
| Argument | Required | Description | |----------|----------|-------------| | `--action` | Yes | Action to perform: `start`, `loop`, `next`, `status` | | `--spec` | No | Path to spec folder (auto-detected from git branch if omitted) | | `--from-task` | No | Starting task ID (for `start` action) | | `--to-task` | No | Ending task ID (for `start` action) | | `--wait` | No | Run in foreground, wait for results | | `--background` | No | Run in background without prompting |
Current Context
If `--spec` is omitted, the spec folder is auto-detected from the current git branch:
branch=$(python3 "${CLAUDE_PLUGIN_ROOT}/scripts/current_branch.py")
spec_folder=$(python3 "${CLAUDE_PLUGIN_ROOT}/scripts/find_spec_from_branch.py")If no matching spec folder is found for the current branch, stop and inform the user.
Execution mode rules
- If the raw arguments include `--wait`, run in the foreground without asking.
- If the raw arguments include `--background`, run in the background without asking.
- Otherwise, use `AskUserQuestion` exactly once with two options, putting the recommended option first and suffixing its label with `(Recommended)`:
- `Run in background (Recommended)`
- `Wait for results`
Foreground flow
Run:
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/main.py $ARGUMENTSReturn the command stdout verbatim.
Background flow
Launch with `Bash` in the background:
Bash({
command: `python3 ${CLAUDE_PLUGIN_ROOT}/scripts/main.py $ARGUMENTS`,
description: "Ralph Loop",
run_in_background: true
})After launching, tell the user: "Ralph Loop started in the background."
Examples
# Initialize
/developer-kit-specs:specs.ralph-loop --action=start --spec=docs/specs/001-feature/ --from-task=TASK-001 --to-task=TASK-010
# Run one step
/developer-kit-specs:specs.ralph-loop --action=loop --spec=docs/specs/001-feature/
# Advance state after executing the shown command
/developer-kit-specs:specs.ralph-loop --action=next --spec=docs/specs/001-feature/
# Check status
/developer-kit-specs:specs.ralph-loop --action=status --spec=docs/specs/001-feature/
Read more
description: "Ralph Loop orchestrator for spec-driven development (WHAT: runs the SDD state machine one step at a time). Use WHEN: automating the implement-review-fix-sync cycle for specification tasks." argument-hint: '[--wait|--background] [--spec <path>] [--action start|loop|next|status] [--from-task <id>] [--to-task <id>]' allowed-tools: Read, Glob, Grep, Bash(python3:*), Bash(git:*), AskUserQuestion
Overview
The Ralph Loop applies the "Ralph Wiggum as a Software Engineer" technique to specification-driven development. It solves context window explosion by executing **one step per invocation**, persisting state in `fix_plan.json`.
State machine: `init → choose_task → implementation → review → [fix | escalate] → cleanup → sync → update_done → (loop)`
**States**:
- `fix`: Normal review feedback — implementation needs fixes (Ralph Loop)
- `escalate`: Design-level problem detected — requires returning to spec-to-tasks (Circuit Breaker)
- **Ralph Loop Circuit Breaker**: If the same issue persists for 3+ iterations, force `escalate` even if review says `needs_fix`
**State transitions**:
review_status = passed → cleanup review_status = needs_fix → fix (if iteration < 3) OR escalate (if iteration >= 3) review_status = partial → fix (if iteration < 3) OR escalate (if iteration >= 3) review_status = escalate → escalate (always, regardless of iteration count)
Usage
# Initialize a new loop /developer-kit-specs:specs.ralph-loop --action=start --spec=docs/specs/001-feature/ --from-task=TASK-001 --to-task=TASK-010 # Run one step (execute shown command, then run loop again) /developer-kit-specs:specs.ralph-loop --action=loop --spec=docs/specs/001-feature/ # Advance state after executing the shown command /developer-kit-specs:specs.ralph-loop --action=next --spec=docs/specs/001-feature/ # Check status /developer-kit-specs:specs.ralph-loop --action=status --spec=docs/specs/001-feature/
Arguments
| Argument | Required | Description | |----------|----------|-------------| | `--action` | Yes | Action to perform: `start`, `loop`, `next`, `status` | | `--spec` | No | Path to spec folder (auto-detected from git branch if omitted) | | `--from-task` | No | Starting task ID (for `start` action) | | `--to-task` | No | Ending task ID (for `start` action) | | `--wait` | No | Run in foreground, wait for results | | `--background` | No | Run in background without prompting |
Current Context
If `--spec` is omitted, the spec folder is auto-detected from the current git branch:
branch=$(python3 "${CLAUDE_PLUGIN_ROOT}/scripts/current_branch.py")
spec_folder=$(python3 "${CLAUDE_PLUGIN_ROOT}/scripts/find_spec_from_branch.py")If no matching spec folder is found for the current branch, stop and inform the user.
Execution mode rules
- If the raw arguments include `--wait`, run in the foreground without asking.
- If the raw arguments include `--background`, run in the background without asking.
- Otherwise, use `AskUserQuestion` exactly once with two options, putting the recommended option first and suffixing its label with `(Recommended)`:
- `Run in background (Recommended)`
- `Wait for results`
Foreground flow
Run:
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/main.py $ARGUMENTSReturn the command stdout verbatim.
Background flow
Launch with `Bash` in the background:
Bash({
command: `python3 ${CLAUDE_PLUGIN_ROOT}/scripts/main.py $ARGUMENTS`,
description: "Ralph Loop",
run_in_background: true
})After launching, tell the user: "Ralph Loop started in the background."
Examples
# Initialize /developer-kit-specs:specs.ralph-loop --action=start --spec=docs/specs/001-feature/ --from-task=TASK-001 --to-task=TASK-010 # Run one step /developer-kit-specs:specs.ralph-loop --action=loop --spec=docs/specs/001-feature/ # Advance state after executing the shown command /developer-kit-specs:specs.ralph-loop --action=next --spec=docs/specs/001-feature/ # Check status /developer-kit-specs:specs.ralph-loop --action=status --spec=docs/specs/001-feature/
Modular plugin marketplace for Claude Code and agentic CLIs, with validated, spec-driven skills, agents, commands, and workflows for Java, TypeScript, Python, PHP, AWS, and AI.
Repo: giuseppe-trisciuoglio/developer-kit
Other commands on developer-kit.
- /devkit.prompt-optimize
Provides expert prompt optimization using advanced techniques (CoT, few-shot, constitutional AI) for LLM performance enhancement. Use when you need to improve prompt quality or optimize LLM interactions.
Open command - /devkit.feature-development
Provides guided feature development capability with codebase understanding and architecture focus. Use when implementing a new feature from scratch.
Open command - /devkit.fix-debugging
Provides guided bug fixing and debugging capability with systematic root cause analysis. Use when encountering bugs, errors, or unexpected behavior.
Open command - /devkit.github.create-pr
Creates a GitHub pull request with branch creation, commits, and detailed description. Use when you need to submit changes for review.
Open command - /devkit.github.review-pr
Provides comprehensive GitHub pull request review with code quality, security, and best practices analysis. Use when reviewing a PR before merging.
Open command - /devkit.refactor
Provides guided code refactoring capability with deep codebase understanding, compatibility options, and comprehensive verification. Use when restructuring or improving existing code.
Open command

