agentleFS
mejbaurbaharmejbaurbahar/software-tester-skills/skills/code-coverage-analysis/SKILL.md

code-coverage-analysis

Skill1 starsChanged 52 days agoMITView on GitHub

Use when measuring or improving test coverage — line, branch, function, condition/MC-DC and diff/patch coverage; coverage tools (coverage.py, Istanbul/c8, JaCoCo, gcov, go cover); setting sensible thresholds; and finding meaningful gaps rather than chasing 100%.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Look at uncovered *branches* in error handling, permissions, rollbacks, timeouts.

    line 48
  2. Distinctive:

    Ask "what bug would slip through here?" — write the test for that, not for the line.

    line 49

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

Code Coverage Analysis

Coverage tells you what is definitely not tested, never what is well tested. Use it to find holes, not as a target to game.

Metric ladder

MetricMeaningUse
Line/statementexecuted linesbaseline
Brancheach if/else/case taken both wayspreferred default
Function/methodeach function calledAPI surface
Condition / MC/DCeach boolean sub-condition affects outcomesafety-critical (DO-178C, ISO 26262)
Diff / patchcoverage of changed lines onlybest PR gate
Mutation scoredo tests detect changesquality proof (mutation-testing)

Commands

# Python
pytest --cov=src --cov-branch --cov-report=term-missing --cov-report=xml --cov-fail-under=80
# JS/TS (Vitest/Jest/c8)
npx vitest run --coverage        # or: jest --coverage ; c8 node --test
# Java (Maven + JaCoCo)
mvn verify   # jacoco:report → target/site/jacoco/index.html
# Go
go test ./... -coverprofile=c.out -covermode=atomic && go tool cover -html=c.out
# C/C++
gcc --coverage ... && gcov file.c ; lcov --capture -d . -o cov.info && genhtml cov.info
# Diff coverage on PRs
diff-cover coverage.xml --compare-branch=origin/main --fail-under=90

Setting thresholds

  • Overall gate: modest & ratcheting (e.g. ≥ 75% branch, never decrease).
  • Patch gate ≥ 85–90% on new/changed lines (Codecov/Coveralls/diff-cover).
  • Higher (95%+) for money/auth/crypto/parsers; exclude generated code, migrations, trivial DTOs explicitly with reasons.

Reading a report — find meaningful gaps

  1. Sort by uncovered lines × complexity × change frequency (churn hotspots).
  2. Look at uncovered branches in error handling, permissions, rollbacks, timeouts.
  3. Ask "what bug would slip through here?" — write the test for that, not for the line.
  4. Confirm tests have assertions (a test that calls code without asserting yields fake coverage) → run mutation testing on hotspots.

Merge coverage across layers

Unit + integration + E2E (nyc merge, coverage combine, JaCoCo merge), and for E2E use server-side instrumentation to see what real journeys exercise.

Pitfalls

Goodhart's law (100% target → assertion-free tests) · counting test files in coverage · ignoring branches · exclusion creep (# pragma: no cover everywhere) · coverage from flaky/skipped tests.

Related

unit-testing, mutation-testing, test-metrics-reporting, cicd-testing, regression-testing

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.