Token导航 LogoToken导航

Agent Skill · 研究检索

coverage-analysis(覆盖率分析)

coverage-analysis 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

coverage-analysis 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 62,001。

总安装 343周安装 14GitHub Stars 4下载 110核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:coverage-analysis(覆盖率分析)
来源仓库:https://github.com/petrkindlmann/qa-skills
仓库路径:skills/coverage-analysis
安装命令:
npx skills add https://github.com/petrkindlmann/qa-skills --skill coverage-analysis
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/petrkindlmann/qa-skills --skill coverage-analysis

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于查找、检索和筛选相关信息,适合在覆盖率分析过程中获取工具与方法。适用于根据关键词或任务场景快速定位候选策略。通过 GitHub 安装,兼容 Codex、Claude、Cursor、Gemini CLI 等宿主环境。使用前建议确认权限范围和维护状态,注意是否触发联网或命令执行。

coverage-analysis 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/coverage-analysis

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/petrkindlmann/qa-skills --skill coverage-analy…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

coverage-analysis 怎么安装?

在终端执行 npx skills add https://github.com/petrkindlmann/qa-skills --skill coverage-analysis。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

coverage-analysis 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

coverage-analysis 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

coverage-analysis 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

coverage-analysis 用的人多吗?

公开数据是累计安装 343 次,近一周安装 14 次,下载 110 次,GitHub 4 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

coverage-analysis 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
coverage-analysis

覆盖率分析 · 本页

3434操作浏览器未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文


Discovery Questions

  1. What coverage tooling is configured? Check for jest.config.* (coverageProvider), vitest.config.* (coverage), .nycrc, c8 in scripts, or [tool.coverage] in pyproject.toml.
  2. What is the current coverage level? Run the existing coverage command and note line, branch, and function percentages. This is the baseline for the ratchet.
  3. Is coverage gated in CI? Check GitHub Actions or GitLab CI for --coverage, coverageThreshold, fail_under, or --cov-fail-under flags.
  4. What is the target, and who set it? A target without rationale ("the VP said 80%") leads to gaming. Targets should reflect risk tolerance and codebase maturity.
  5. Check .agents/qa-project-context.md first. Respect existing coverage conventions and thresholds.

Core Principles

1. Coverage measures breadth, not depth. A line of code being executed does not mean it is tested correctly. expect(true).toBe(true) executes the function but asserts nothing meaningful. Coverage tells you what code ran, not whether the tests would catch a bug.

2. Branch coverage matters more than line coverage. A ternary condition? a: b on one line counts as "covered" in line coverage even if only one branch executes. Branch coverage exposes untested paths.

// Line coverage: 100% (the line executed)
// Branch coverage: 50% (only the 'true' branch ran)
function discount(price: number, isPremium: boolean): number {
  return isPremium ? price * 0.8 : price;
}

// Test only covers isPremium = true
expect(discount(100, true)).toBe(80);
// Missing: expect(discount(100, false)).toBe(100);

3. Ratchet pattern: never decrease, only increase. Record the current coverage as the minimum threshold. Every PR must meet or exceed it. Coverage goes up over time without forcing artificial targets.

4. Focus on gaps, not numbers. A project at 85% coverage is not "better" than one at 75%. What matters is whether the untested 15% or 25% contains critical business logic. Analyze gaps by risk, not by percentage.

5. New code has a higher bar than legacy code. Require 90%+ coverage on new code in PRs even if the overall project is at 65%. This prevents coverage decay without demanding a rewrite of legacy code.


Coverage Tools

V8 / c8 (Node.js Built-in)

V8's built-in code coverage is faster than Istanbul because it does not instrument source code. Use c8 as the CLI wrapper.

npm i -D c8
// package.json
{
  "scripts": {
    "test": "vitest run",
    "test:coverage": "vitest run --coverage"
  }
}
// vitest.config.ts
import { defineConfig } from "vitest/config";

export default defineConfig({
  test: {
    coverage: {
      provider: "v8",
      reporter: ["text", "html", "lcov", "json-summary"],
      reportsDirectory: "./coverage",
      include: ["src/**/*.ts"],
      exclude: [
        "src/**/*.test.ts",
        "src/**/*.spec.ts",
        "src/**/*.d.ts",
        "src/**/index.ts",       // Barrel exports
        "src/**/types.ts",       // Type-only files
        "src/**/*.stories.ts",   // Storybook
        "src/generated/**",      // Generated code
      ],
      thresholds: {
        lines: 80,
        branches: 80,
        functions: 80,
        statements: 80,
      },
    },
  },
});

