test-coverage

A command that checks which parts of the code are exercised by tests and adds tests for uncovered areas. Test coverage measures how much of the code runs during automated tests.

In plain words
What is it for?
Use it to run the project’s test suite with coverage, find files below 80%, and write unit or integration tests that follow the project’s existing style.
Why use it?
It shows where tests are missing instead of relying on guesswork. It focuses new tests on business logic, edge cases, invalid inputs, and error handling.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/versoxbt/claude-initial-setup/test-coverage
Clone the repo
git clone --depth 1 https://github.com/VersoXBT/claude-initial-setup
Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 446 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00012 $0.00446
Opus 5 $0.00006 $0.00223
Sonnet 5 $0.00002 $0.00089
Haiku 4.5 $0.00001 $0.00045

Measured 2d ago against content hash 2e026443d565, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

test-coverage scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/test-coverage.md · 60 lines

How it starts

The opening of the file, as written. The whole thing — 60 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Test Coverage

Analyze current test coverage, identify gaps, and write tests to achieve at least 80% coverage.

Steps

  1. Run the test suite with coverage enabled:

    • Detect the test runner (jest, vitest, pytest, go test, etc.).
    • Run with coverage flags and capture the coverage report output.
    npm test -- --coverage
    pytest --cov --cov-report=html
    go test -cover -coverprofile=coverage.out ./...
    
  2. Parse the coverage report:

    • Identify files below 80% coverage.
    • Sort by coverage percentage (lowest first).
    • Note which lines and branches are uncovered.
  3. Prioritize coverage gaps:

    • Focus on business logic and utility functions first.
    • Prioritize files with complex branching and error handling.
    • Skip auto-generated files, type definitions, and configuration files.
  4. Write missing unit tests:

    • For each uncovered function, write tests covering:
      • Happy path with valid inputs.
      • Edge cases (null, undefined, empty, boundary values).
      • Error cases (invalid inputs, thrown exceptions).
    • Follow existing test patterns and conventions in the project.
    • Use descriptive test names that explain the expected behavior.
  5. Write missing integration tests:

    • Test API endpoints with valid and invalid requests.
    • Test database operations with proper setup and teardown.
    • Test interactions between modules.
  6. Run tests after writing each batch:

    • Verify new tests pass.
    • Verify existing tests still pass.
    • Re-check coverage numbers.
  7. Repeat until all target files are at or above 80% coverage.

If Coverage Cannot Reach 80%

  • Check if uncovered code is truly unreachable (dead code) and remove it.
  • Check if uncovered code requires complex setup (external services, specific environments) and note it.
  • Document any intentional exclusions with coverage ignore comments and justification.

Output

Updated test suite with all tests passing and coverage at or above 80% for target files. Include a before/after coverage summary.

Read the full file on GitHub · 60 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 60 lines · 12 tokens per session scan A 2e026443d565

Subscribe to this mod's changes

test-coverage is a command published in the GitHub repository VersoXBT/claude-initial-setup (4 stars, last pushed 3mo ago), licensed MIT. It adds 12 tokens to every session and 446 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.