Token导航 LogoToken导航

Agent Skill · 研究检索

test-coverage(测试覆盖率)

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

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

总安装 261周安装 11GitHub Stars 14下载 92核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

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

这个 Skill 是做什么的

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

test-coverage 用于审计测试缺口、编写定向测试并强制执行覆盖率阈值,覆盖任意技术栈。它遵循测试金字塔原则,强调单元测试为主、集成与 E2E 为辅的经济性平衡。适用于回归防护而非质量衡量,需配合 CI/CD 流程使用。安装前建议确认项目测试框架和报告格式兼容性。

适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

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

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

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

常见问题

6 条

test-coverage 怎么安装?

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

test-coverage 支持哪些 AI 工具?

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

test-coverage 需要什么权限?

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

test-coverage 是免费的吗?

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

test-coverage 用的人多吗?

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

test-coverage 安全吗?

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

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

值得选的地方

  • 同时适配 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调用外部服务未明确有提醒
test-coverage

测试覆盖率 · 本页

26114操作浏览器未明确通过

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

SKILL.md 原文

Test Coverage

Audit gaps, write targeted tests, enforce thresholds — across any ecosystem.

Mental Model

The testing pyramid encodes an economic truth: each tier tests what only it can test.

TierTestsCost to writeCost to run
UnitPure functions, domain logic, validation, parsingLowMilliseconds
IntegrationDatabase queries, API boundaries, access control, service interactionsMediumSeconds
ComponentRendered UI in a real browser, user interactions, visual statesMediumSeconds
E2EFull user flows across the entire stackHighMinutes

Coverage is a regression gate, not a quality metric. High coverage with bad tests is worse than moderate coverage with good tests. The goal is: new code cannot silently skip tests.

Exclusions are architecture, not exceptions. Every exclusion documents a deliberate decision about where code is tested. An exclusion at one tier should have coverage at another.

Decision Tree

Start here. Follow the branch that matches the current state.

Is there any coverage tooling configured?
├── No → Bootstrap (below)
└── Yes
    ├── Coverage below target? → Audit & Improve (below)
    ├── Coverage adequate but not enforced? → Enforce (below)
    └── Coverage enforced, writing new code? → Write Tests for New Code (below)

Bootstrap: Setting Up Coverage from Scratch

1. Detect the ecosystem

Check for project markers: package.json, go.mod, Cargo.toml, pyproject.toml, setup.py, *.csproj. See ecosystem patterns for tool recommendations per language.

2. Create tiered configs

Each test tier gets its own configuration file with targeted include/exclude patterns. This prevents slow integration tests from blocking fast unit test feedback.

Key principles:

  • Each tier has a separate include pattern matching only its source files
  • Each tier has a separate coverage output directory (avoids conflicts)
  • CI vs local reporter selection: text-summary locally, full HTML/JSON/LCOV in CI

TypeScript/Vitest example structure:

vitest.unit.config.mts    → tests/unit/**/*.unit.spec.ts    → coverage/unit/
vitest.int.config.mts     → tests/int/**/*.int.spec.ts      → coverage/int/
vitest.browser.config.mts → tests/components/**/*.spec.tsx   → coverage/components/

Python example:

pytest -m unit --cov --cov-report=html:coverage/unit
pytest -m integration --cov --cov-report=html:coverage/int

3. Set initial thresholds

Run coverage once, note the baseline. Set thresholds at the current level — this prevents regression while you improve.

# Example: start where you are
thresholds: { lines: 72 }  # measured baseline

Then ratchet up as you add tests. Never ratchet down. See enforcement for the full ratcheting strategy.

4. Add coverage scripts

Create per-tier scripts in your project manifest:

{
  "test:unit": "vitest run --config ./vitest.unit.config.mts",
  "test:unit:coverage": "vitest run --coverage --config ./vitest.unit.config.mts",
  "test:int": "vitest run --config ./vitest.int.config.mts",
  "test:int:coverage": "vitest run --coverage --config ./vitest.int.config.mts",
  "test:components": "vitest run --coverage --config ./vitest.browser.config.mts",
  "test:e2e": "playwright test",
  "test": "pnpm test:unit && pnpm test:int && pnpm test:components && pnpm test:e2e"
}

