agentleFS
daryaKutodaryaKuto/claude-skills/skills/grow-test-coverage/SKILL.md

grow-test-coverage

Skill0 starsChanged 16 days agoMITView on GitHub

Use when an agent is generating or auto-extending tests for existing code and needs an automatic rule for keeping or discarding each candidate test, rather than the agent's own judgment; when generated tests pass but do not actually exercise the code they claim to cover; when a coverage target (a percentage) must be reached by real, re-measured progress instead of the agent's own claim; or when a test-generation loop needs a concrete stop condition instead of running until the agent decides it is done.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Baseline: Before generating anything, run the real test command once, parse the real coverage report, record the starting number.

    line 22
  2. Distinctive:

    Insert and run for real: Add the candidate, run the same real command.

    line 24
  3. Distinctive:

    Accept or reject: Keep only if a previously missed line is now covered.

    line 27
  4. Distinctive:

    No iteration or time cap, so an unreachable target loops forever.

    line 47
  5. Very specific:

    Read: cover_agent/cover_agent.py, cover_agent/unit_test_validator.py, cover_agent/coverage_processor.py, docs/repo_coverage.md.

    line 52

≈ “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

Grow test coverage

Overview

Coverage is the share of source lines a test suite runs, measured by a coverage tool from a report file, not guessed. Core rule: keep a generated test only if it passes and the real report shows it covered a new line. Otherwise discard it and retry.

When to use

  • An agent proposes candidate tests one at a time and needs a pass or fail rule for each.
  • A numeric coverage target exists and progress must be verified, not asserted.
  • A generated test might pass while touching nothing new (no real assertion, or a duplicate).

Skip for: grading a whole agent session; a one-time checklist like build, lint, test, security scan (runs once, no rollback); a stack with no coverage tool.

The pattern

  1. Baseline. Before generating anything, run the real test command once, parse the real coverage report, record the starting number.
  2. Generate one candidate. One test at a time, never a batch, so credit is traceable.
  3. Insert and run for real. Add the candidate, run the same real command. Never substitute a mock runner or mocked coverage tool.
  4. Fail path. Non-zero exit: discard, restore the file's prior content, log why.
  5. Coverage check. Passing run: re-parse the real report, compare to the current baseline.
  6. Accept or reject. Keep only if a previously missed line is now covered. Flat or dropped coverage fails too: discard and restore. On accept, the new number becomes the next baseline.
  7. Stop condition. Repeat from step 2 until the target is reached or an iteration cap (optionally a time cap) is hit. Hitting the cap is a normal exit, not an error.

This satisfies a no-mocking rule by construction, and composes with fail-before-fix: reproduce the bug first (must fail), then confirm the fix passes and raises coverage.

Quick reference

StepTriggerAction
Baselinebefore any candidaterun real command, parse real report
Failexit code != 0discard, restore file
No gainexit 0, coverage flat/droppeddiscard, restore file
Acceptexit 0, coverage rosekeep, baseline = new coverage
Stoptarget reached OR cap hitend loop, report final coverage

Common mistakes

  • Trusting the model's claim a test "should" help, instead of re-parsing the real report.
  • Comparing to the original baseline, not the latest accepted one, so a later candidate gets credit for someone else's gain.
  • Skipping restore-on-reject, leaving a broken test behind.
  • No iteration or time cap, so an unreachable target loops forever.

Source

Repo github.com/qodo-ai/qodo-cover, commit adcf55baba40e8fbf8a84e68b70d08bef1e2b9c9, license AGPL-3.0 (no permissive grant, wording here is original, nothing copied). Read: cover_agent/cover_agent.py, cover_agent/unit_test_validator.py, cover_agent/coverage_processor.py, docs/repo_coverage.md. Adapted: generalized a Python CLI tool's control flow into a language-agnostic keep/discard rule, paired with no-mocking and fail-before-fix, neither of which the source states.

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.