calculate-coverage
Measure test coverage and identify untested code. Use when assessing test completeness.
When & Why to Use This Skill
The calculate-coverage skill is a specialized developer tool designed to measure code coverage and identify untested code paths. By providing detailed metrics on test completeness, it helps engineering teams maintain high software quality, meet coverage thresholds, and systematically eliminate blind spots in their test suites.
Use Cases
- Gap Analysis: Identifying specific functions, branches, or lines of code that are not executed during test runs to ensure comprehensive logic verification.
- Quality Gate Enforcement: Verifying that new code changes meet the required coverage percentage (e.g., 80%+) before they are merged into the main codebase.
- Test Suite Optimization: Using coverage reports to prioritize the creation of new test cases for critical or complex business logic that currently lacks testing.
- Regression Monitoring: Tracking coverage trends over time to ensure that rapid development cycles do not lead to a decrease in overall test quality.
| name | calculate-coverage |
|---|---|
| description | "Measure test coverage and identify untested code. Use when assessing test completeness." |
| mcp_fallback | none |
| category | analysis |
| tier | 2 |
| user-invocable | false |
Calculate Coverage
Measure code coverage percentage and identify which code paths are untested to ensure comprehensive testing.
When to Use
- Checking test coverage for modules
- Identifying gaps in test suites
- Meeting coverage thresholds (typically 80%+)
- Planning additional test cases
Quick Reference
# Python coverage with pytest
pip install coverage pytest-cov
pytest --cov=module_name --cov-report=html tests/
# View coverage report
open htmlcov/index.html
# Check coverage threshold
coverage report --fail-under=80
Workflow
- Install coverage tool: Set up measurement infrastructure
- Run tests with coverage: Execute test suite capturing coverage data
- Generate report: Create HTML or text coverage report
- Analyze gaps: Identify untested functions, branches, edge cases
- Plan improvements: Create tests for uncovered code paths
Output Format
Coverage analysis:
- Overall coverage percentage
- Per-module coverage breakdown
- Uncovered lines (with line numbers)
- Branch coverage (if applicable)
- Recommendations for improvement
References
- See
run-testsskill for test execution - See
generate-testsskill for test creation - See CLAUDE.md > Key Development Principles (TDD) for testing strategy