coverage-reporter
Generate and analyze test coverage reports. Use to identify coverage gaps, track coverage trends, and ensure quality thresholds are met.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Coverage Reporter Skill
Comprehensive test coverage analysis and reporting for Python and TypeScript code.
When This Skill Activates
- After running test suite
- Before committing changes
- Tracking coverage over time
- Investigating coverage gaps
- Reporting on coverage metrics
Coverage Analysis Methodology
Phase 1: Coverage Collection
Python Coverage
cd backend
pytest --cov=app --cov-report=html --cov-report=term-missing
TypeScript Coverage
cd frontend
npm run test:coverage
Phase 2: Gap Analysis
Step 2.1: Identify Untested Code
For each file:
1. Count lines not covered
2. Identify untested functions
3. Identify untested branches
4. Calculate coverage percentage
Step 2.2: Prioritize by Risk
| Risk Level | Type | Priority |
|---|---|---|
| Critical | Auth, crypto, data access | Fix immediately |
| High | Business logic, validation | Fix within 48h |
| Medium | Utils, helpers | Fix within 1 week |
| Low | Formatting, display | Nice to have |
Phase 3: Coverage Report Generation
## Test Coverage Report
**Date:** [DATE]
**Overall Coverage:** [X]%
### Summary
- Backend: [X]%
- Frontend: [Y]%
- Target: 80%
### Critical Gaps
- [File]: [X]% - [reason]
- [File]: [Y]% - [reason]
### Trends
- Week 1: 75%
- Week 2: 77%
- Week 3: 79%
- Trend: Improving
### Recommendations
1. [Recommendation 1]
2. [Recommendation 2]
Phase 4: Trend Analysis
1. Historical coverage
- Track weekly/monthly trends
- Identify degradation
- Project future coverage
2. Coverage velocity
- How fast is coverage improving?
- Estimate time to target
3. Coverage stability
- Which areas consistently low?
- Which areas consistently high?
Coverage Requirements by Layer
| Layer | Target | Minimum |
|---|---|---|
| Services | 90% | 80% |
| Controllers | 85% | 75% |
| Models | 80% | 70% |
| Utils | 90% | 85% |
| Routes | 75% | 65% |
| Components (Frontend) | 80% | 70% |
Quick Coverage Commands
# Python coverage with details
cd backend
pytest --cov=app --cov-report=html --cov-report=term-missing -v
# Frontend coverage
cd frontend
npm run test:coverage
# Coverage diff against main
# (Identify what new code is untested)
git diff main...HEAD | grep "^+" | wc -l
Gap Remediation Workflow
For Each Untested Component:
1. Understand the code
- What does it do?
- When is it called?
- Why isn't it tested?
2. Determine test strategy
- Unit test?
- Integration test?
- E2E test?
3. Write tests
- Happy path
- Error cases
- Edge cases
4. Verify coverage
- Re-run coverage
- Confirm improved
Integration with test-writer
When coverage gaps identified:
- Report findings to test-writer skill
- Request test generation for gaps
- Re-run coverage after tests added
- Track improvement
Validation Checklist
- Coverage >= target percentage
- No untested critical code
- All public APIs covered
- Error paths tested
- Edge cases covered
- Coverage trend is improving
- No artificial coverage inflation
References
- Coverage requirements in CLAUDE.md
- See test-writer skill for test generation
- Testing patterns in python-testing-patterns skill
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-26
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!