ralph-loop

ralph-loop is a skill for Claude Code, Codex from magic3007/dotfiles. It costs 63 tokens per session (3,203 once invoked), scanned A, original, MIT.

An iterative development workflow that moves from requirements to planning to building, with code review and tests required at each stage.

In plain words
What is it for?
Use it to interview the user about a task, plan a system, or build it through repeated review and testing.
Why use it?
It breaks large development tasks into checkpoints so unclear requirements or failing work are caught before the next phase.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: names the AskUserQuestion tool; mentions Claude Code; mentions AGENTS.md.

Good fit Use it to interview the user about a task, plan a system, or build it through repeated review and testing.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/magic3007/dotfiles/ralph-loop
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add magic3007/dotfiles --skill ralph-loop
Clone the repo
git clone --depth 1 https://github.com/magic3007/dotfiles

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ralph-loop

README.md
[![agentmods](https://agentmods.dev/badge/skills/magic3007/dotfiles/ralph-loop/github.svg)](https://agentmods.dev/skills/magic3007/dotfiles/ralph-loop)
Your own site
<a href="https://agentmods.dev/skills/magic3007/dotfiles/ralph-loop"><img src="https://agentmods.dev/badge/skills/magic3007/dotfiles/ralph-loop/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for ralph-loop

Your own site · 80×15
<a href="https://agentmods.dev/skills/magic3007/dotfiles/ralph-loop"><img src="https://agentmods.dev/badge/skills/magic3007/dotfiles/ralph-loop.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,203 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00063 $0.03203
Opus 5.5 $0.00025 $0.01281
Sonnet 5.5 $0.00013 $0.00641
Haiku 4.5 $0.00006 $0.00320

Measured 15d ago against content hash 0cb1f7116d54, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

ralph-loop scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 15d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (templates/loop.sh), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/ralph-loop/SKILL.md · 331 lines

How it starts

The opening of the file, as written. The whole thing — 331 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Ralph Loop v2 (Claude Code Edition)

基于 Geoffrey Huntley 的 Ralph Wiggum 技术的自主迭代开发。

核心: 每个阶段有强制 code review + 测试 gate,不通过不进下一阶段。


触发短语

短语 动作
"Ralph loop over X" 问走哪个阶段
"Interview me about X" Phase 1: 需求收集
"Plan system X" Phase 2: 规划循环
"Build system X" Phase 3: 构建循环

核心原则

  1. Context 是稀缺的 — 每次迭代做合理的一块工作,不贪多也不过少
  2. 你只是任务中的一环 — loop.sh 驱动迭代,每次 CLI 调用是独立的 context,做完合理粒度就退出
  3. 计划是一次性的 — 跑偏了重新规划,不硬撑
  4. 背压 > 方向 — 测试 + review 自动拒绝错误输出
  5. 每阶段有 gate — code review + 测试通过才能推进

三阶段工作流

Phase 1: REQUIREMENTS ──── 人机对话 → specs/*.md
    Gate: 用户确认所有 spec

Phase 2: PLANNING ──────── 差距分析 → IMPLEMENTATION_PLAN.md
    Gate: Plan review + 验证(命令存在、路径有效)

Phase 3: BUILDING ──────── 迭代实现 → test → Codex review → commit
    Gate: 测试通过 + Codex cross-review(完成时)

阶段检测

当前状态 阶段 动作
没有 specs/ 或为空 Phase 1 跑需求访谈
有 specs/*.md,没有 IMPLEMENTATION_PLAN.md Phase 2 跑规划循环
有 spec + plan Phase 3 跑构建循环
Plan 显示全部完成 Done 汇报

Phase 1: 需求收集(人机对话)

目标: JTBD → Topics → specs/*.md

  1. 识别 Jobs to Be Done(结果,不是功能)
  2. 拆分成 Topics — 每个通过「一句话不带 AND」测试
  3. 写 specs/<topic>.md,包含验收标准 + 边界情况
  4. Gate: 用户明确确认所有 spec

Phase 1→2 过渡:初始化 .ralph/

Phase 1 specs 确认后,立即初始化 .ralph/ 目录:

  1. 收集配置信息(用 AskUserQuestion):

    • CLI 工具:claude / codex / opencode / goose(默认 claude)
    • 背压命令:如 npm test && npm run typecheck && npm run lint
    • 最大迭代次数:默认 0(无限)
  2. 用 cp 复制模板文件到项目的 .ralph/,然后在副本上编辑(不要读模板再重写!):

    mkdir -p .ralph/state
    cp /path/to/skill/templates/loop.sh .ralph/loop.sh
    cp /path/to/skill/templates/PROMPT_plan.md .ralph/PROMPT_plan.md
    cp /path/to/skill/templates/PROMPT_build.md .ralph/PROMPT_build.md
    chmod +x .ralph/loop.sh
    

    模板源路径: 此 skill 基础目录下的 templates/

  3. 在复制后的文件上替换占位符:

    • .ralph/loop.sh 中替换 {{CLI}}、{{MODE}}、{{MAX_ITERS}}、{{BACKPRESSURE_CMD}}
    • .ralph/PROMPT_plan.md 中替换 [PROJECT_GOAL] 和源码路径
    • .ralph/PROMPT_build.md 中替换源码路径

Read the full file on GitHub · 331 lines

Files

What ships with it

6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 15d ago Changed · -17 lines 0cb1f7116d54
  2. 1mo ago First seen · 348 lines · 63 tokens per session scan A e8672b69403f

Subscribe to this mod's changes

ralph-loop is a skill published in the GitHub repository magic3007/dotfiles (11 stars, last pushed today), licensed MIT. It adds 63 tokens to every session and 3,203 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

test-code

Testing philosophy, test types (unit, integration, golden, fuzz, property, benchmark, smoke, E2E), per-language conventions (Rust, Go, Python, TypeScript), file organization, fixtures/mocks, CI strategy, and what NOT to test. Use when writing tests, reviewing test coverage, setting up test infrastructure, or deciding…

urmzd/dotfiles · 101 tokens

run-eval-harness

Run a project's own eval suite end to end without babysitting: locate the harness, launch it in the background, monitor to completion, parse the report into a normalized summary (pass rate, latency percentiles, tokens, cost), and diff against the previous run with per-case regressions explained. Use when asked to "run…

urmzd/dotfiles · 134 tokens

design

Design the type progression, assertion plan, telemetry plan and test plan for approved work. Invoke after agreeing on the high-level approach and before writing any implementation.

ooloth/dotfiles · 33 tokens

review-completion

Confirm a task was fully executed and the change works — static completeness audit followed by empirical runtime evidence. TRIGGER when asked to confirm a task is complete, prove it works, or verify a change is ready to ship.

ooloth/dotfiles · 48 tokens

validate

Confirm we have actually completed and validated what we planned to accomplish. TRIGGER whenever the user asks you to confirm a task is complete, if any implementation or validation was missed, etc.

ooloth/dotfiles · 39 tokens

prove-it-works

Survey observable paths, run the real system, capture evidence, and surface gaps. TRIGGER when asked to prove a change works or write a QA plan.

ooloth/dotfiles · 36 tokens