원클릭으로
validate-coverage-threshold
Validate test coverage meets minimum thresholds for overall, statement, branch, and function coverage
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Validate test coverage meets minimum thresholds for overall, statement, branch, and function coverage
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | validate-coverage-threshold |
| description | Validate test coverage meets minimum thresholds for overall, statement, branch, and function coverage |
Parse test coverage reports and validate that coverage meets minimum thresholds, blocking commits or PRs if coverage is insufficient.
quality-gate skill{
"overall": 80,
"statements": 80,
"branches": 75,
"functions": 80
}
# Check for coverage file
if [ -f coverage/coverage-summary.json ]; then
COVERAGE_SOURCE="json"
elif [ -f .claude/baseline/test-output.txt ]; then
COVERAGE_SOURCE="text"
else
echo "❌ Error: No coverage data found"
echo "Run: npm run test -- --coverage"
exit 1
fi
echo "Coverage source: $COVERAGE_SOURCE"
if [ "$COVERAGE_SOURCE" = "json" ]; then
# Parse from JSON (preferred)
OVERALL_COV=$(jq -r '.total.lines.pct' coverage/coverage-summary.json)
STMT_COV=$(jq -r '.total.statements.pct' coverage/coverage-summary.json)
BRANCH_COV=$(jq -r '.total.branches.pct' coverage/coverage-summary.json)
FUNC_COV=$(jq -r '.total.functions.pct' coverage/coverage-summary.json)
else
# Parse from text output (fallback)
OVERALL_COV=$(grep -oP 'All files.*?\|\s+(\d+\.\d+)' .claude/baseline/test-output.txt | grep -oP '\d+\.\d+' | head -1 || echo "0")
STMT_COV=$OVERALL_COV
BRANCH_COV=$OVERALL_COV
FUNC_COV=$OVERALL_COV
fi
echo "Coverage metrics:"
echo " Overall: ${OVERALL_COV}%"
echo " Statements: ${STMT_COV}%"
echo " Branches: ${BRANCH_COV}%"
echo " Functions: ${FUNC_COV}%"
# Use provided thresholds or defaults
MIN_OVERALL=${1:-80}
MIN_STMT=${2:-80}
MIN_BRANCH=${3:-75}
MIN_FUNC=${4:-80}
echo ""
echo "Minimum thresholds:"
echo " Overall: ${MIN_OVERALL}%"
echo " Statements: ${MIN_STMT}%"
echo " Branches: ${MIN_BRANCH}%"
echo " Functions: ${MIN_FUNC}%"
echo ""
echo "→ Validating coverage thresholds..."
THRESHOLD_PASSED=true
FAILURES=()
# Check overall
if [ "$(echo "$OVERALL_COV < $MIN_OVERALL" | bc -l)" -eq 1 ]; then
echo "❌ Overall coverage below threshold: ${OVERALL_COV}% < ${MIN_OVERALL}%"
THRESHOLD_PASSED=false
FAILURES+=("overall:${OVERALL_COV}%<${MIN_OVERALL}%")
else
echo "✅ Overall coverage: ${OVERALL_COV}% ≥ ${MIN_OVERALL}%"
fi
# Check statements
if [ "$(echo "$STMT_COV < $MIN_STMT" | bc -l)" -eq 1 ]; then
echo "❌ Statement coverage below threshold: ${STMT_COV}% < ${MIN_STMT}%"
THRESHOLD_PASSED=false
FAILURES+=("statements:${STMT_COV}%<${MIN_STMT}%")
else
echo "✅ Statement coverage: ${STMT_COV}% ≥ ${MIN_STMT}%"
fi
# Check branches
if [ "$(echo "$BRANCH_COV < $MIN_BRANCH" | bc -l)" -eq 1 ]; then
echo "❌ Branch coverage below threshold: ${BRANCH_COV}% < ${MIN_BRANCH}%"
THRESHOLD_PASSED=false
FAILURES+=("branches:${BRANCH_COV}%<${MIN_BRANCH}%")
else
echo "✅ Branch coverage: ${BRANCH_COV}% ≥ ${MIN_BRANCH}%"
fi
# Check functions
if [ "$(echo "$FUNC_COV < $MIN_FUNC" | bc -l)" -eq 1 ]; then
echo "❌ Function coverage below threshold: ${FUNC_COV}% < ${MIN_FUNC}%"
THRESHOLD_PASSED=false
FAILURES+=("functions:${FUNC_COV}%<${MIN_FUNC}%")
else
echo "✅ Function coverage: ${FUNC_COV}% ≥ ${MIN_FUNC}%"
fi
if [ "$COVERAGE_SOURCE" = "json" ]; then
# Find files with low coverage
UNCOVERED_FILES=$(jq -r '
to_entries |
map(select(.key != "total" and .value.lines.pct < 80)) |
map({file: .key, coverage: .value.lines.pct}) |
sort_by(.coverage) |
.[]' coverage/coverage-summary.json | \
jq -s -c '.')
else
UNCOVERED_FILES="[]"
fi
{
"status": "$([ "$THRESHOLD_PASSED" = true ] && echo 'success' || echo 'warning')",
"coverage": {
"overall": $OVERALL_COV,
"statements": $STMT_COV,
"branches": $BRANCH_COV,
"functions": $FUNC_COV
},
"thresholds": {
"overall": $MIN_OVERALL,
"statements": $MIN_STMT,
"branches": $MIN_BRANCH,
"functions": $MIN_FUNC
},
"passed": $THRESHOLD_PASSED,
"failures": $(printf '%s\n' "${FAILURES[@]}" | jq -R -s -c 'split("\n") | map(select(length > 0))'),
"uncoveredFiles": $UNCOVERED_FILES
}
{
"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": []
}
{
"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%",
"branches:72.8%<75%",
"functions:78.2%<80%"
],
"uncoveredFiles": [
{"file": "src/utils/helpers.ts", "coverage": 45.2},
{"file": "src/services/api.ts", "coverage": 62.8}
]
}
Used in quality-gate skill:
### Step 4: Check Test Coverage
Use `validate-coverage-threshold` skill:
- Input: thresholds (or use defaults)
- Expected: All thresholds met
If coverage below threshold:
⚠️ WARNING (not blocking for MVP)
→ Log coverage gap
→ Create GitHub issue for improvement
→ Continue with quality gate
If coverage acceptable:
✅ Coverage validation passed
# Custom thresholds
validate-coverage-threshold 85 85 80 90
# Parameters: overall, statements, branches, functions
// .claude/quality-gate-config.json
{
"minimumCoverage": 80,
"coverageThresholds": {
"overall": 85,
"statements": 85,
"branches": 80,
"functions": 90
},
"blockOnCoverage": false
}
quality-gate - Uses this for coverage validationrecord-quality-baseline - Records coverage baselinerun-comprehensive-tests - Generates coverage data{
"status": "error",
"error": "Coverage data not found",
"suggestion": "Run tests with coverage: npm run test -- --coverage"
}
{
"status": "error",
"error": "Cannot parse coverage data",
"suggestion": "Verify coverage output format"
}
Detect project stack, apply architecture patterns, wire quality gates, and scaffold features. Use when bootstrapping a project, adding a vertical slice, wiring CI/CD, adding Docker compose, or setting up quality gates.
Generates structured Handoff Pack prompts for delegating work to Gemini with clear scope, acceptance criteria, and output format requirements.
Incrementally improve type safety by replacing string literals with enums, narrowing `any` types, and using shared types. Works in small verified batches. Preserves functionality while improving code quality.
Cloudflare DNS and infrastructure management. Manage DNS records, tunnels, Access policies, SSL certificates, and CDN caching.
Deploy projects to staging or production environments. Repo-agnostic deployment orchestration using SSH MCP for VPS operations and Cloudflare for DNS/SSL. Reads project configuration from deployments.registry.json.
Direct VPS operations via SSH MCP. Manage Docker containers, check logs, run commands, and troubleshoot services on registered VPS servers.