Istanbul / nyc (JavaScript/TypeScript)

Istanbul instruments source code for coverage tracking. Slower than V8 but more widely compatible.

npm i -D nyc
// .nycrc.json
{
  "all": true,
  "include": ["src/**/*.ts"],
  "exclude": [
    "src/**/*.test.ts",
    "src/**/*.spec.ts",
    "src/**/*.d.ts",
    "src/**/index.ts",
    "src/generated/**"
  ],
  "reporter": ["text", "html", "lcov", "json-summary"],
  "report-dir": "./coverage",
  "check-coverage": true,
  "branches": 80,
  "lines": 80,
  "functions": 80,
  "statements": 80,
  "watermarks": {
    "lines": [70, 90],
    "functions": [70, 90],
    "branches": [70, 90],
    "statements": [70, 90]
  }
}
// package.json (with Jest)
{
  "scripts": {
    "test:coverage": "jest --coverage"
  },
  "jest": {
    "coverageProvider": "v8",
    "collectCoverageFrom": [
      "src/**/*.ts",
      "!src/**/*.{test,spec,d}.ts",
      "!src/**/index.ts",
      "!src/generated/**"
    ],
    "coverageThreshold": {
      "global": {
        "branches": 80,
        "functions": 80,
        "lines": 80,
        "statements": 80
      }
    }
  }
}

coverage.py (Python)

pip install pytest-cov
# pyproject.toml
[tool.coverage.run]
source = ["src"]
branch = true
omit = [
    "src/**/test_*.py",
    "src/**/conftest.py",
    "src/**/__init__.py",
    "src/generated/*",
]

[tool.coverage.report]
fail_under = 80
show_missing = true
skip_covered = true
precision = 1
exclude_lines = [
    "pragma: no cover",
    "if TYPE_CHECKING:",
    "if __name__ == .__main__.",
    "raise NotImplementedError",
    "@overload",
    "\\.\\.\\.",     # Ellipsis in abstract methods
]

[tool.coverage.html]
directory = "coverage/html"

[tool.coverage.xml]
output = "coverage/coverage.xml"
# Run tests with coverage
pytest --cov=src --cov-report=term-missing --cov-report=html --cov-report=xml

# Fail if coverage drops below threshold
pytest --cov=src --cov-fail-under=80

Coverage Report Types

ReporterOutputUse Case
textTerminal tableQuick local check
htmlInteractive HTMLDetailed local analysis, clicking through files
lcovlcov.info fileSonarQube, Codecov, Coveralls integration
json-summarycoverage-summary.jsonCI scripts, PR comments, dashboard metrics
coberturacobertura-coverage.xmlGitLab CI coverage visualization

Gap Analysis

Identify Untested Code Paths

Coverage reports show which lines and branches are not executed. But not all gaps are equal. Prioritize by risk.

Step 1: Generate the coverage report.

npm run test:coverage
# Open coverage/index.html in a browser

Step 2: Sort files by uncovered lines. Parse coverage-summary.json, sort files by (total - covered) descending, and focus on the top 20. A script that reads the JSON summary and outputs a table of file, line%, branch%, and uncovered count makes this repeatable.

Step 3: Map gaps to risk areas.

Gap LocationRisk LevelAction
Payment processingCriticalWrite tests immediately
Auth/permissionsCriticalWrite tests immediately
Data validationHighAdd to next sprint
Error handling pathsHighAdd to next sprint
Utility functionsMediumCover when modifying
UI formattingLowSkip unless regression-prone
Generated codeNoneExclude from coverage

Coverage Diff on PRs

Show coverage change per PR so reviewers see the impact of each change.

# GitHub Actions: coverage diff comment
- name: Run tests with coverage
  run: npm run test:coverage

- name: Coverage Report
  uses: davelosert/vitest-coverage-report-action@v2
  if: github.event_name == 'pull_request'
  with:
    json-summary-path: coverage/coverage-summary.json
    json-final-path: coverage/coverage-final.json
    vite-config-path: vitest.config.ts

