skills/husky-test-coverage/SKILL.md
Sets up or verifies Husky git hooks to enforce test coverage above 80% (configurable) for Node.js/TypeScript projects. Activates when enforcing coverage through pre-commit hooks, verifying existing Husky/test setup, or configuring coverage thresholds for Jest, Vitest, or Mocha test runners.
npx skillsauth add shipshitdev/library husky-test-coverageInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Set up or verify Husky git hooks to ensure tests run and coverage thresholds are enforced on every commit.
Check package.json:
Identify Test Runner:
jest in dependencies, look for jest.config.js or jest.config.jsonvitest in dependencies, look for vitest.config.ts or vitest.config.jsmocha in dependencies, check for coverage tool (nyc, c8)Check Coverage Configuration:
coverageThreshold in jest.config.*coverage.thresholds in vitest.config.*.nycrc.json or coverage config in package.jsonVerify Existing Husky Setup:
.husky/ directory existsDetect Test Files:
*.test.* or *.spec.* filespython3 ${CLAUDE_SKILL_DIR}/scripts/setup-husky-coverage.py --root /path/to/project
python3 ${CLAUDE_SKILL_DIR}/scripts/setup-husky-coverage.py --root /path/to/project --dry-run
See references/full-guide.md (§ Quick Start Examples) for threshold, warn-only, and skip-if-no-tests invocations.
bunx husky install).husky/pre-commit hook that runs tests with coverageprepare script to package.json (if missing)The skill automatically detects:
jest --coverage --watchAll=false in pre-commit hookvitest --coverage --run in pre-commit hooknyc or c8 with mocha test commandJest:
jest.config.json with coverageThresholdVitest:
vitest.config.ts/js with coverage thresholdsMocha + nyc:
.nycrc.json with coverage thresholdsThe created hook:
--root <path>: Project root directory (required)--threshold <number>: Coverage threshold percentage (default: 80)--fail-on-below: Fail commit if coverage below threshold (default: true)--no-fail-on-below: Allow commit even if coverage below threshold--skip-if-no-tests: Skip hook if no test files found--dry-run: Show what would be done without making changesCreate .husky-test-coverage.json in project root. See references/full-guide.md (§ .husky-test-coverage.json Example) for the full schema.
Alternatively, add to package.json:
{
"huskyTestCoverage": {
"threshold": 80,
"failOnBelow": true
}
}
Detection:
jest in dependenciesjest.config.js or jest.config.jsonConfiguration:
jest.config.json with coverage thresholdsbun run test -- --coverage --watchAll=falseSee references/full-guide.md (§ Example jest.config.json) for a full config example.
Detection:
vitest in dependenciesvitest.config.ts or vitest.config.jsConfiguration:
bun run test -- --coverage --runSee references/full-guide.md (§ Example vitest.config.ts) for a full config example.
Detection:
mocha in dependenciesnyc or c8)Configuration:
.nycrc.json for nycnyc --reporter=text --reporter=html bun run testSee references/full-guide.md (§ Example .nycrc.json) for a full config example.
The skill automatically detects and uses:
bun run test (preferred)yarn testpnpm run testprepare script if needed.| Skill | How It Works Together | |-------|----------------------| | fullstack-workspace-init | Auto-invoked after scaffolding; sets Vitest + 80% threshold + CI/CD. Run this skill separately only when adding to an existing project. | | linter-formatter-init | Both configure Husky; this skill covers test coverage, linter-formatter-init covers linting/formatting | | testing-expert | Uses testing patterns and coverage targets from testing-expert skill |
python3 ${CLAUDE_SKILL_DIR}/scripts/setup-husky-coverage.py \
--root /path/to/project \
--threshold 80
# Reinstall Husky
bunx husky install
chmod +x .husky/pre-commit
The skill uses the first detected runner in priority order: Vitest > Jest > Mocha
development
Coordinates a weekly engineering review of board accuracy, recent code changes, operational health, and scoped cleanup. Use for a recurring repository health review or a review of the last several days.
testing
Audits project board configuration and prepares explicitly requested setup, copy, or normalization changes while preserving the existing workflow and provider boundaries. Use when inspecting a board's fields, columns, scope, or configuration.
testing
Reconciles a project board with current work and delivery evidence, reports incomplete coverage and metadata gaps, and applies only approved provider-supported field changes. Use when auditing board drift, reviewing blocked work, or assessing upcoming delivery.
development
Walk through how a subsystem works. Use for "how does X work", code walkthroughs before changing something, and placement or ownership questions. Explains architecture, runtime flow, and onboarding mental models. Can critique architecture. Use why for motivation.