coverage

A Qt project command that measures which parts of the program's code are exercised by tests, then creates an HTML report showing the results.

In plain words
What is it for?
Run coverage checks for Python or C++ Qt projects, set a coverage threshold, exclude selected files or patterns, and review the generated HTML report.
Why use it?
It reveals untested code paths so you can see where tests are missing. It can also pass those gaps to a test-generation agent.

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/l3digitalnet/claude-code-plugins/coverage
Clone the repo
git clone --depth 1 https://github.com/L3DigitalNet/Claude-Code-Plugins
Per session 37 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,144 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.00037 $0.01144
Opus 5 $0.00018 $0.00572
Sonnet 5 $0.00007 $0.00229
Haiku 4.5 $0.00004 $0.00114

Measured yesterday against content hash 3620eae445de, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

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 yesterday.

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.

plugins/qt-suite/commands/coverage.md · 160 lines

How it starts

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

/qt-suite:coverage — Coverage Analysis

Run coverage instrumentation, generate an HTML report, and identify untested code paths. Optionally triggers the test-generator agent when gaps are found.

Step 1: Parse Arguments and Config

Parse the command argument for flags:

  • --python — force Python mode
  • --cpp — force C++ mode
  • --threshold N — override coverage threshold (default 80)

Read .qt-test.json if present:

  • project_type — python | cpp
  • coverage_threshold — numeric, default 80
  • build_dir — default "build-coverage"
  • coverage_exclude — list of patterns to exclude

Auto-detect project type if not specified (CMakeLists.txt = C++, pyproject.toml = Python).

Step 2: Run Coverage — Python

First verify the prerequisite tools are available:

python3 -c "import coverage, pytest_cov" 2>&1 || echo "Install: pip install coverage pytest-cov"

Run tests with coverage instrumentation:

QT_QPA_PLATFORM=offscreen \
  pytest \
    --cov=<package_name> \
    --cov-branch \
    --cov-report=term-missing \
    --cov-report=html:htmlcov \
    --cov-report=json:.coverage.json \
    tests/

Determine <package_name> from pyproject.toml [tool.coverage.run] source field, or from the project's main package directory.

Step 3: Run Coverage — C++

First verify prerequisites:

bash "${CLAUDE_PLUGIN_ROOT}/scripts/check-prerequisites.sh"

Build with coverage instrumentation:

echo "Configuring with coverage instrumentation..."
cmake -B build-coverage -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON
echo "Building..."
cmake --build build-coverage --parallel 4

Collect coverage:

cd build-coverage
echo "Running tests (pass 1 — zeroing counters)..."
ctest --output-on-failure

lcov --zerocounters --directory .
# (re-run tests to collect fresh counters)
echo "Running tests (pass 2 — collecting coverage data)..."
ctest --output-on-failure

echo "Generating coverage report..."
lcov --capture \
     --directory . \
     --output-file ../coverage_raw.info \
     --no-external

lcov --remove ../coverage_raw.info \
     '*/tests/*' '*/moc_*' '*/ui_*' \
     --output-file ../coverage.info

genhtml ../coverage.info \
        --output-directory ../htmlcov \
        --title "Coverage Report" \
        --legend
cd ..

Read the full file on GitHub · 160 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. yesterday First seen · 160 lines · 37 tokens per session scan A 3620eae445de

Subscribe to this mod's changes

coverage is a command published in the GitHub repository L3DigitalNet/Claude-Code-Plugins (6 stars, last pushed 2d ago), licensed MIT. It adds 37 tokens to every session and 1,144 once invoked, about $0.0002 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.