Alternative: use marocchino/sticky-pull-request-comment@v2 with a script that reads coverage-summary.json, filters to changed files (via git diff --name-only origin/main...HEAD), and renders a markdown table showing per-file line and branch coverage.


Coverage as CI Gate

Threshold Configuration

Global threshold (minimum for the entire project):

// vitest.config.ts
coverage: {
  thresholds: {
    lines: 80,
    branches: 80,
    functions: 80,
    statements: 80,
  },
}

Per-directory thresholds (stricter for critical code):

// vitest.config.ts
coverage: {
  thresholds: {
    // Global baseline
    lines: 75,
    branches: 75,

    // Stricter for critical paths
    "src/payments/**": { lines: 95, branches: 90 },
    "src/auth/**": { lines: 90, branches: 85 },
    "src/utils/**": { lines: 80, branches: 80 },
  },
}

Jest per-file thresholds:

// jest.config.js
module.exports = {
  coverageThreshold: {
    global: { branches: 75, functions: 75, lines: 75, statements: 75 },
    "./src/payments/": { branches: 90, functions: 90, lines: 95, statements: 95 },
    "./src/auth/": { branches: 85, functions: 85, lines: 90, statements: 90 },
  },
};

Ratchet Pattern

Never let coverage decrease. Record the current level as the minimum and update it upward when coverage improves.

// scripts/coverage-ratchet.ts
import fs from "fs";
import coverageSummary from "../coverage/coverage-summary.json";

const RATCHET_FILE = ".coverage-ratchet.json";

interface Ratchet {
  lines: number;
  branches: number;
  functions: number;
  statements: number;
  updatedAt: string;
}

// Read current ratchet or initialize
let ratchet: Ratchet;
try {
  ratchet = JSON.parse(fs.readFileSync(RATCHET_FILE, "utf-8"));
} catch {
  ratchet = { lines: 0, branches: 0, functions: 0, statements: 0, updatedAt: "" };
}

const current = (coverageSummary as any).total;
const metrics = ["lines", "branches", "functions", "statements"] as const;
let failed = false;

for (const metric of metrics) {
  const currentPct = current[metric].pct;
  const ratchetPct = ratchet[metric];

  if (currentPct < ratchetPct) {
    console.error(
      `FAIL: ${metric} coverage dropped from ${ratchetPct}% to ${currentPct}% (delta: ${(currentPct - ratchetPct).toFixed(1)}%)`
    );
    failed = true;
  } else if (currentPct > ratchetPct) {
    console.log(`IMPROVED: ${metric} coverage increased from ${ratchetPct}% to ${currentPct}%`);
    ratchet[metric] = Math.floor(currentPct); // Floor to avoid ratcheting on decimals
  } else {
    console.log(`STABLE: ${metric} coverage at ${currentPct}%`);
  }
}

if (failed) {
  console.error("\nCoverage ratchet failed. Coverage must not decrease.");
  console.error("If this is intentional (e.g., removing dead code), update .coverage-ratchet.json manually.");
  process.exit(1);
}

// Update ratchet file
ratchet.updatedAt = new Date().toISOString();
fs.writeFileSync(RATCHET_FILE, JSON.stringify(ratchet, null, 2) + "\n");
console.log(`\nRatchet updated: ${JSON.stringify(ratchet)}`);

Commit .coverage-ratchet.json to the repo (e.g., {"lines": 82, "branches": 78,...}). In CI, run the ratchet script after tests. On main branch merges, auto-commit the updated ratchet file if coverage improved.

PR Diff Coverage Gate

Require that new code in a PR meets a higher threshold (e.g., 90%) than the project baseline. In CI, use git diff --numstat origin/main...HEAD to identify changed files, then check their coverage from coverage-summary.json. Fail the pipeline if the average coverage of changed files falls below the threshold. This prevents coverage decay without demanding a rewrite of legacy code.


Meaningful vs Vanity Coverage

Why 100% Coverage Is Usually Wrong

100% coverage requires testing every branch of every line, including:

  • Error handling for impossible states
  • Default cases in exhaustive switches
  • Framework lifecycle methods that are never called directly
  • Defensive checks against corrupted data

Tests written to hit 100% are often trivial, brittle, and do not catch real bugs.

Diminishing Returns

Coverage RangeValueEffort
0% to 60%High -- covers main paths, catches obvious regressionsLow
60% to 80%Medium -- covers error paths, edge casesMedium
80% to 90%Lower -- covers unusual combinations, defensive codeHigh
90% to 100%Minimal -- covers unreachable code, framework internalsVery high

