test-coverage

test-coverage is a command for coding agents from xu-xiang/everything-claude-code-zh. It costs 7 tokens per session (547 once invoked), scanned A, original, MIT.

A command for measuring which parts of a codebase are exercised by tests. Test coverage shows the proportion of statements, branches, functions, or lines that tests run.

In plain words
What is it for?
Running coverage reports, finding gaps, prioritising untested authentication or business logic, and generating tests for uncovered areas.
Why use it?
It exposes important code paths that have no tests, so developers can focus testing effort where failures would matter most.

Command

Part of the everything-claude-code-zh plugin — 17 skills, 26 commands, 13 agents shipped together

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/xu-xiang/everything-claude-code-zh/test-coverage
Clone the repo
git clone --depth 1 https://github.com/xu-xiang/everything-claude-code-zh

Or install everything-claude-code-zh, the plugin that ships this one along with the rest of its 17 skills, 26 commands, 13 agents.

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/xu-xiang/everything-claude-code-zh/test-coverage.svg)](https://agentmods.dev/commands/xu-xiang/everything-claude-code-zh/test-coverage)
Your own site
<a href="https://agentmods.dev/commands/xu-xiang/everything-claude-code-zh/test-coverage"><img src="https://agentmods.dev/badge/commands/xu-xiang/everything-claude-code-zh/test-coverage.svg" alt="Measured on agentmods" height="20"></a>
Per session 7 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 547 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.00007 $0.00547
Opus 5 $0.00003 $0.00273
Sonnet 5 $0.00001 $0.00109
Haiku 4.5 $0.00001 $0.00055

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

.opencode/commands/test-coverage.md · 81 lines

What it actually says

测试覆盖率命令 (Test Coverage Command)

分析测试覆盖率并识别缺口:$ARGUMENTS

你的任务 (Your Task)

  1. 运行覆盖率报告npm test -- --coverage
  2. 分析结果 - 识别低覆盖率区域
  3. 优先处理缺口 - 核心代码优先
  4. 生成缺失的测试 - 针对未覆盖的代码

覆盖率目标 (Coverage Targets)

代码类型 目标
标准代码 80%
金融逻辑 100%
认证/安全 100%
工具库 90%
UI 组件 70%

覆盖率报告分析 (Coverage Report Analysis)

摘要 (Summary)

文件           | % 语句 | % 分支 | % 函数 | % 行数
---------------|---------|----------|---------|--------
所有文件       |   XX    |    XX    |   XX    |   XX

低覆盖率文件 (Low Coverage Files)

[低于目标的文件,按重要程度排序]

未覆盖的行 (Uncovered Lines)

[需要测试的具体行]

测试生成 (Test Generation)

对于每个未覆盖的区域:

[函数/组件名称]

位置: src/path/file.ts:123

覆盖率缺口: [说明]

建议的测试:

describe('functionName', () => {
  it('should [expected behavior]', () => {
    // 测试代码
  })

  it('should handle [edge case]', () => {
    // 边界情况测试
  })
})

覆盖率提升计划 (Coverage Improvement Plan)

  1. 紧急 (立即添加)

    • file1.ts - 认证逻辑
    • file2.ts - 支付处理
  2. (本迭代添加)

    • file3.ts - 核心业务逻辑
  3. (修改文件时添加)

    • file4.ts - 工具库

重要提示: 覆盖率是一个指标,而非最终目标。应专注于有意义的测试,而不只是为了追求数字。

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 · 81 lines · 7 tokens per session scan A 1c79460fb562

Subscribe to this mod's changes

test-coverage is a command published in the GitHub repository xu-xiang/everything-claude-code-zh (1,927 stars, last pushed 6mo ago), licensed MIT. It adds 7 tokens to every session and 547 once invoked, about $0.0000 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-30.