Agent skill

Coverage Ratchet

by rshankras in rshankras/claude-code-apple-skills

Gate test coverage with a ratchet — a committed baseline that coverage may never drop below and only ever rises.

MITAuto-check: notesTesting & QA

Install Coverage Ratchet

skills CLI
$ npx skills add rshankras/claude-code-apple-skills --skill coverage-ratchet -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install rshankras/claude-code-apple-skills coverage-ratchet --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/rshankras/claude-code-apple-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/testing/coverage-ratchet .claude/skills/coverage-ratchet && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
coverage-ratchet
GitHub stars
785
Token cost
~1.1k tokens
SKILL.md length
495 words
Files
3
Skills in repo
41
Repo updated
First seen
Licence
MIT

At a glance

Gate test coverage with a ratchet — a committed baseline that coverage may never drop below and only ever rises.

  • Works in 3 steps: Copy templates/coverage-gate.sh into the… → Bootstrap the baseline → Commit both the script and…
  • Agent-written code needs a deterministic tests were actually written check
  • SKILL.md covers Why a Ratchet, Not a Target, When This Skill Activates, Setup and The Gate, plus 3 more sections
  • Runs Shell scripts from its folder

What it does

Coverage Ratchet is an agent skill from rshankras/claude-code-apple-skills. Gate test coverage with a ratchet — a committed baseline that coverage may never drop below and only ever rises. Ships a coverage-gate script (xccov-based) plus an advisory CRAP report (complexity × uncovered). Use when agent-written code needs a deterministic "tests were actually written" check.

Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files (for example `templates/coverage-gate.sh` and `templates/crap-report.sh`).

It sits in Testing & QA, covering Test coverage. The repository describes itself as: Claude Code skills for Apple platform development (iOS, macOS, iPadOS) — product validation, code generation, App Store optimization, and more. The licence is MIT.

When your agent uses it

  • Agent-written code needs a deterministic tests were actually written check
  • Tasks that involve Test coverage

Example prompts

  • “tests were actually written”
  • “/coverage-ratchet”

Requirements

  • A Bash shell
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Glob, Grep, Bash

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Copy templates/coverage-gate.sh into the project (e.g. Scripts/coverage-gate.sh), make it executable, and fill in the config block…
  2. Bootstrap the baseline
  3. Commit both the script and .coverage-baseline.

What it can do on your machine

Read from SKILL.md and the folder at commit 9ffb831. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Glob
    • Grep
    • Bash

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Shell), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Coverage Ratchet loads about 1.1k tokens when it runs. Until then it costs about 79 tokens; SKILL.md has 495 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~79
When it runs · the whole SKILL.md, loaded when a task matches
~1.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Read, Write, Edit, Glob, Grep, Bash

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from rshankras/claude-code-apple-skills at commit 9ffb831, republished under its MIT licence (© rshankras). 495 words, ~1,090 tokens.

Download SKILL.mdSave it as .claude/skills/coverage-ratchet/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
coverage-ratchet
description
Gate test coverage with a ratchet — a committed baseline that coverage may never drop below and only ever rises. Ships a coverage-gate script (xccov-based) plus an advisory CRAP report (complexity × uncovered). Use when agent-written code needs a deterministic "tests were actually written" check.
allowed-tools
Read, Write, Edit, Glob, Grep, Bash
last_verified
2026-07-24
review_by
2027-07-01

Coverage Ratchet

A build/test gate proves the tests that exist pass. It says nothing about whether tests were written — a phase with no test task ships green on build success alone. The coverage ratchet closes that hole deterministically: line coverage is measured on every verify, compared against a committed baseline, and may never drop. It only rises.

Why a Ratchet, Not a Target

An absolute threshold ("80%") fails one of two ways on a real codebase: it fails day one (so it gets disabled), or it gets set below current reality (so it gates nothing). A ratchet starts from wherever the project actually is and only tightens. Nobody argues with "don't get worse."

When This Skill Activates

Use this skill when:

  • A project has a test target but coverage has never been measured
  • Agent-written features keep arriving with build-passing, test-free code
  • Setting up the deterministic gauntlet (with testing/fitness-functions/ and swift/code-size/)

Setup

  1. Copy templates/coverage-gate.sh into the project (e.g. Scripts/coverage-gate.sh), make it executable, and fill in the config block (scheme, destination, app target name).
  2. Bootstrap the baseline:
bash
Scripts/coverage-gate.sh --init     # runs tests with coverage, writes .coverage-baseline
  1. Commit both the script and .coverage-baseline.