The sweet spot is 75-85% for most projects. Critical paths (payments, auth) should aim higher (90%+).

What NOT to Cover

Exclude these from coverage calculations. They inflate the denominator without adding value.

// vitest.config.ts or jest.config.js -- exclude patterns
exclude: [
  "**/*.d.ts",              // Type definitions
  "**/index.ts",            // Barrel exports (re-exports only)
  "**/*.stories.{ts,tsx}",  // Storybook stories
  "**/generated/**",        // Auto-generated code (GraphQL, Prisma)
  "**/migrations/**",       // Database migrations
  "**/__mocks__/**",        // Test mocks
  "**/types/**",            // Type-only modules
]

Quality Indicators Beyond Percentage

Coverage percentage alone is insufficient. Combine it with:

IndicatorWhat It MeasuresHow to Get It
Mutation scoreWould tests catch a real bug?Stryker / mutmut
Branch coverageAre all conditional paths tested?V8/Istanbul with branch reporting
Critical path coverageAre payment/auth/data flows fully covered?Per-directory thresholds
Defect escape rateDo production bugs occur in tested code?Post-incident analysis
Coverage deltaIs coverage improving or declining?Ratchet pattern tracking

Anti-Patterns

Treating coverage as proof of quality. "We have 90% coverage so we are well-tested" is a dangerous statement. Coverage says code executed, not that behavior was verified. A test with no assertions contributes to coverage but catches zero bugs.

Excluding files to inflate numbers. Adding files to the exclude list because they are hard to test (e.g., error handlers, integration modules) hides the most important gaps. Only exclude genuinely untestable code: generated files, type definitions, and barrel exports.

Writing trivial tests to hit targets. Tests like it("should exist", () => {expect(MyClass).toBeDefined();}) add coverage without value. Every test should verify a behavior that, if broken, would affect users.

Global threshold without per-module analysis. An 80% global threshold can pass even if the payment module is at 30% coverage -- as long as utility functions inflate the average. Use per-directory thresholds for critical paths.

Coverage threshold set once, never adjusted. The ratchet should increase over time. A team that has been at 78% for 6 months is not improving. Review the ratchet quarterly and investigate why it stagnates.

Ignoring branch coverage. Line coverage reports 100% on const result = condition? a: b even if only one branch runs. Always report and gate on branch coverage alongside line coverage. Branch coverage is the more honest metric.

Coverage in E2E tests only. E2E tests execute many lines but cover broad, shallow paths. A single E2E test might touch 60% of the codebase without testing any edge case. Unit tests provide targeted, deep coverage of logic branches. Measure coverage from unit and integration tests separately from E2E.


Done When

  • Coverage is instrumented and running automatically in CI on every push (no manual steps to generate the report).
  • Coverage threshold is enforced in CI configuration (build fails when line or branch coverage drops below the defined minimum).
  • Coverage report is published as a CI artifact (HTML report and json-summary) and linked from PR comments showing per-PR coverage delta.
  • Meaningful vs. vanity coverage distinction is documented for the codebase: excluded paths are listed and justified (generated code, barrel exports, type definitions), and per-directory thresholds are set higher for critical paths such as payments and auth.
  • Coverage-as-ratchet is configured so the threshold only goes up: .coverage-ratchet.json is committed, the ratchet script runs in CI, and the build fails if coverage regresses from the recorded baseline.

Related Skills

  • unit-testing -- Test writing patterns, mocking strategies, and framework-specific coverage configuration.
  • ci-cd-integration -- Pipeline configuration for coverage gates, artifact storage, and PR comments.
  • qa-metrics -- Quality KPIs including coverage trends, mutation scores, and defect escape rates.
  • ai-qa-review -- AI-assisted identification of coverage gaps and undertested code paths.

适合场景

01

研究助手

02

事实核查

03

知识库问答

04

带来源的搜索总结

能力概览

能力 1

组合搜索和大模型调用

能力 2

支持多来源检索和总结

能力 3

强调引用来源和事实核查

能力 4

适合研究型 Agent 流程

平台分布

Codex

38%
按下载量换算42

Claude

31.08%
按下载量换算34

Cursor

18.35%
按下载量换算20

Gemini CLI

9.5%
按下载量换算10

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills