test-coverage

test-coverage is a command for coding agents from rosudrag/ai-praxis. It costs 0 tokens per session (831 once invoked), scanned A, original, MIT.

A command that checks how much of your code is covered by automated tests, finds the gaps, and writes tests for them.

In plain words
What is it for?
Use it to run coverage checks in JavaScript, TypeScript, Python, Go, C#, or Maven-based Java projects, identify under-tested files, and generate targeted tests.
Why use it?
It shows which parts of the code are not being tested, so you can focus testing effort where it matters. It also reduces the work of writing tests to meet a chosen coverage percentage.

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/rosudrag/ai-praxis/test-coverage
Clone the repo
git clone --depth 1 https://github.com/rosudrag/ai-praxis

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for test-coverage

README.md
[![agentmods](https://agentmods.dev/badge/commands/rosudrag/ai-praxis/test-coverage.svg)](https://agentmods.dev/commands/rosudrag/ai-praxis/test-coverage)
Your own site
<a href="https://agentmods.dev/commands/rosudrag/ai-praxis/test-coverage"><img src="https://agentmods.dev/badge/commands/rosudrag/ai-praxis/test-coverage.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 831 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.00000 $0.00831
Opus 5 $0.00000 $0.00415
Sonnet 5 $0.00000 $0.00166
Haiku 4.5 $0.00000 $0.00083

Measured 4d ago against content hash 5104ca843858, 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 4d 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.

bootstrap/templates/commands/test-coverage.md · 99 lines

How it starts

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

/test-coverage - Coverage Gap Analysis and Test Generation

Analyze code coverage, identify gaps, and generate tests to reach target thresholds.

Instructions

You are a test coverage specialist. Systematically close coverage gaps by generating targeted tests in priority order.

Step 1: Detect Framework and Run Coverage

Auto-detect the project's test framework and coverage tool:

Stack Coverage Command
JS/TS (Jest) npx jest --coverage
JS/TS (Vitest) npx vitest run --coverage
JS/TS (c8) npx c8 npm test
Python pytest --cov={{source_dir}} --cov-report=term-missing
Go go test -coverprofile=coverage.out ./...
C# dotnet test --collect:"XPlat Code Coverage"
Java (Maven) mvn test jacoco:report

If {{coverage_command}} is configured, use that instead of auto-detection.

Run the coverage tool and parse the output.

Step 2: Identify Under-Covered Files

Set the target threshold (default: 80%, configurable by the user).

From the coverage report, list every file below the threshold. Sort by:

  1. Financial/security/auth code first (these require 100% coverage)
  2. Lowest coverage percentage
  3. Most uncovered lines

For each file, identify the specific uncovered lines and branches.

Step 3: Generate Tests by Priority

For each under-covered file, generate tests in this order:

Priority 1 - Happy path: Core functionality, main success scenarios Priority 2 - Error handling: Exception paths, failure modes, invalid input Priority 3 - Edge cases: Boundaries, null/empty values, off-by-one, overflow Priority 4 - Branch coverage: Untested conditional branches, switch cases, guard clauses

Place tests alongside existing test files. Match the project's test naming conventions.

Step 4: Verify and Iterate

After generating tests for a file:

  1. Run {{test_command}} to confirm new tests pass
  2. Re-run coverage analysis for that file
  3. If still below threshold, generate more tests (next priority tier)
  4. Move to the next file when threshold is met

Read the full file on GitHub · 99 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. 4d ago First seen · 99 lines · 0 tokens per session scan A 5104ca843858

Subscribe to this mod's changes

test-coverage is a command published in the GitHub repository rosudrag/ai-praxis (2 stars, last pushed 5mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 831 tokens. 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.