.coverage-baseline holds a single decimal fraction (e.g. 0.6231) — the app target's line coverage. Trailing whitespace ignored; nothing else in the file.

The Gate

bash
Scripts/coverage-gate.sh            # exit 0 = pass, exit 1 = coverage dropped
  • Runs the test suite with coverage enabled, extracts the app target's line coverage from the xccov JSON report.
  • Fails if current < baseline − 0.0025 (the epsilon absorbs measurement jitter from unchanged code).
  • Suggests a ratchet-up when current > baseline + 0.01: update .coverage-baseline to the new number in the same commit as the tests that earned it. That's the ratchet clicking forward.
  • Fails loudly on an unexpected report shape or a missing target — a broken measurement must never read as a pass.

Ratchet-up etiquette: raising the baseline is routine and encouraged; lowering it requires a written reason in the commit message (e.g. deleting a well-covered module) — treat it like widening a fitness-function allowlist.

Show full SKILL.md (178 more words)Show less

CRAP Report (Advisory)

templates/crap-report.sh combines per-function cyclomatic complexity (SwiftLint JSON output) with per-function coverage (the same xccov report) into the CRAP score — Change Risk Anti-Patterns:

CRAP(f) = complexity(f)² × (1 − coverage(f))³ + complexity(f)

A complex and untested function scores explosively; simple-and-tested stays near its complexity. The report prints the top 20 — the exact functions where a test is worth the most. Advisory only, never a gate: the name-join between the two tools is heuristic.

Common Pitfalls

PitfallProblemSolution
Absolute threshold on existing codeFails day one or gates nothingRatchet from measured reality
Gating total project coverageTest-target/generated code pollutes the numberGate the app target's own lineCoverage
Silent pass on tool failureBroken measurement reads as greenScript fails loudly on unexpected JSON
Chasing the number with assertion-free testsCoverage without verificationPair with mutation spot-checks (testing/mutation-testing/)
Never ratcheting upBaseline fossilizes at day-one levelRaise it in the same commit as new tests

References

  • testing/mutation-testing/ — do the covering tests actually assert anything (advisory)
  • swift/code-size/ — the complexity half; small functions are coverable functions
  • testing/fitness-functions/ — architecture invariants as tests
  • generators/ci-cd-setup/ — CI wiring for the gate

© rshankras, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files in skills/testing/coverage-ratchet of rshankras/claude-code-apple-skills.

  • SKILL.md
  • templates/coverage-gate.sh
  • templates/crap-report.sh

Open the folder on GitHubat commit 9ffb831

Compare with similar skills

Coverage Ratchet next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Coverage Ratchet compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Coverage Ratchet this skillrshankras/claude-code-apple-skills785—~1.1kAutomated safety check: NotesMIT
Requirementsrizsotto/Bear6.5k—~2kAutomated safety check: PassGPL-3.0
Crap Analysisardalis/RiverBooks1352 repos~3.4kAutomated safety check: PassNone
Code Coverages3s-project/s3s311—~789Automated safety check: PassApache-2.0
Project Statusbactopia/bactopia522—~787Automated safety check: PassMIT
Check Coverageldayton/Dippy243—~403Automated safety check: PassMIT

Similar skills

  • Requirements

    rizsotto/Bear

    Write, modify, or review a requirement file under docs/requirements -- pick the single owning file, keep the text contract-only, name IDs so they need no explanation, and verify cross-references and…

    6.5k GitHub stars~2k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Crap Analysis

    ardalis/RiverBooks

    Analyze code coverage and CRAP (Change Risk Anti-Patterns) scores to identify high-risk code.

    135 GitHub starsUsed in 2 repos~3.4k tokens
    Testing & QAAuto-check passed
  • Code Coverage

    s3s-project/s3s

    Measure and grow the line coverage of the s3s crate. An agent skill from s3s-project/s3s.

    311 GitHub stars~789 tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Project Status

    bactopia/bactopia

    Show a live snapshot of the Bactopia project state — component counts, GroovyDoc coverage, nf-test coverage, and structural issues.

    522 GitHub stars~787 tokensUpdated 2 mo ago
    Testing & QAAuto-check passed
  • Check Coverage

    ldayton/Dippy

    Ensure comprehensive test coverage for a CLI handler. An agent skill from ldayton/Dippy.

    243 GitHub stars~403 tokensUpdated 3 mo ago
    Testing & QAAuto-check passed
  • Guarding Destructive Operations

    kajisho5/ffmpeg-skill

    Add and review preconditions on operations that delete, overwrite, rewrite history, or resolve a caller-supplied name to a filesystem path — refusing instead of warning, placing the guard ahead of…

    1.9k GitHub stars~2.6k tokensUpdated 4 days ago
    Testing & QAAuto-check passed