Audit & Improve: Closing Coverage Gaps

Phase 1: Audit

Run coverage for each tier and examine the output.

# Run with coverage, examine the HTML report or text output
<runner> --coverage

Identify three categories:

  • Untested files — no coverage at all (highest priority)
  • Untested branches — code paths never exercised
  • Untested functions — declared but never called in tests

Phase 2: Classify each gap

For every uncovered file or function, ask:

QuestionIf yesIf no
Business logic or domain rules?Unit tests (highest priority)Continue
Access control or authorisation?Integration testsContinue
Data validation or parsing?Unit testsContinue
API endpoint or mutation?Integration testsContinue
UI component with logic?Component testsContinue
Full user flow?E2E testsContinue
Can it run in the test environment?Write testsDocument exclusion
Auto-generated code?Exclude with commentWrite tests
Thin wrapper around tested library?Consider excludingWrite tests

Phase 3: Prioritise

Triage order (highest value first):

  1. Domain logic and business rules (unit)
  2. Access control and authorisation (integration)
  3. Data validation and input parsing (unit)
  4. API endpoints and mutations (integration)
  5. UI components with conditional logic (component)
  6. Async/server-rendered components (E2E)
  7. Configuration and wiring (tested implicitly by higher tiers)

Phase 4: Write tests

For each gap, follow the appropriate tier's patterns. Test expected behaviour through the public API, not implementation details.

Unit tests: Pure input → output. No database, no network, no filesystem.

describe('slugify', () => {
  it('converts spaces to hyphens', () => {
    expect(slugify('hello world')).toBe('hello-world')
  })
  it('handles empty string', () => {
    expect(slugify('')).toBe('')
  })
})

Integration tests: Real database, real service boundaries, no mocks for things you own.

it('enforces access control on draft posts', async () => {
  const result = await payload.find({
    collection: 'posts',
    where: { _status: { equals: 'draft' } },
    overrideAccess: false,
    user: anonymousUser,
  })
  expect(result.docs).toHaveLength(0)
})

Component tests: Real browser, real DOM queries (accessibility-first via testing-library).

it('renders film title and year', () => {
  render(<FilmCard film={mockFilm} />)
  expect(screen.getByText('Film Title')).toBeInTheDocument()
  expect(screen.getByText('2024')).toBeInTheDocument()
})

E2E tests: Full user flows, real navigation, real network.

test('user can submit a form', async ({ page }) => {
  await page.goto('/submit')
  await page.fill('[name="title"]', 'My Film')
  await page.click('button[type="submit"]')
  await expect(page).toHaveURL(/\/confirmation/)
})

See ecosystem patterns for language-specific runner syntax and config examples.

Enforce: Wiring Coverage into Hooks and CI

Pre-commit (composes with hk)

If using the hk skill, add coverage test steps to hk.pkl:

["test-unit"] {
  check = "scripts/quiet-on-success.sh pnpm test:unit:coverage"
}
["test-int"] {
  check = "scripts/quiet-on-success.sh pnpm test:int:coverage"
  depends = List("test-unit")
}

Key principles:

  • Coverage thresholds live in the test config, not in hook config
  • E2E tests are too slow for pre-commit — run in CI or manually
  • Order tiers by speed: unit first (fastest fail), then integration, then components
  • Wrap in quiet-on-success so passing tests produce no output

CI

Run all tiers with coverage in CI. Upload per-tier reports separately for visibility.

- name: Unit tests
  run: pnpm test:unit:coverage
- name: Integration tests
  run: pnpm test:int:coverage
- name: E2E tests
  run: pnpm test:e2e

Ratcheting

For projects not yet at target:

  1. Measure current coverage
  2. Set threshold at current level
  3. After each improvement, bump the threshold
  4. Never lower it

See enforcement for detailed CI patterns, PR checks, and ratcheting workflow.

Write Tests for New Code

