ratchet

ratchet is a skill for Claude Code from XRenSiu/claude-code-forge. It costs 286 tokens per session (6,366 once invoked), scanned A, original, MIT.

A skill for running a goal-driven coding task through repeated agent attempts and independent checks. It turns a desired result into machine-checkable acceptance rules, then continues until those rules are met.

In plain words
What is it for?
Use it to implement, optimise, or improve software until tests, benchmarks, or other stated checks pass, while limiting what the agents may change.
Why use it?
It helps with vague or lengthy engineering work where an agent may stop early, get stuck, or judge its own work inaccurately.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter. Also seen: mentions subagents.

Part of the ai-dlc plugin — 28 skills, 5 agents shipped together

Good fit Use it to implement, optimise, or improve software until tests, benchmarks, or other stated checks pass, while limiting what the agents may change.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/xrensiu/claude-code-forge/ratchet
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 XRenSiu/claude-code-forge --skill ratchet
Clone the repo
git clone --depth 1 https://github.com/XRenSiu/claude-code-forge

Made for: Claude Code.

Or install ai-dlc, the plugin that ships this one along with the rest of its 28 skills, 5 agents.

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 ratchet

README.md
[![agentmods](https://agentmods.dev/badge/skills/xrensiu/claude-code-forge/ratchet/github.svg)](https://agentmods.dev/skills/xrensiu/claude-code-forge/ratchet)
Your own site
<a href="https://agentmods.dev/skills/xrensiu/claude-code-forge/ratchet"><img src="https://agentmods.dev/badge/skills/xrensiu/claude-code-forge/ratchet/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 ratchet

Your own site · 80×15
<a href="https://agentmods.dev/skills/xrensiu/claude-code-forge/ratchet"><img src="https://agentmods.dev/badge/skills/xrensiu/claude-code-forge/ratchet.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 286 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,366 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.
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.00286 $0.06366
Opus 5 $0.00143 $0.03183
Sonnet 5 $0.00057 $0.01273
Haiku 4.5 $0.00029 $0.00637

Measured 3d ago against content hash fd4813cdbe22, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

ratchet 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 3d ago.

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.

plugins/ai-dlc/skills/ratchet/SKILL.md · 500 lines

How it starts

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

Ratchet — 目标驱动的棘轮优化系统

你是一个 Ratchet 编排者。接收用户的自然语言目标,设计验收标准, 然后启动 master/subagent 双智能体循环,持续迭代直到目标达成。

核心思想(三句话)

  1. 只定终点,不画路线 — 告诉 agent "做成什么样算完",不告诉它怎么做
  2. 裁判和选手分开 — master 只评估不干活,subagent 只干活不自评
  3. 卡住就换人 — subagent 不活跃或声称完成但未达标,杀掉重启一个新的

工作流总览

第一步:目标澄清        → 明确 Goal + 初步 Criteria
    ↓
第二步:Criteria 设计   → 把验收标准变成机器可判的条件
    ↓
第三步:生成 ratchet.md → 完整的实验协议 + 评估脚本 + 冻结文件清单
    ↓
第四步:启动棘轮循环     → master 驱动 subagent 迭代,独立评估,自动 kill/restart
    ↓
第五步:收尾交付        → 输出最终产物 + 实验报告

资源索引

生成 ratchet.md 之前,必须先读取以下参考文件:

  • references/ratchet-template.md — ratchet.md 模板,所有生成基于此
  • references/criteria-guide.md — Criteria 设计方法论(从模糊需求到硬判据)
  • references/examples/ — 完整示例,按场景选读:
    • example-compiler.md — 编译器/解释器类任务(差分测试 + fuzz)
    • example-api-service.md — Web API/服务开发(schema + property-based)
    • example-optimization.md — 性能/质量优化(硬指标 + 反向约束)

读取时机:第一步完成后、第三步生成前读取。


第一步:目标澄清

回答三个问题:

  • Q1 Goal:最终要达成什么?
  • Q2 Criteria:怎么判断达成了?(可机器验证的条件)
  • Q3 Scope:agent 可以动什么、不能动什么?

上下文采集

在分析之前,先了解用户的实际环境:

  1. 读取用户提到的文件/目录,理解代码结构和技术栈
  2. 检查是否已有测试、benchmark、CI 等可复用的评估基础设施
  3. 检查是否存在参考实现可用于差分测试(这是最强的 criteria)

解析用户输入

对 Q1/Q2/Q3 各标记清晰度:

Q1 Goal Q2 Criteria 动作
明确 明确(可机器验证) → 直接进入第三步
明确 有方向但模糊 → 进入第二步,设计 Criteria
有方向 任意 → 推断目标范围并确认
模糊 任意 → 列出 2-3 种拆解方向让用户选

追问规则

  • 一次最多 2 个问题,优先问 Q1
  • 永远带选项,不开放式提问
  • 如果信息足以推断,直接推断并确认

第一步产出:目标快照

Goal:[一句话描述最终目标]
Criteria(初步):[可验证条件,可能还需第二步精化]
Scope:[可修改范围 / 不可修改范围]
参考实现:[有/无,如有列出]

第二步:Criteria 设计

读取 references/criteria-guide.md,按其中的方法论设计 criteria。

核心流程(详见 criteria-guide.md):

  1. 逼问真目标 — 什么结果"看着好但其实不行"?
  2. 三段式拆解 — Given(输入假设) / When(触发动作) / Then(输出性质) + Invariant(不变量)
  3. ∀ 量化 — 用性质(property)代替用例(example),对着 5 大模式套: round-trip / invariant / idempotent / metamorphic / model-based oracle
  4. 软指标硬化 — 拆成硬指标的 AND 组合
  5. 防作弊自检 — 花 5 分钟想"agent 怎么偷懒也能过"

Criteria 的三个层级

Read the full file on GitHub · 500 lines

Files

What ships with it

7 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. 3d ago Changed · +22 lines fd4813cdbe22
  2. 7d ago First seen · 478 lines · 286 tokens per session scan A 7018d6f7f681

Subscribe to this mod's changes

ratchet is a skill published in the GitHub repository XRenSiu/claude-code-forge (2 stars, last pushed today), licensed MIT. It adds 286 tokens to every session and 6,366 once invoked, about $0.0014 per session on Opus 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-05.