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

test-coverage测试覆盖率

Agent Skill

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

总安装

1,473

周安装

59

GitHub Stars

68

下载量

477
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/luongnv89/skills --skill test-coverage

简介

test-coverage 用于辅助测试设计、自动化测试、用例整理和回归验证。

  • 适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。
  • 使用时需要确认项目测试框架、运行命令和夹具数据,避免改坏真实逻辑。
  • 涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Test Coverage Expander

Expand unit test coverage by targeting untested branches and edge cases.

When to Use

  • User asks to "increase test coverage", "add more tests", "expand unit tests", or "cover edge cases"
  • A CI pipeline reports low coverage and the user wants it improved
  • A code review flags untested error paths or boundary conditions
  • The user wants to identify and fill gaps in an existing test suite before a release

Instructions

  1. Sync the branch with remote (see Repo Sync section below)
  2. Create a feature branch for the new tests
  3. Run the project's coverage tool to get a baseline report
  4. Identify the lowest-coverage files and untested code paths
  5. Write tests for error paths, boundary values, and missing branches
  6. Re-run coverage to confirm improvement
  7. Commit the new tests with a descriptive message

Repo Sync Before Edits (mandatory)

Before creating/updating/deleting files in an existing repository, sync the current branch with remote:

branch="$(git rev-parse --abbrev-ref HEAD)"
git fetch origin
git pull --rebase origin "$branch"

If the working tree is not clean, stash first, sync, then restore:

git stash push -u -m "pre-sync"
branch="$(git rev-parse --abbrev-ref HEAD)"
git fetch origin && git pull --rebase origin "$branch"
git stash pop

If origin is missing, pull is unavailable, or rebase/stash conflicts occur, stop and ask the user before continuing.

Workflow

0. Create Feature Branch

Before making any changes:

  1. Check the current branch - if already on a feature branch for this task, skip
  2. Check the repo for branch naming conventions (e.g., feat/, feature/, etc.)
  3. Create and switch to a new branch following the repo's convention, or fallback to: feat/test-coverage

1. Analyze Coverage

Detect the project's test runner and run the coverage report:

  • JavaScript/TypeScript: npx jest --coverage or npx vitest --coverage
  • Python: pytest --cov=. --cov-report=term-missing
  • Go: go test -coverprofile=coverage.out./...
  • Rust: cargo tarpaulin or cargo llvm-cov

From the report, identify:

  • Untested branches and code paths
  • Low-coverage files/functions (prioritize files below 60%)
  • Missing error handling tests

2. Identify Test Gaps

Review code for:

  • Logical branches (if/else, switch)
  • Error paths and exceptions
  • Boundary values (min, max, zero, empty, null)
  • Edge cases and corner cases
  • State transitions and side effects

3. Write Tests

Use project's testing framework:

  • JavaScript/TypeScript: Jest, Vitest, Mocha
  • Python: pytest, unittest
  • Go: testing, testify
  • Rust: built-in test framework

Target scenarios:

  • Error handling and exceptions
  • Boundary conditions
  • Null/undefined/empty inputs
  • Concurrent/async edge cases

4. Verify Improvement

Run coverage again and confirm measurable increase. Report:

  • Before/after coverage percentages
  • Number of new test cases added
  • Files with the biggest coverage gains

Expected Output

After a successful run on a Python project, the final verification report shows:

Coverage before: 61% (47/77 statements)
Coverage after:  84% (65/77 statements)

New tests added: 9
Files improved:
  - src/parser.py        52% → 91%  (+7 tests: null input, empty string, unicode overflow)
  - src/auth.py          71% → 88%  (+2 tests: expired token, missing header)

All 56 tests passing. No regressions.

Acceptance Criteria

A run passes when all of the following are true:

  • Coverage report exists from a runnable command for the detected stack (e.g., jest --coverage, pytest --cov, go test -cover).
  • Post-run total coverage is strictly higher than the pre-run baseline — no test additions that fail to move the metric.
  • New tests target previously-untested branches, error paths, or boundary values — not duplicates of existing assertions.
  • The full test suite passes locally before committing (npm test, pytest, go test./..., etc.).
  • All new tests live on a feature branch (e.g., feat/test-coverage), never on main/master.
  • Commit message records the before/after coverage percentages and the files newly covered.

Edge Cases

  • No test framework detected: Skill checks package.json, pyproject.toml, Cargo.toml, or go.mod for test dependencies; if none found, asks the user which framework to use before writing any tests.
  • Coverage tool not installed: Installs the appropriate tool (pytest-cov, nyc, cargo tarpaulin, etc.) and retries rather than failing silently.
  • Existing tests are already failing: Does not add new tests until existing failures are resolved; reports the failing tests to the user first.
  • 100% coverage already reached: Reports this to the user and exits — no tests are added unnecessarily.
  • Generated code or vendored files in coverage report: Excludes auto-generated and third-party directories from analysis to avoid writing tests for code the project does not own.
  • Async / concurrent code paths: Uses framework-appropriate async test utilities (e.g., pytest-asyncio, jest fakeTimers) rather than bare sync wrappers.

Step Completion Reports

After completing each major step, output a status report in this format:

◆ [Step Name] ([step N of M] — [context])
··································································
  [Check 1]:          √ pass
  [Check 2]:          √ pass (note if relevant)
  [Check 3]:          × fail — [reason]
  [Check 4]:          √ pass
  [Criteria]:         √ N/M met
  ____________________________
  Result:             PASS | FAIL | PARTIAL

Adapt the check names to match what the step actually validates. Use for pass, × for fail, and to add brief context. The "Criteria" line summarizes how many acceptance criteria were met. The "Result" line gives the overall verdict.

Branch Setup phase checks: Feature branch created, Base coverage measured

Analysis phase checks: Coverage report parsed, Gaps identified, Priority ranked

Test Writing phase checks: Tests written, Edge cases covered, Framework conventions followed

Verification phase checks: Tests pass, Coverage improved, No regressions

Error Handling

No test framework detected

Solution: Check package.json, pyproject.toml, Cargo.toml, or go.mod for test dependencies. If none found, ask the user which framework to use and install it.

Coverage tool not installed

Solution: Install the appropriate coverage tool (nyc, pytest-cov, etc.) and retry.

Existing tests failing

Solution: Do not add new tests until existing failures are resolved. Report failing tests to the user first.

Guidelines

  • Follow existing test patterns and naming conventions
  • Place test files alongside source or in the project's existing test directory
  • Group related test cases logically
  • Use descriptive test names that explain the scenario
  • Do not mock what you do not own — prefer integration tests for external boundaries

适合场景

01

研究助手

02

事实核查

03

知识库问答

04

带来源的搜索总结

能力概览

能力 1

组合搜索和大模型调用

能力 2

支持多来源检索和总结

能力 3

强调引用来源和事实核查

能力 4

适合研究型 Agent 流程

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

平台分布

Codex

36.07%
按下载量换算172

Claude

32.17%
按下载量换算153

Cursor

17.47%
按下载量换算83

Gemini CLI

9.69%
按下载量换算46

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

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

来源信息

继续浏览同类 Skills