home / skills / willsigmon / sigstack / code-coverage-expert
This skill helps you measure and improve test coverage across TypeScript projects by applying Codecov or Istanbul guidelines and CI thresholds.
npx playbooks add skill willsigmon/sigstack --skill code-coverage-expertReview the files below or copy the command above to add this skill to your agents.
---
name: Code Coverage Expert
description: Code coverage tools - Codecov, Istanbul, coverage thresholds, CI integration
allowed-tools: Read, Edit, Bash, WebFetch
model: sonnet
---
# Code Coverage Expert
Measure and improve test coverage across your codebase.
## Tools Comparison (2026)
| Tool | Best For | Free Tier | Pricing |
|------|----------|-----------|---------|
| Codecov | Team coverage | Open source | $29/user/mo |
| Coveralls | Simple setup | Open source | $10/repo/mo |
| Istanbul/nyc | JavaScript | Free | Free |
| llvm-cov | Swift/C++ | Free | Free |
## Codecov Setup
### GitHub Actions
```yaml
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/lcov.info
fail_ci_if_error: true
verbose: true
```
### Coverage Thresholds
```yaml
# codecov.yml
coverage:
status:
project:
default:
target: 80%
threshold: 2%
patch:
default:
target: 90%
```
## JavaScript/TypeScript (Istanbul)
### Setup with Jest
```json
{
"jest": {
"collectCoverage": true,
"coverageThreshold": {
"global": {
"branches": 80,
"functions": 80,
"lines": 80,
"statements": 80
}
}
}
}
```
### Vitest Coverage
```typescript
// vitest.config.ts
export default defineConfig({
test: {
coverage: {
provider: 'v8',
reporter: ['text', 'lcov', 'html'],
thresholds: {
lines: 80,
functions: 80,
branches: 80,
}
}
}
})
```
## Swift Coverage
### Xcode Coverage
```bash
# Enable coverage in scheme
xcodebuild test \
-scheme App \
-enableCodeCoverage YES \
-resultBundlePath TestResults.xcresult
# Extract report
xcrun xccov view --report TestResults.xcresult
```
### Export to Codecov
```bash
# Convert to lcov format
xcrun llvm-cov export \
-format=lcov \
-instr-profile coverage.profdata \
App.app/App > coverage.lcov
```
## Coverage for Vibe Coders
### Minimum Viable Coverage
```
Core business logic: 80%+
UI code: 40-60% (visual testing preferred)
Generated code: Skip
Third-party wrappers: Skip
```
### Quick Win: Cover Critical Paths
```bash
# Find uncovered critical files
npx nyc report --reporter=text | grep -E "0%|[1-4][0-9]%"
```
## CI Integration Pattern
```yaml
jobs:
test:
steps:
- run: pnpm test --coverage
- uses: codecov/codecov-action@v4
coverage-gate:
needs: test
steps:
- run: |
COVERAGE=$(cat coverage/coverage-summary.json | jq '.total.lines.pct')
if (( $(echo "$COVERAGE < 80" | bc -l) )); then
echo "Coverage below 80%!"
exit 1
fi
```
Use when: Setting up coverage, CI thresholds, improving test quality
This skill helps teams measure, enforce, and improve code coverage across projects using tools like Codecov, Istanbul/nyc, Vitest, and llvm-cov. It provides practical CI integration patterns, coverage-threshold examples, and platform-specific commands for JavaScript/TypeScript and Swift. Use it to catch regressions, prioritize tests for critical paths, and set realistic coverage targets for different code types.
The skill inspects your test output and coverage reports (lcov, coverage-summary.json, xccov) and shows how to upload to hosted services like Codecov. It explains setting global and per-patch thresholds, wiring coverage checks into CI, and converting native reports (llvm-cov/xccov) into lcov. It also recommends where to focus effort (core logic vs UI) and quick shell commands to find low-coverage files.
Should I aim for 100% coverage?
No. Focus on meaningful coverage for core business logic. 80%+ is a practical target; UI and generated code can have lower thresholds or be skipped.
Which tool is best for JavaScript projects?
Istanbul/nyc (used by Jest) and Vitest with V8 coverage are reliable and free; use Codecov for team dashboards and historical views.