From claude-commands
Runs code coverage analysis with coverage.sh and pytest-cov, interprets HTML/text reports, and enforces thresholds for CI. Useful before PRs or when investigating untested code paths.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-commands:coverage-analysisThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Provide Claude with a comprehensive reference for running code coverage analysis in Your Project. This skill covers the coverage.sh script usage, interpreting results, and best practices.
Provide Claude with a comprehensive reference for running code coverage analysis in Your Project. This skill covers the coverage.sh script usage, interpreting results, and best practices.
# Run coverage with HTML report (default)
./coverage.sh
# Run coverage with text report only (faster)
./coverage.sh --no-html
# Include integration tests
./coverage.sh --integration
# Include integration tests, text only
./coverage.sh --integration --no-html
| Output | Location |
|---|---|
| Text report | /tmp/$PROJECT_NAME/coverage/coverage_report.txt |
| HTML report | /tmp/$PROJECT_NAME/coverage/index.html |
| Quick link | file:///tmp/coverage.html (symlink) |
Test Summary:
Total tests: 232
Passed: 204
Failed: 28
Overall Coverage: 69%
Key Files Coverage:
main.py 44%
llm_service.py 74%
game_state.py 57%
firestore_service.py 53%
| Coverage | CI Result | Badge Color |
|---|---|---|
| ≥80% | Pass | Green (MINIMUM_GREEN: 80) |
| 60-79% | Pass (warning) | Orange (MINIMUM_ORANGE: 60) |
| <60% | Fail | Red |
| Coverage | Status | Action | CI Threshold |
|---|---|---|---|
| 80%+ | Excellent | Maintain | Green (MINIMUM_GREEN: 80) |
| 60-79% | Good | Minor improvements | Orange (MINIMUM_ORANGE: 60) |
| 40-59% | Fair | Add targeted tests | Warning |
| <40% | Poor | Prioritize testing | Error |
Priority coverage targets for Your Project:
For focused development, run individual test files:
# Using venv with proper PYTHONPATH
source venv/bin/activate
PYTHONPATH="$PWD:$PYTHONPATH" TESTING=true python $PROJECT_ROOT/tests/test_specific.py
Cause: PYTHONPATH doesn't include project root.
Fix: The coverage.sh script sets PYTHONPATH="$PROJECT_ROOT:$PYTHONPATH" automatically. For manual runs:
export PYTHONPATH="$PWD:$PYTHONPATH"
Fix: Install test dependencies:
pip install numpy fastembed onnxruntime
Some tests require additional setup:
playwright installFor CI coverage reporting, use py-cov-action/[email protected] (SHA-pinned in workflow):
- name: Coverage comment
uses: py-cov-action/python-coverage-comment-action@fb02115d6115e7b3325dc3295fe1dcfb1919248a # v3.32
with:
GITHUB_TOKEN: ${{ github.token }}
MINIMUM_GREEN: 80
MINIMUM_ORANGE: 60
See .github/workflows/coverage.yml for the full workflow with threshold checks.
TESTING=true for isolated testingend2end-testing.md - E2E test patternsevidence-standards.md - Test evidence collectionnpx claudepluginhub jleechanorg/claude-commands --plugin claude-commandsQueries test coverage in Python, Node.js, Rust, Go projects. Identifies uncovered areas/files, analyzes trends, and generates reports before changes or PRs.
Compute code coverage for active track or module. Targets 95%+ coverage with report and justification for uncovered lines. Complements TDD workflow.
Analyzes test coverage reports (lcov, cobertura, istanbul) to identify gaps in lines/branches/functions, map to requirements, recommend tests, and track trends.