bundles/testing/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
TypeScript refactoring and modernization guidelines from a principal specialist perspective. This skill should be used when refactoring, reviewing, or modernizing TypeScript code to ensure type safety, compiler performance, and idiomatic patterns. Triggers on tasks involving TypeScript type architecture, narrowing, generics, error handling, or migration to modern TypeScript features.
tools
Resolves TypeScript and JavaScript problems across type-level programming, performance, monorepo management, migration, and modern tooling. Invoke when diagnosing "type instantiation excessively deep" errors, migrating JS to TS, configuring strict tsconfig, debugging module resolution, or choosing between Biome/ESLint/Turborepo/Nx.
tools
Turborepo monorepo build system guidance. Triggers on: `turbo.json`, task pipelines, `dependsOn`, caching, remote cache, the `turbo` CLI, `--filter`, `--affected`, CI optimization, environment variables, internal packages, monorepo structure, and package boundaries. Use when the user configures tasks or workflows, creates packages, sets up a monorepo, shares code between apps, runs changed packages, debugs cache behavior, or works in an `apps/` plus `packages/` workspace.
tools
Provides Tailwind CSS v4 performance optimization and best practices guidelines. Triggers when writing, reviewing, or refactoring Tailwind CSS v4 code; when working with Tailwind configuration, @theme directive, utility classes, responsive design, dark mode, container queries, or CSS generation optimization.