quality-coverage-report
Generate test coverage reports showing which code paths are tested. Use to identify untested code and improve test coverage.
When & Why to Use This Skill
This Claude skill automates the generation and analysis of test coverage reports, helping developers identify untested code paths and improve overall software quality. By providing detailed metrics for line and branch coverage, it enables engineering teams to meet critical quality targets, optimize testing workflows, and ensure robust code reliability before deployment.
Use Cases
- Identifying gaps in test suites after major feature updates to ensure all new logic and edge cases are properly verified.
- Enforcing quality gates in CI/CD pipelines by automatically checking coverage against predefined minimum thresholds before merging Pull Requests.
- Assisting developers in writing targeted unit tests for complex logic branches that are currently marked as uncovered in the report.
- Monitoring long-term code health by tracking coverage metrics across different modules like tensors, neural networks, and utility functions.
| name | quality-coverage-report |
|---|---|
| description | Generate test coverage reports showing which code paths are tested. Use to identify untested code and improve test coverage. |
| mcp_fallback | none |
| category | quality |
| agent | test-engineer |
| user-invocable | false |
Test Coverage Report Skill
Generate and analyze test coverage reports.
When to Use
- After running tests
- Before creating PR
- Identifying untested code
- Improving test coverage
Quick Reference
# Python coverage
pytest --cov=src --cov-report=html tests/
# View report
open htmlcov/index.html
# Terminal report
pytest --cov=src --cov-report=term-missing tests/
Coverage Metrics
Line Coverage
Percentage of code lines executed by tests:
src/module.mojo
Lines: 45/50 (90%)
Missing: 12, 18, 23, 35, 41
Branch Coverage
Percentage of decision branches taken:
Branches: 8/10 (80%)
Missing branches: line 12->15, line 18->20
Coverage Goals
| Category | Minimum | Target | Critical |
|---|---|---|---|
| Line coverage | 80% | 90% | 100% |
| Branch coverage | 70% | 85% | 95% |
| Critical paths | - | - | 100% |
Coverage Report
Coverage Report
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
File Lines Missing Coverage
────────────────────────────────────────────────
src/tensor.mojo 150 5 96.7%
src/nn.mojo 200 30 85.0%
src/utils.mojo 50 10 80.0%
────────────────────────────────────────────────
TOTAL 400 45 88.8%
Minimum coverage: 80% ✅
Target coverage: 90% ❌
Critical paths: 100% ✅
Improving Coverage
- Identify gaps - Find uncovered lines in report
- Write tests - Add tests for untested code
- Re-run - Generate new report
- Verify - Check coverage improved
- Repeat - Until targets met
Coverage Workflow
# 1. Run tests with coverage
pytest --cov=src --cov-report=html --cov-report=term-missing tests/
# 2. Identify missing coverage
# Review "Missing" column in output
# 3. Write tests for gaps
# ... create test files ...
# 4. Re-run
pytest --cov=src --cov-report=html tests/
# 5. Check improvement
# Compare htmlcov/index.html
CI Integration
- name: Test Coverage
run: |
pytest --cov=src --cov-report=xml
codecov -f coverage.xml
Error Handling
| Error | Fix |
|---|---|
| "No module named pytest" | Install: pip install pytest-cov |
| "Cannot find tests/" | Verify test directory exists |
| No coverage report | Ensure tests ran successfully |
References
- Related skill:
phase-test-tddfor test generation - Related skill:
quality-run-lintersfor complete quality check - Pytest docs: https://docs.pytest.org/en/stable/