code-coverage
Detects gaps in test coverage and generates targeted unit tests for critical code paths.
Install
mkdir -p .claude/skills/code-coverage && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/12028" && unzip -o skill.zip -d .claude/skills/code-coverage && rm skill.zipInstalls to .claude/skills/code-coverage
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Analyzes test coverage, identifies untested code paths, and generates tests for the most critical uncovered areas. Use to improve test coverage before releases.Key capabilities
- →Run project's coverage command
- →Perform static analysis for uncovered code
- →Generate a coverage report summary
- →List critical uncovered code paths
- →Generate missing tests for critical areas
How it works
This skill attempts to run the project's coverage tools or performs static analysis to identify untested code paths. It then generates a report and suggests or creates tests for critical uncovered areas.
Inputs & outputs
When to use code-coverage
- →Analyze test coverage report
- →Generate missing unit tests
- →Increase branch coverage
About this skill
Test Coverage Analysis
Detect Test Setup
!ls package.json jest.config.* vitest.config.* .nycrc* .c8rc* .coveragerc* setup.cfg pyproject.toml tox.ini 2>/dev/null
!cat package.json 2>/dev/null | grep -E "jest|vitest|c8|nyc|istanbul|coverage" | head -5
Process
Step 1: Run Coverage (if configured)
Attempt to run the project's coverage command:
| Ecosystem | Coverage Command |
|---|---|
| npm (Jest) | npx jest --coverage --json 2>/dev/null |
| npm (Vitest) | npx vitest run --coverage 2>/dev/null |
| npm (c8) | npx c8 report --reporter=json 2>/dev/null |
| Python (pytest) | python -m pytest --cov --cov-report=json 2>/dev/null |
| Go | go test -coverprofile=coverage.out ./... 2>/dev/null && go tool cover -func=coverage.out |
| Rust | cargo tarpaulin --out json 2>/dev/null |
If coverage tools aren't configured, proceed with static analysis.
Step 2: Static Analysis (if no coverage tool)
For the target file(s):
- Identify all public functions, methods, and classes
- Search for corresponding test files
- For each function, check if there's a test that calls it
- Map which code paths (branches, error handlers) have test coverage
Step 3: Coverage Report
Summary
| Metric | Value |
|---|---|
| Line coverage | XX% |
| Branch coverage | XX% |
| Function coverage | XX% |
| Uncovered files | X |
Uncovered Critical Code
List the most important uncovered code, prioritized by:
- Business logic — core features and workflows
- Error handling — catch blocks, error paths, edge cases
- Security-sensitive — auth, input validation, data access
- Complex logic — functions with high cyclomatic complexity
For each uncovered area:
- File path and line numbers
- What the code does
- Why it's important to test
- Suggested test cases
Step 4: Generate Missing Tests
For the top 5 most critical uncovered areas, generate test code following the project's test patterns (same structure as /write-tests).
Step 5: Coverage Improvement Plan
| Priority | File | Current | Target | Tests Needed |
|---|---|---|---|---|
| 1 | ... | XX% | 80%+ | ... |
| 2 | ... | XX% | 80%+ | ... |
Rules
- Focus on meaningful coverage, not 100% — test behavior, not implementation
- Prioritize business logic and error paths over boilerplate
- Don't generate tests just to increase numbers — each test should validate something valuable
- Respect existing test patterns and conventions
When not to use it
- →When 100% coverage is the only goal
- →When only boilerplate code needs testing
- →When test generation is not desired
Limitations
- →Focuses on meaningful coverage, not 100%
- →Does not generate tests for boilerplate code
- →Each generated test must validate something valuable
How it compares
This workflow prioritizes generating tests for critical business logic and error paths, rather than simply aiming for a high coverage percentage.
Compared to similar skills
code-coverage side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| code-coverage (this skill) | 0 | 4mo | Review | Intermediate |
| codeql | 1 | 2mo | Review | Advanced |
| lint-and-validate | 6 | 6mo | Review | Beginner |
| coverage | 6 | 5mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
codeql
trailofbits
Runs CodeQL static analysis for security vulnerability detection using interprocedural data flow and taint tracking. Applicable when finding vulnerabilities, running a security scan, performing a security audit, running CodeQL, building a CodeQL database, selecting query rulesets, creating data extension models, or processing CodeQL SARIF output. NOT for writing custom QL queries or CI/CD pipeline setup.
lint-and-validate
davila7
Automatic quality control, linting, and static analysis procedures. Use after every code modification to ensure syntax correctness and project standards. Triggers onKeywords: lint, format, check, validate, types, static analysis.
coverage
alirezarezvani
Analyze test coverage gaps. Use when user says "test coverage", "what's not tested", "coverage gaps", "missing tests", "coverage report", or "what needs testing".
architecture-patterns
wshobson
Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use when architecting complex backend systems or refactoring existing applications for better maintainability.
auth-http-api-cloudbase
TencentCloudBase
Use when you need to implement CloudBase Auth v2 over raw HTTP endpoints (login/signup, tokens, user operations) from backends or scripts that are not using the Web or Node SDKs.
generating-grpc-services
jeremylongshore
Generate gRPC service definitions, stubs, and implementations from Protocol Buffers. Use when creating high-performance gRPC services. Trigger with phrases like "generate gRPC service", "create gRPC API", or "build gRPC server".