Ratchet
Count ratchet: freezes a lint violation, suppression, check, performance or telemetry count at today's value as a checked-in CI ceiling (fails on rise…
от melodic-software★ 34 звезды на GitHub
Установить Ratchet в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Ratchet
Arguments. [<counter, rule or claim>]. e.g. /toolchain:ratchet the no-floating-promises rule
Purpose
Answers "how do we stop this count from growing while we pay it down?"
A new lint rule with 300 existing violations cannot fail the build today, and a rule that does not fail the build lets violation 301 in. A ceiling fixed at today's count fails the next change that adds one, while the existing ones are fixed at whatever pace the team picks. Each fix lowers the ceiling, so the count only moves down.
The check is scripts/ratchet.py (one standard-library file) and a number: no model runs in CI.
This skill writes the proposed files into the working tree and commits nothing. It never merges.
1. Take the counter
The counter arrives from one of five places:
| Source | What it hands over |
|---|---|
/performance:protect (if enabled) |
a verified counter: name, command, field, and the goal with its Correlation value |
the ratchet offer on a counting rung's proposal from /corrections:codify (if enabled) |
a lint rule, once it exists, whose violation count is above zero |
/code-metrics:audit-suppressions (if enabled) |
a command that prints the suppression count |
| the user, from a telemetry store | a command that queries one run's count and prints it |
/performance:target (if enabled) on slow checks |
a check count that grows with the repository: checks per hook stage or CI job, files a check scans, or test suites a change selects |
A check count holds a lane's growth where its duration cannot be held: a ceiling on files scanned or checks per stage fails the change that adds one, and the lane's speed is measured separately.
Each needs a command that prints a <field>=<number> token on stdout, run through the shell from
the repository root.
- Counters only. A wall-clock time, a latency percentile or a memory high-water mark moves with the host, so a ceiling on it fails at random and trains people to raise it. Refuse it and name a count that moves only when the code does (calls, queries, spawns, violations). When none exists, say so: there is nothing to ratchet yet.
- The command fails when its subject fails. A linter that cannot parse its config reports no violations; a crashed program spends fewer calls. Either one passes any ceiling. Make the command exit non-zero in that case: check the linter's own exit status, or filter on the subject's status.
- Measure in CI's state. A count behind a cache reads lower on a warm machine than on a fresh runner. Pin the cache state in the command (unset or empty its location) before measuring.
2. The lint rollout rule
A lint rule lands at error severity. Run the command once and take the first path that fits:
- Zero lands the rule. A lint count of
0needs no ceiling: turn the rule on at error severity in the linter's config so the build fails on the first violation, and stop. Report that the rule landed and that no ceilings entry was written. - A mechanical fix gets a codemod, then error. When the linter's autofix or a codemod rewrites every violation with no judgment call, run it across the repository in the same change and turn the rule on at error severity. No ceiling.
- Otherwise, a per-file baseline at error severity. The rule runs at error severity, and each file may keep only the violations it has today, so a fix in one file never pays for a new violation in another. When the linter has a native per-file baseline, use it and write no ceilings entry: the linter fails a new violation itself. When it has none, record a per-file counter (section 4) whose command runs the rule at error severity.
Warn severity is only a dated step. A rule may run at warn severity only on the way to one of
the paths above, and its ceilings entry's --goal ends with the date it moves to error (warn until <YYYY-MM-DD>, then error). A warn rule with no end date is a rule nobody enforces.
Native per-file baselines, read live from each linter's own docs:
| Linter | Pointer |
|---|---|
| ESLint | Bulk Suppressions, Suppressions File |
| PHPStan | The Baseline, Generating the baseline |
A linter not in the table: read its docs for a checked-in per-file baseline before falling back to the ratchet.
A suppression count of 0 lands the same way only when the tool has a rule that forbids the
suppression comment itself (for example an ESLint rule that reports every disable directive): turn
that rule on at error severity. When no such rule exists, nothing in the linter fails on the first
new suppression, so ratchet the count at 0 like any other counter.
A counter from /performance:protect (if enabled) with a value of 0 is also ratcheted at 0, since no linter
stands behind it.
On the per-file path with no native baseline, run the
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
- 01
Bash(python3 ${CLAUDE_SKILL_DIR}/scripts/ratchet.py:*) - 02
Bash(python3 "${CLAUDE_SKILL_DIR}/scripts/ratchet.py":*) - 03
Bash(git grep:*) - 04
Bash(git ls-files:*)
Вложенные файлы
- reference/zero-entries.md
- scripts/ratchet.py
- scripts/suppression-scan.py
FAQ
Что делает скилл Ratchet?
Count ratchet: freezes a lint violation, suppression, check, performance or telemetry count at today's value as a checked-in CI ceiling (fails on rise, lowered as count falls). Counters only, never durations; proposes files for human merge. Use when: 'ratchet' lint rule or suppressions, freeze a violation count, or 'stop this count from growing'.
Как установить скилл Ratchet?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Ratchet запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
ci-review
AnthropicThe scan that the plugin's GitHub Action runs.
azure-static-web-apps
GitHubHelps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
ai-ready
GitHubMake any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
aws-cdk-python-setup
GitHubSetup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…