/harness-claude:test-coverage-patternsfrom harness-claude
Configures test coverage thresholds in Vitest, interprets coverage metrics (lines, branches, functions, statements), and sets up CI quality gates with ratcheting strategies.
Claude never picks this skill on its own
Its frontmatter has no description. Without a description, Claude Code leaves it out of the list Claude chooses from. Typing /harness-claude:test-coverage-patterns still runs it.
What the skill costs in Claude's context, stage by stage
No description Claude Code can read, so Claude's list leaves it out: only you can start it.
SKILL.md joins the conversation and stays.
Configure and interpret test coverage thresholds for meaningful quality signals
// vitest.config.ts
export default defineConfig({
test: {
coverage: {
provider: 'v8', // or 'istanbul'
reporter: ['text', 'html', 'lcov'],
include: ['src/**/*.ts'],
exclude: ['src/**/*.test.ts', 'src/**/*.d.ts', 'src/**/index.ts'],
},
},
});
Run with: vitest --coverage
coverage: {
thresholds: {
branches: 80,
functions: 80,
lines: 80,
statements: 80,
},
},
CI fails if coverage drops below these thresholds.
coverage: {
thresholds: {
'src/services/**': { branches: 90, functions: 90, lines: 90, statements: 90 },
'src/utils/**': { branches: 70, functions: 70, lines: 70, statements: 70 },
},
},
if/else, switch, ternary paths takenBranch coverage is the most meaningful metric. A file can have 100% line coverage but miss error-handling branches.
coverage: {
exclude: [
'src/**/*.test.ts',
'src/**/*.stories.ts',
'src/generated/**',
'src/**/index.ts', // barrel files
'src/**/*.d.ts',
'src/main.ts', // entry point
],
},
/* v8 ignore next */ or /* istanbul ignore next */ sparingly for code that cannot be tested:/* v8 ignore next 3 */
if (process.env.NODE_ENV === 'development') {
enableDevTools();
}
vitest --coverage
open coverage/index.html
The HTML report highlights uncovered lines in red and shows branch coverage inline.
// Start low, increase as coverage improves
coverage: {
thresholds: {
lines: 60, // Current: 62% — ratchet up as tests are added
branches: 50, // Current: 53%
},
},
Code coverage measures which lines, branches, and functions your tests exercise. It is a negative indicator — low coverage definitively means undertested code. High coverage does NOT mean well-tested code.
V8 vs Istanbul providers:
Coverage anti-patterns:
Meaningful thresholds by code type:
Coverage in CI:
lcov reporter for SonarQube, Codecov, or Coveralls integrationTrade-offs:
https://vitest.dev/guide/coverage.html
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeRead when SKILL.md points to them.
793 skills in this plugin
/a11y-aria-patternsARIA Patterns> Apply ARIA roles, states, and properties correctly to enhance assistive technology support for custom widgets/a11y-color-contrastColor Contrast and Color Independence> Ensure sufficient color contrast ratios and never use color as the sole means of conveying information/a11y-form-patternsAccessible Form Patterns> Build accessible forms with proper labeling, grouped controls, inline validation, and clear error communicationOther plugins' skills for the same job