From shipshitdev-library
Sets up or verifies Husky pre-commit hooks to enforce test coverage thresholds (default 80%, configurable) in Node.js/TypeScript projects using Jest, Vitest, or Mocha.
npx claudepluginhub shipshitdev/skillsThis skill uses the workspace's default tool permissions.
Set up or verify Husky git hooks to ensure tests run and coverage thresholds are enforced on every commit.
Provides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
Analyzes competition with Porter's Five Forces, Blue Ocean Strategy, and positioning maps to identify differentiation opportunities and market positioning for startups and pitches.
Set up or verify Husky git hooks to ensure tests run and coverage thresholds are enforced on every commit.
This skill automates the setup of:
This skill should be used when:
Before setting up test coverage, discover the project's context:
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.* files# Basic setup (80% coverage threshold, blocks commits below threshold)
python3 scripts/setup-husky-coverage.py \
--root /path/to/project
# Custom threshold (85%)
python3 scripts/setup-husky-coverage.py \
--root /path/to/project \
--threshold 85
# Warn only (don't block commits)
python3 scripts/setup-husky-coverage.py \
--root /path/to/project \
--no-fail-on-below
# Skip if no tests found
python3 scripts/setup-husky-coverage.py \
--root /path/to/project \
--skip-if-no-tests
# Dry run to preview changes
python3 scripts/setup-husky-coverage.py \
--root /path/to/project \
--dry-run
npx 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:
{
"coverageThreshold": {
"lines": 80,
"branches": 75,
"functions": 80,
"statements": 80
},
"failOnCoverageBelowThreshold": true,
"skipIfNoTests": false
}
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 thresholdsnpm test -- --coverage --watchAll=falseExample jest.config.json:
{
"coverageThreshold": {
"global": {
"lines": 80,
"branches": 75,
"functions": 80,
"statements": 80
}
}
}
Detection:
vitest in dependenciesvitest.config.ts or vitest.config.jsConfiguration:
npm test -- --coverage --runExample vitest.config.ts:
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
thresholds: {
lines: 80,
branches: 75,
functions: 80,
statements: 80
}
}
}
})
Detection:
mocha in dependenciesnyc or c8)Configuration:
.nycrc.json for nycnyc --reporter=text --reporter=html npm testExample .nycrc.json:
{
"check-coverage": true,
"lines": 80,
"branches": 75,
"functions": 80,
"statements": 80,
"reporter": ["text", "text-summary", "html", "lcov"]
}
The skill automatically detects and uses:
npm run testyarn testpnpm run testbun run testWhen using this skill:
Discover Project Context:
Detect Test Runner:
Setup or Verify Husky:
Configure Coverage:
Create Pre-commit Hook:
Verify Setup:
This skill works alongside:
| Skill | How It Works Together |
|---|---|
| fullstack-workspace-init | Automatically invoked after scaffolding to set up 80% coverage threshold |
| linter-formatter-init | Both configure Husky; this skill focuses on test coverage, linter-formatter-init focuses on linting/formatting |
| testing-expert | Uses testing patterns and coverage targets from testing-expert skill |
When using fullstack-workspace-init to scaffold a new project, this skill is automatically applied with:
You don't need to run this skill separately if you used fullstack-workspace-init.
If adding to an existing project:
python3 scripts/setup-husky-coverage.py \
--root /path/to/project \
--threshold 80
# Reinstall Husky
npx husky install
chmod +x .husky/pre-commit
The skill uses the first detected runner in priority order: Vitest > Jest > Mocha
When this skill is active, it will: