Vitest Coverage Planning Capability Pack Skill
Expert Vitest coverage planning skill for choosing providers, scoping reports, setting thresholds, triaging gaps, and designing practical coverage gates.
Open the source and read safety notes before installing.
Safety notes
- Installing Vitest and coverage providers adds npm packages to the selected project environment; pin reviewed versions and use project-local installs.
- Coverage runs execute the project test suite and can use test fixtures, network mocks, databases, or generated artifacts configured by the project.
- Vitest coverage can clean the configured reports directory before a run; confirm the reports directory is disposable before enabling coverage in shared workflows.
- Threshold changes can block or unblock CI; review threshold updates separately from test additions.
- The source ZIP is external and version-pinned for reference; package trust should remain a maintainer decision.
Privacy notes
- Coverage output can reveal source paths, module names, uncovered function names, branch structure, report file names, and project layout.
- HTML, JSON, LCOV, and JUnit artifacts can include snippets, line ranges, and package structure from the reviewed project.
- Keep public review notes focused on aggregate gaps, file groups, risk areas, and validation commands; omit sensitive implementation details that do not need to be public.
Prerequisites
- JavaScript or TypeScript project using Vitest or evaluating a Vitest coverage gate
- Test command, package manager, and `vitest.config` or Vite config
- Current coverage report, changed-file context, or uncovered source inventory
- Project risk areas, owner expectations, and release policy for test gaps
- Agreement on whether coverage is advisory, blocking, per-file, or trend-based
Schema details
- Install type
- package
- Reading time
- 9 min
- Troubleshooting
- Yes
- Scope
- Source repo
- Skill type
- capability-pack
- Skill level
- expert
- Verification
- validated
- Verified at
- 2026-06-03
| Platform | Support | Install path |
|---|---|---|
| claude-code | Native | .claude/skills/<skill-name>/SKILL.md |
| codex | Native | .agents/skills/<skill-name>/SKILL.md |
| windsurf | Native | .windsurf/skills/<skill-name>/SKILL.md |
| gemini | Native | .gemini/skills/<skill-name>/SKILL.md or .agents/skills/<skill-name>/SKILL.md |
| cursor | Adapter | .cursor/rules/<skill-name>.mdc |
| cli | Manual | AGENTS.md or tool-specific context file |
Full copyable content
# Trigger
"Apply the Vitest coverage planning capability pack to this test coverage gap."
# Required output
1) Vitest package/source version and coverage provider inventory
2) Coverage scope, include/exclude, reporters, and threshold review
3) Coverage gap findings with prioritized test-plan recommendations
4) Validation plan and merge, hold, or follow-up recommendationAbout this resource
Knowledge Freshness
This capability pack is pinned to Vitest 4.1.8, source tag v4.1.8, npm metadata, and coverage documentation verified on 2026-06-03. The reviewed package metadata requires Node ^20.0.0, ^22.0.0, or >=24.0.0.
Retrieval Sources
- https://vitest.dev/guide/coverage.html
- https://vitest.dev/config/coverage.html
- https://vitest.dev/guide/reporters.html
- https://vitest.dev/guide/cli.html
- https://github.com/vitest-dev/vitest/releases/tag/v4.1.8
- https://registry.npmjs.org/vitest/4.1.8
- https://raw.githubusercontent.com/vitest-dev/vitest/v4.1.8/packages/vitest/package.json
- https://raw.githubusercontent.com/vitest-dev/vitest/v4.1.8/docs/guide/coverage.md
- https://raw.githubusercontent.com/vitest-dev/vitest/v4.1.8/docs/config/coverage.md
- https://raw.githubusercontent.com/vitest-dev/vitest/v4.1.8/docs/guide/cli.md
Prefer current Vitest docs, npm metadata, and pinned source files over model memory for provider behavior, coverage options, thresholds, reporters, and CLI behavior.
Scope Note
This is not a generic TDD rule pack, a stop-hook coverage report, or a test-suite generation command. Use it for human-in-the-loop planning of Vitest coverage scope, provider choice, gap triage, threshold policy, changed-file reports, and release gates.
Core Workflow
- Confirm Vitest version, Node runtime, package manager, coverage provider package, source tag, and coverage command used for review.
- Inventory test configuration:
vitest.config, Vite config,test.coverage, scripts, reporters, output files, and CI command. - Choose or validate provider strategy. Use V8 when fast runtime collection fits the environment; consider Istanbul when instrumentation scope or non-V8 runtime constraints matter.
- Review coverage scope:
coverage.include,coverage.exclude, uncovered-file inclusion, generated files, test files, fixtures, and package boundaries. - Review report settings:
reportsDirectory, reporter list, LCOV/JSON/HTML/JUnit needs,reportOnFailure, and whether the report format supports the reviewer workflow. - Review thresholds: lines, functions, branches, statements, per-file behavior, negative uncovered-item limits, and any auto-update policy.
- Triage gaps by product risk rather than percentage alone: core flows, error paths, adapters, edge cases, state transitions, and recent change areas.
- Build a coverage plan: tests to add, tests to refactor, low-value files to exclude with rationale, thresholds to ratchet, and checks to run before merge.
- Produce a recommendation with blockers, safe follow-ups, threshold proposal, validation commands, and owner decisions.
Capability Scope
- Vitest package/source verification
- Coverage provider selection
- Coverage include/exclude review
- Threshold and per-file policy review
- Reporter and artifact planning
- Changed-file coverage triage
- Coverage gap prioritization
- Evidence-based merge or follow-up recommendation
Compatibility
Native
- Claude Code / Claude: use as a reusable Agent Skill for Vitest coverage planning and test-gap review.
- Codex/OpenAI workflows: use as
SKILL.md-style instructions for coverage review and release-gate planning.
Manual Adaptation
- Windsurf and Gemini: adapt the workflow and output contract into their skill formats.
- Cursor and Generic AGENTS files: convert the production rules and validation checklist into repository-level test coverage guidance.
Required Inputs
- Vitest version and coverage provider package
- Test command and package manager
vitest.configor Vite config- Current coverage output or changed-file context
- Project risk areas and release policy
- Owner expectations for thresholds, exclusions, and follow-up work
Production Rules
- Do not judge test adequacy by aggregate percentage alone; connect gaps to product risk and recent changes.
- Do not add broad exclusions without a written reason and owner agreement.
- Treat threshold decreases, auto-update changes, and per-file policy changes as release-impacting until reviewed.
- Include uncovered source files intentionally; otherwise untouched files can disappear from the report.
- Keep generated code, fixtures, and test helpers out of coverage only when the exclusion is deliberate.
- Prefer small, risk-based threshold ratchets over unrealistic all-at-once coverage targets.
- Keep coverage planning separate from test execution success; passing tests can still leave critical branches uncovered.
Output Contract
- Source evidence: Vitest version, source tag, npm metadata, coverage docs, and config files reviewed.
- Configuration inventory: provider, include/exclude, reporters, reports directory, thresholds, and CI command.
- Gap analysis: uncovered file groups, branches, functions, changed files, and risk areas.
- Coverage plan: test additions, refactors, exclusions, threshold ratchets, and owner follow-up.
- Validation plan: exact coverage command, focused test command, report artifact, and CI gate.
- Recommendation: merge, hold, request changes, or accept with tracked follow-up.
Troubleshooting
Issue: Coverage report ignores untouched source files
Fix: Configure coverage.include with source globs so uncovered files are present in the report.
Issue: V8 coverage is unexpectedly slow
Fix: Check module count and runtime environment. Compare V8 with Istanbul when instrumentation can limit the measured file set.
Issue: Thresholds fail on unrelated files
Fix: Separate global and per-file thresholds, check changed-file scope, and decide whether the failure reflects product risk or stale baseline policy.
Issue: Report artifacts are too noisy for review
Fix: Use targeted reporters such as text-summary, LCOV, JSON, or JUnit depending on whether reviewers need quick triage, CI annotations, or trend ingestion.
Issue: Coverage improves but misses important behavior
Fix: Review branch and function coverage for core workflows, error paths, adapters, and state transitions instead of relying only on line coverage.
Validation Checklist
- Vitest version, source tag, npm metadata, and coverage docs verified.
- Node runtime requirement checked.
- Coverage provider selected and provider package identified.
- Include/exclude scope reviewed.
- Reports directory and reporter list checked.
- Thresholds reviewed for global, per-file, and uncovered-item behavior.
- Changed-file and product-risk gaps triaged.
- Exclusions documented with rationale.
- Validation commands and artifacts recorded.
- Merge, hold, request-changes, or follow-up recommendation documented.
Source citations
Signals
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.