When adding features to a codebase with established coverage:

  1. Identify the tier: What kind of code are you writing? Match to the classification table above
  2. Write tests first (TDD): Test the expected behaviour before implementing
  3. Run coverage locally: --coverage for the relevant tier
  4. Handle exclusions: If code genuinely cannot be tested at this tier, document why and ensure coverage exists at another tier
  5. Verify thresholds pass: Pre-commit hooks catch regressions, but check early

Cross-tier exclusion pattern

Every exclusion at one tier names the tier that provides coverage:

// Unit config excludes:
// Cross-tier: Service layer - requires database runtime - tested via integration tests
"src/domain/**/service.ts",

// Integration config excludes:
// Cross-tier: React components - requires browser context - tested via component + E2E tests
"src/components/**",

See coverage exclusions for the full exclusion taxonomy and documentation format.

Test Organisation Patterns

Directory structure

tests/
  unit/          *.unit.spec.ts       Pure functions, domain logic
  int/           *.int.spec.ts        Database, API, access control
  components/    *.browser.spec.tsx   Rendered UI in real browser
  e2e/           *.e2e.spec.ts        Full user flows
  fixtures/      index.ts             Shared test data factories
  setup/         Per-tier setup files (DB init, browser cleanup)

Naming conventions

Suffix encodes the tier — config include patterns use these suffixes for zero-ambiguity matching:

TierSuffixExample
Unit.unit.spec.tsslugify.unit.spec.ts
Integration.int.spec.tsfilms.int.spec.ts
Component.browser.spec.tsxFilmCard.browser.spec.tsx
E2E.e2e.spec.tsauth.e2e.spec.ts

Test data factories

Use factory functions with auto-incrementing counters for unique identifiers:

let counter = 0
function createTestUser(overrides = {}) {
  counter++
  return {
    email: `test-${counter}@example.com`,
    name: `Test User ${counter}`,
    ...overrides,
  }
}

Counter-based (not random) for deterministic debugging. Reset between test runs if needed.

Mock boundaries

  • Do mock: External APIs, third-party SDKs, environment-specific runtimes
  • Do not mock: Code you own — test through the public API
  • Database: Use a real local database for integration tests (SQLite, test containers)
  • Browser: Use a real browser for component tests (Playwright, Vitest browser mode)
  • Server-side imports: Stub server-only modules when testing in browser context

Coverage Providers: Quick Reference

ProviderEnvironmentWhen to useLimitations
v8Node.jsUnit, integration testsNot supported in browser mode
IstanbulBrowserComponent testsIgnore comments may not survive bundling
c8Node.js CLIStandalone v8 wrapperAlternative to built-in coverage
coverage.pyPythonAll tiers via pytest-covRequires source mapping for packages
go coverGoBuilt-in, all tiersPer-package profiles need merging
tarpaulinRustCargo integrationMay miss some async code paths
llvm-covRustHigher accuracyRequires nightly or specific toolchain
lcovAnyMerging multi-tier reportsFormat standard, not a provider

Gotchas

IssueFix
v8 undercounts arrow functionsLower functions threshold or restructure code
Istanbul ignore comments stripped by bundlerUse file-level exclusions in config instead
Concurrent DB writes in integration testsDisable parallelism, use single worker
Coverage directories conflict across tiersSeparate reportsDirectory per tier config
E2E tests too slow for pre-commitRun in CI only; document in project README
Ignore comment used without justificationAlways add a reason after the ignore directive
Coverage passes but tests are meaninglessReview test quality, not just the metric
New file added with no testsThreshold regression catches it at commit time
Browser tests import server-only codeCreate stub modules, alias in browser config
Flaky tests in pre-commit hooksInvestigate root cause; do not retry or skip

References

- TypeScript/JS | Python | Go | Rust | Merging

适合场景

01

研究助手

02

事实核查

03

知识库问答

04

带来源的搜索总结

能力概览

能力 1

组合搜索和大模型调用

能力 2

支持多来源检索和总结

能力 3

强调引用来源和事实核查

能力 4

适合研究型 Agent 流程

平台分布

Codex

35.13%
按下载量换算32

Claude

31.38%
按下载量换算29

Cursor

21.05%
按下载量换算19

Gemini CLI

9.86%
按下载量换算9

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

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

安装前确认

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

继续浏览同类 Skills