0xwilliamortiz/ratchet
> Enforces a measured complexity budget on coding work. Reaches for the standard library, native platform features and code that already exists in the repository before writing anything new, and treats every added dependency, file and line as a cost that has to be justified. A hook measures the real diff and reports overruns back mid-task, so the budget is fixing, reviewing, choosing libraries, or designing an interface. Use it whenever the user says "ratchet", "keep it minimal", "simplest thing that works", "yagni", "don't over-engineer", "smallest diff", or complains about bloat, boilerplate, scaffolding or dependency creep. Do not use it for non-coding requests.
npx skills add https://github.com/0xwilliamortiz/ratchet --skill ratchet
A ratchet turns one way. The complexity of this codebase goes down or stays
flat unless someone deliberately turns it the other way and says why.
The budget applies to the solution, never to the reading. Before choosing an
approach, read the code the change touches and trace the actual flow end to
end, including the callers you did not open. A small diff in the wrong place
is not a small change, it is a second bug that is now harder to find.
Say plainly when you do not yet understand something well enough to shorten
it. That sentence costs less than a confident wrong patch.
Stop at the first rung that holds.
<input type="date"> over a picker library, <dialog> over a modal library, a CSS property over a JS listener, a database constraint over application code.A report names a symptom. Find the function every affected path routes
through and fix it once. Grep the callers before editing: one guard in the
shared function is both the correct fix and the smaller diff, and patching
only the path named in the ticket leaves the sibling callers broken.
Each of these is measured by the hook and reported back to you. None of them
is forbidden. All of them need a reason stated in the same response.
Findings arrive graded, and the grade tells you how much to trust them:
certain is parsed, not guessed. A dependency name read out of a manifest, an import of a named package. Treat it as fact.likely is structural. A function that forwards and nothing else, an interface with one implementation. Usually right, occasionally reading a stub or a deliberate seam.heuristic is shape matching. Often right, sometimes catching a lookalike. Judge it on the code in front of you.When a finding is wrong, say so in one line and move on. It is a detector, not
an authority. What is not acceptable is silently ignoring a flag.
When it is wrong for a reason that will keep being true, silence it where it
lives rather than arguing every time:
// ratchet-ignore: profiled, the clone is the hot path
const copy = JSON.parse(JSON.stringify(frame));
That covers the line the comment sits on and the line after it. A repository
that has been baselined already ignores everything that existed before the
ratchet was installed, so anything you see is something this session did.
When you knowingly ship something with a ceiling, mark it where it lives:
# ratchet: single global lock, split per account if write throughput matters
The comment names the ceiling and the trigger to revisit. /ratchet-ledger
collects these, so a deferral cannot quietly become permanent.
Never trade these away for a smaller diff:
assert based self check or a single small test file. The smallest thing that fails when the logic breaks. No frameworks, no fixtures, no suite per function. Trivial one-liners need none.Code first. Then at most three short lines: what you left out, and the
condition that should bring it back. If the explanation runs longer than the
code, the explanation is the thing to cut. A paragraph defending a
simplification is complexity smuggled back in as prose.
Explanation the user asked for is not overhead. Give it in full.
| Mode | New files | New deps | Added lines | On overrun |
|------|-----------|----------|-------------|------------|
| advise | 8 | 3 | 400 | findings only |
| guard | 3 | 1 | 150 | findings and budget warnings |
| strict | 1 | 0 | 60 | blocked on a certain finding or an overrun |
Default is guard. Switch with /ratchet advise|guard|strict|off. Per
project overrides live in .ratchet/config.json.
Ratchet governs what gets built, not how you talk. Off with stop ratchet.
Take 0xwilliamortiz/ratchet from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.