Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计通过

analyzing-test-coverage分析测试覆盖率

Agent Skill

用于辅助测试设计、自动化测试、用例整理和回归验证。它适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。使用时需要确认项目测试框架、运行命令和夹具数据,避免为了通过测试而改坏真实逻辑;涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。

总安装

729

周安装

31

GitHub Stars

2,108

下载量

255
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/jeremylongshore/claude-code-plugins-plus-skills --skill analyzing-test-coverage

简介

analyzing-test-coverage 用于辅助测试设计、自动化测试和回归验证,适合让 Agent 编写单元测试或根据日志定位问题。

  • 适用于软件开发中的测试用例生成和问题排查场景。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装,需确认权限和维护状态。
  • 使用前建议核实项目测试框架、运行命令和夹具数据配置。
  • 涉及浏览器或外部服务时,应区分本地模拟与生产环境。

SKILL.md

Test Coverage Analyzer

Current State

!ls package.json pyproject.toml Cargo.toml go.mod 2>/dev/null || echo 'No project manifest found'!node -v 2>/dev/null || python3 --version 2>/dev/null || echo 'No runtime detected'

Overview

Analyze code coverage metrics to identify untested code paths, dead code, and coverage gaps across line, branch, function, and statement dimensions. Supports Istanbul/nyc (JavaScript/TypeScript), coverage.py (Python), JaCoCo (Java), and Go coverage tools.

Prerequisites

  • Coverage tool installed and configured (Istanbul/nyc, c8, coverage.py, JaCoCo, or go test -cover)
  • Test suite that can run with coverage instrumentation enabled
  • Coverage threshold targets defined (recommended: 80% lines, 70% branches)
  • Coverage output format set to JSON or LCOV for programmatic analysis
  • Git history available for coverage trend comparison

Instructions

  1. Run the test suite with coverage instrumentation enabled:

- JavaScript: npx jest --coverage --coverageReporters=json-summary,lcov - Python: pytest --cov=src --cov-report=json --cov-report=term-missing - Go: go test -coverprofile=coverage.out./... - Java: Configure JaCoCo Maven/Gradle plugin with XML report output.

  1. Parse the coverage report and extract per-file metrics:

- Line coverage percentage per file. - Branch coverage percentage per file. - Function coverage percentage per file. - Uncovered line ranges (specific line numbers).

  1. Identify critical coverage gaps by prioritizing:

- Files with coverage below the threshold (sort ascending by coverage %). - Files with high complexity but low coverage (use cyclomatic complexity if available). - Recently modified files with decreasing coverage trends. - Public API functions and exported modules lacking any tests.

  1. Analyze uncovered branches specifically:

- Find if/else blocks where only one branch is tested. - Identify switch/case statements with missing case coverage. - Locate error handling paths (catch, except) never exercised. - Check || and && short-circuit conditions.

  1. Generate a prioritized action plan:

- List top 10 files needing coverage improvement with specific line ranges. - Suggest test scenarios for each uncovered branch. - Estimate effort (small/medium/large) for each coverage improvement.

  1. Compare current coverage against the previous commit or baseline:

- Calculate coverage delta per file. - Flag files where coverage decreased. - Verify new code added since baseline has adequate coverage.

  1. Write coverage enforcement configuration (coverage thresholds in Jest config, .coveragerc, or CI checks).

Output

  • Coverage summary report with overall and per-file metrics
  • Prioritized list of uncovered code paths with file:line references
  • Coverage delta report comparing against baseline
  • Suggested test cases for top coverage gaps
  • Coverage threshold configuration file for CI enforcement

Error Handling

ErrorCauseSolution
Coverage report shows 0%Tests ran but coverage instrumentation was not enabledVerify --coverage flag is passed; check that source files are not excluded by config
Coverage includes node_modulesCoverage collection scope too broadAdd collectCoverageFrom in Jest config; set --cov=src in pytest; exclude vendor dirs
Branch coverage much lower than line coverageConditional logic is only partially testedWrite tests for both truthy and falsy conditions on each branch; focus on edge cases
Coverage drops after refactorNew code added without corresponding testsSet coverageThreshold with global minimums; add --changedSince for incremental checks
Flaky coverage numbers between runsNon-deterministic test execution skipping code pathsSort tests deterministically; run coverage with --runInBand for consistent results

Examples

Jest coverage configuration with thresholds:

{
  "jest": {
    "coverageThreshold": {
      "global": {
        "branches": 70,
        "functions": 80,
        "lines": 80,
        "statements": 80
      },
      "src/utils/": {
        "branches": 90,
        "lines": 95
      }
    },
    "collectCoverageFrom": [
      "src/**/*.{ts,tsx}",
      "!src/**/*.d.ts",
      "!src/**/index.ts"
    ]
  }
}

Coverage gap analysis output:

Coverage Gaps (sorted by impact):
1. src/auth/oauth.ts        Lines: 45%  Branches: 30%  [Lines 42-67, 89-103 uncovered]
   Suggestion: Add tests for token refresh failure and expired session handling
2. src/api/middleware.ts     Lines: 62%  Branches: 41%  [Lines 28-35, 71-80 uncovered]
   Suggestion: Test rate limiting edge cases and malformed header handling
3. src/utils/parser.ts       Lines: 71%  Branches: 55%  [Lines 112-130 uncovered]
   Suggestion: Test malformed input, empty string, and encoding edge cases

Resources

适合场景

01

研究助手

02

事实核查

03

知识库问答

04

带来源的搜索总结

能力概览

能力 1

组合搜索和大模型调用

能力 2

支持多来源检索和总结

能力 3

强调引用来源和事实核查

能力 4

适合研究型 Agent 流程

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.45%
按下载量换算95

Claude

31.9%
按下载量换算81

Cursor

17.21%
按下载量换算44

Gemini CLI

9.6%
按下载量换算24

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

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

来源信息

继续浏览同类 Skills