Agent skill
loop
Execute task with Ralph Loop pattern: Execute -> Validate -> Iterate until VERIFIED_DONE. Enforces iteration limits per model (Claude: 25, MiniMax: 50, MiniMax-lightning: 100). Use when: (1) iterative fixes needed, (2) running until quality passes, (3) automated task completion. Triggers: /loop, 'loop until done', 'iterate', 'keep trying', 'fix until passing'.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/loop
SKILL.md
Loop - Ralph Loop Pattern
Execute -> Validate -> Iterate until VERIFIED_DONE.
Quick Start
/loop "fix all type errors"
/loop "implement tests until 80% coverage"
ralph loop "fix lint errors"
Pattern
EXECUTE
|
v
+---------+
| VALIDATE |
+---------+
|
Quality YES +---------------+
Passed? --------> | VERIFIED_DONE |
| +---------------+
| NO
v
+---------+
| ITERATE | (max iterations)
+---------+
|
+-------> Back to EXECUTE
Iteration Limits
| Model | Max Iterations | Use Case |
|---|---|---|
| Claude (Sonnet/Opus) | 25 | Complex reasoning |
| MiniMax M2.1 | 50 | Standard tasks |
| MiniMax-lightning | 100 | Extended loops |
Workflow
1. Execute Task
# Attempt implementation
Edit/Write/Bash as needed
2. Validate
# Run quality gates
ralph gates
3. Check & Iterate
# If validation fails and under limit
iteration += 1
if iteration <= MAX:
continue # Back to Execute
else:
report "Max iterations reached"
Loop Types
Fix Loop
/loop "fix all type errors"
Repeatedly fix errors until build passes.
Coverage Loop
/loop "increase test coverage to 80%"
Add tests until coverage target met.
Lint Loop
/loop "fix all lint warnings"
Fix lint issues until clean.
Build Loop
/loop "fix build errors"
Fix compilation errors until success.
Exit Conditions
Success (VERIFIED_DONE)
- Quality gates pass
- Tests pass
- No remaining errors
Failure (MAX_ITERATIONS)
- Iteration limit reached
- Report remaining issues
- Ask user for guidance
Manual Exit
- User interrupts
- Critical error detected
- Deadlock detected
Integration
- Core pattern for all Ralph tasks
- Used by /orchestrator in Step 5
- Hooks enforce limits automatically
Anti-Patterns
- Never exceed iteration limits
- Never loop without validation step
- Never ignore failing tests
- Never loop on same error repeatedly (detect deadlock)
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?