validate-coverage-threshold

Validate test coverage meets minimum thresholds (default 80% overall, 80% statements, 75% branches, 80% functions). Parses coverage reports from coverage/coverage-summary.json or test output. Returns pass/fail status with detailed metrics and identifies uncovered files.

$ インストール

git clone https://github.com/BerryKuipers/claude-code-toolkit /tmp/claude-code-toolkit && cp -r /tmp/claude-code-toolkit/.claude/api-skills-source/validate-coverage-threshold ~/.claude/skills/claude-code-toolkit

// tip: Run this command in your terminal to install the skill


name: validate-coverage-threshold description: Validate test coverage meets minimum thresholds (default 80% overall, 80% statements, 75% branches, 80% functions). Parses coverage reports from coverage/coverage-summary.json or test output. Returns pass/fail status with detailed metrics and identifies uncovered files.

Validate Coverage Threshold

Parses test coverage reports and validates that coverage meets minimum thresholds for quality assurance.

Usage

This skill checks test coverage data against configurable thresholds and returns structured validation results.

Default Thresholds

{
  "overall": 80,
  "statements": 80,
  "branches": 75,
  "functions": 80
}

Output Format

All Thresholds Met

{
  "status": "success",
  "coverage": {
    "overall": 87.5,
    "statements": 88.2,
    "branches": 84.1,
    "functions": 89.3
  },
  "thresholds": {
    "overall": 80,
    "statements": 80,
    "branches": 75,
    "functions": 80
  },
  "passed": true,
  "failures": [],
  "canProceed": true
}

Below Threshold

{
  "status": "warning",
  "coverage": {
    "overall": 75.3,
    "statements": 76.1,
    "branches": 72.8,
    "functions": 78.2
  },
  "thresholds": {
    "overall": 80,
    "statements": 80,
    "branches": 75,
    "functions": 80
  },
  "passed": false,
  "failures": [
    "overall:75.3%<80%",
    "statements:76.1%<80%"
  ],
  "uncoveredFiles": [
    {"file": "src/utils/helpers.ts", "coverage": 45.2}
  ],
  "canProceed": false,
  "details": "Coverage below threshold: 4 metric(s) failed"
}

When to Use

  • Quality gate validation (Conductor Phase 3)
  • After running tests with coverage
  • Pre-commit checks
  • CI/CD pipeline validation

Coverage Data Sources

  • coverage/coverage-summary.json (preferred - c8/Istanbul)
  • Test output text (fallback)

Requirements

  • Coverage data generated by test run
  • Run npm run test -- --coverage first