agentleFS
grodowskigrodowski/undercover-claude/skills/coverage/SKILL.md

coverage

Skill2 starsChanged 5 days agoMITView on GitHub

Test coverage feedback loop using undercover. Guides Claude to run undercover after tests to identify untested code changes, handle partial test runs with --include-files, and set up SimpleCov, CI pipelines, and coverage merging.

28 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use scan, lint and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • rajnavakotiSkill

    scan

    Run the AI dashboard scanner and generate the HTML report.

    Also in 4 projects that use this

  • Microsoft AzureSkill

    lint

    Run all linting and spell checking for TypeScript and Rust code. Run this before committing to catch style issues, clippy warnings, and misspellings.

    Also in 4 projects that use this

  • julienamorganSkill

    profile

    Researches the user's market, competitors, and competitive positioning to build a complete ICP profile. Shows findings for user approval before proceeding. Triggers: /profile, "research my market", "who are my competitors". Reads: ./gtm/company.md, ./gtm/icp.md. Writes: updates ./gtm/icp.md with competitive positioning. Standalone: yes (asks for domain if company.md missing).

    Also in 3 projects that use this

  • asterkinSkill

    adr

    Create Architecture Decision Records (ADRs) following project standards. Guides template usage, process, and best practices for documenting architecturally significant decisions.

    Also in 4 projects that use this

  • anombyte93Skill

    discover

    Phase 1 of the prd-taskmaster pipeline: brainstorm-driven discovery. Delegates to superpowers:brainstorming in Interactive Mode (one adaptive question at a time), or self-brainstorms in Autonomous Mode when no user is present. Intercepts before the brainstorming chain hands off to writing-plans — this skill owns the exit. Extracts constraints, calibrates scale (Solo / Team / Enterprise), and advances the pipeline to GENERATE.

    Also in 3 projects that use this

  • MicrosoftSkill

    worktree

    Create, reuse or clean up a dedicated git worktree for working on a pull request or a private branch. Use from any PR-scoped workflow that needs an isolated checkout to keep current code and build output untouched.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

11 rules. 0 are common, 6 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 25 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use it to decide what to do, then read the matching reference file before acting:

    line 15
  2. Distinctive:

    Run the feedback loop: after tests, or anything else → use the loop below (the default)

    line 21
  3. Distinctive:

    If no intent was given, default to the feedback loop.

    line 25
  4. Distinctive:

    After every test run, run undercover to check for coverage gaps.

    line 29
  5. Very specific:

    Only use --include-files when you ran a partial test suite.

    line 31
  6. Very specific:

    When running a subset of tests, SimpleCov only has coverage data for loaded files.

    line 45
  7. Very specific:

    Run bundle exec undercover --format json (scoped with --include-files if partial)

    line 51
  8. Distinctive:

    If no lines changed relative to the compare ref, undercover always passes.

    line 93
  9. Distinctive:

    Use undercover to ensure new and modified code is tested.

    line 96
  10. Very specific:

    If you commit as you go (the normal workflow), the default diff is empty after each commit and undercover always passes — a false green.

    line 107
  11. Very specific:

    Use --compare in two situations:

    line 110

“Common” is measured: kept by at least 6 in 10 of the 25 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Undercover Coverage Feedback

Routing

The user may have stated an intent after the command (shown below as $ARGUMENTS). Use it to decide what to do, then read the matching reference file before acting:

  • Set up coverage in a Ruby project (SimpleCov, Gemfile, .undercover, permissions) → read references/setup.md
  • Set up CI (UndercoverCI or GitHub Actions; also CircleCI and parallel test merging) → read references/ci.md
  • Read/address UndercoverCI feedback on a PR → read references/pr-feedback.md
  • Skip coverage for a file (# simplecov:disable, skip, --exclude-files) → read references/skipping.md
  • Run the feedback loop after tests, or anything else → use the loop below (the default)

Stated intent: $ARGUMENTS

If no intent was given, default to the feedback loop.

Coverage Feedback Loop

After every test run, run undercover to check for coverage gaps.

Only use --include-files when you ran a partial test suite. Full suite → no flag.

Full test suite:

bundle exec undercover --format json

Partial test run (single file or subset — undercover must match scope):

bundle exec undercover --format json --include-files "app/models/foo.rb"
bundle exec undercover --format json --include-files "app/models/*.rb,app/services/foo*.rb"

--include-files accepts comma-separated glob patterns, matched relative to the directory SimpleCov ran in (in a monorepo, lib/foo.rb, not apps/dash/lib/foo.rb). When running a subset of tests, SimpleCov only has coverage data for loaded files. Without --include-files, undercover will falsely flag all other changed files as uncovered.

Workflow:

  1. Run tests
  2. Run bundle exec undercover --format json (scoped with --include-files if partial)
  3. If gaps found: write tests for uncovered code. Prefer real tests over # simplecov:disable. Only use it when the code genuinely cannot or should not be tested (see references/skipping.md). Only delete code if you are certain it is dead/unreachable; understand why it's uncovered before removing it
  4. Repeat until undercover exits 0

JSON output format

{
  "warnings": [
    {
      "node": "Foo#bar",
      "type": "instance method",
      "file": "lib/foo.rb",
      "first_line": 10,
      "last_line": 15,
      "coverage": 0.5,
      "uncovered_lines": [11],
      "uncovered_branches": [
        {"line": 13, "block": 0, "branch": 0},
        {"line": 13, "block": 0, "branch": 1, "description": "else"}
      ]
    }
  ],
  "summary": {"total_warnings": 1, "files_affected": 1},
  "validation": "stale_coverage"
}
  • uncovered_lines — lines with zero hits
  • uncovered_branches — branches with zero hits; description present for ternary/case branches
  • validation — only present on errors (e.g. stale_coverage); exit code is 0 in this case
  • warnings empty + no validation = all changed code covered

What Undercover Reports

Undercover checks only the lines changed in your current diff (compared against a git ref). It does NOT measure total coverage.

  • "✅ No coverage is missing in latest changes" means the changed lines are covered — nothing more. The rest of the codebase could have 0% coverage.
  • SimpleCov's percentage (e.g. "97.6% covered") and undercover's result are independent. Do not conflate them.
  • If no lines changed relative to the compare ref, undercover always passes. This is expected, not a confirmation of coverage quality.

Use undercover to ensure new and modified code is tested. Use SimpleCov's total percentage to track overall coverage trends separately.

The compare ref

Undercover only sees files that are staged or have unstaged changes to tracked files. Completely untracked files (never added to git) are invisible — undercover will not check them.

By default (no --compare), undercover checks uncommitted changes — staged and unstaged vs HEAD. This only catches work in progress.

If you commit as you go (the normal workflow), the default diff is empty after each commit and undercover always passes — a false green. --compare is required.

Use --compare in two situations:

On a feature branch — to check all commits since branching off main:

-c origin/main

No remote / local-only repo — compare against the initial commit SHA:

-c <initial-commit-sha>

Set it in .undercover so it applies consistently. If .undercover already exists in the project, use the ref it specifies — do not overwrite it.

-c origin/main

Reference files

Deeper guides, loaded on demand (see Routing above):

  • references/setup.md — SimpleCov + Gemfile + .undercover + Claude permissions + CLI reference
  • references/ci.md — GitHub Actions, UndercoverCI, CircleCI, parallel test coverage merging
  • references/pr-feedback.md — reading UndercoverCI check annotations on a PR via gh api
  • references/skipping.md — # simplecov:disable, skip, --exclude-files and when to use each

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.