More from rshankras/claude-code-apple-skills

All 41 skills in this repo
  • Accessibility Generator

    rshankras/claude-code-apple-skills

    Generate accessibility infrastructure for VoiceOver, Dynamic Type, and accessibility features.

    785 GitHub stars~1.4k tokensUpdated 2 mo ago
    Auto-check: notes
  • Animation Patterns

    rshankras/claude-code-apple-skills

    SwiftUI animation patterns including springs, transitions, PhaseAnimator, KeyframeAnimator, SF Symbol effects, scroll-driven effects, mesh gradients, text renderers, and shader effects.

    785 GitHub stars~2.1k tokensUpdated 2 mo ago
    Auto-check passed
  • App Description Writer

    rshankras/claude-code-apple-skills

    Generate compelling App Store descriptions that convert browsers into users.

    785 GitHub stars~1.3k tokensUpdated 2 mo ago
    Auto-check passed
  • App Icon Generator

    rshankras/claude-code-apple-skills

    Generates an app icon for macOS or iOS — a fast CoreGraphics placeholder and/or flat layered source art to finish in Icon Composer (the Liquid Glass / iOS 26+ standard).

    785 GitHub stars~5.1k tokensUpdated 2 mo ago
    Auto-check: notes
  • App Namer

    rshankras/claude-code-apple-skills

    Turn an app idea into validated, App-Store-ready name candidates.

    785 GitHub stars~3.4k tokensUpdated 2 mo ago
    Auto-check passed
  • Bundles And Licensing

    rshankras/claude-code-apple-skills

    Revenue beyond the single-app price tag — own-app bundles, Family Sharing as a conversion lever, cross-developer bundles & suites, and institutional licensing via Group Purchases / Apple School &…

    785 GitHub stars~1.8k tokensUpdated 2 mo ago
    Auto-check passed

Categories

Questions about Coverage Ratchet

What does Coverage Ratchet do?

Gate test coverage with a ratchet — a committed baseline that coverage may never drop below and only ever rises. Coverage Ratchet is an agent skill from rshankras/claude-code-apple-skills. Gate test coverage with a ratchet — a committed baseline that coverage may never drop below and only ever rises.

When should I use Coverage Ratchet?

Coverage Ratchet fits situations like: agent-written code needs a deterministic tests were actually written check; tasks that involve Test coverage.

How do I install Coverage Ratchet in Claude Code?

Run `npx skills add rshankras/claude-code-apple-skills --skill coverage-ratchet -a claude-code`. Or copy the skill folder (skills/testing/coverage-ratchet in rshankras/claude-code-apple-skills) into .claude/skills/coverage-ratchet in your project. Claude Code loads it when a task matches its description.

How do I install Coverage Ratchet in Codex?

Run `npx skills add rshankras/claude-code-apple-skills --skill coverage-ratchet -a codex`. Or copy the skill folder (skills/testing/coverage-ratchet in rshankras/claude-code-apple-skills) into .agents/skills/coverage-ratchet in your project. Codex loads it when a task matches its description.

Can I use Coverage Ratchet in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add rshankras/claude-code-apple-skills --skill coverage-ratchet -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/coverage-ratchet, .gemini/skills/coverage-ratchet, .github/skills/coverage-ratchet and .opencode/skills/coverage-ratchet in your project.

What does Coverage Ratchet need to run?

Going by SKILL.md and its folder, Coverage Ratchet needs a shell for the scripts in its folder. Our summary lists: A Bash shell. Its frontmatter pre-approves these tools: Read, Write, Edit, Glob, Grep, Bash.

Does Coverage Ratchet access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Coverage Ratchet safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Coverage Ratchet use?

Coverage Ratchet is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Coverage Ratchet use?

About 1.1k tokens (SKILL.md is roughly 4.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Coverage Ratchet?

Skills that share tags, products or a category with Coverage Ratchet: Requirements (rizsotto/Bear, 6.5k stars), Crap Analysis (ardalis/RiverBooks, 135 stars), Code Coverage (s3s-project/s3s, 311 stars) and Project Status (bactopia/bactopia, 522 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Coverage Ratchet?

rshankras (a GitHub user) maintains it in rshankras/claude-code-apple-skills, which has 785 GitHub stars. The repository holds 41 skills in this directory. The repository was last updated on July 24, 2026.

Source: rshankras/claude-code-apple-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.