Test Coverage Gap Analysis and Missing Tests

Find the untested branches that actually matter, rank them by risk, and write the tests that close them, with before/after coverage.

Development / Testingtest-coveragebranch-coverage
by AgentVoltv1.0.0
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

Prompt“Find untested code paths and generate missing tests for our API service”
Beforegeneric AI agent
You're right that test coverage is important for reliability. To improve coverage, I'd recommend first identifying which code paths don't have tests yet. You could run your coverage tool to see the metrics, then analyze the gaps. Once you understand what's missing, you could write tests for those untested paths. This helps catch bugs early and makes refactoring safer. Would you like me to help you identify which areas need the most attention first?
Afterwith Test Coverage Gap Analysis and Missing Tests
COVERAGE REPORT
Current metric: 67% statements, 58% branches, 72% lines

UNTESTED PATHS BY RISK
• Error handler for database timeouts (6 branches)
• Edge case: retry logic with exponential backoff
• Authentication token refresh on 401 (4 branches)
• Concurrent request rate limiter (logic complex, 2 tests missing)

MISSING TEST SUITE
"api/auth/token-refresh.test.ts"
- Test valid refresh token path
- Test expired token rejection
- Test race condition: two refresh calls simultaneous

"api/errors/timeout-handler.test.ts"
- Test timeout after 3000ms
- Test retry count tracking
- Test logging and metrics emission

PRIORITY ORDER
1. Auth timeout (prod incident risk)
2. Rate limiter edge cases (affects all users)
3. Retry exponential backoff (handles load gracefully)

Generated starter tests available in ./generated-tests/ directory, ready for customization.

About this skill

Your coverage badge says 82%, but the bug that hit production was in a retry branch nobody ever executed. Or CI just failed the threshold on a PR and you need to know which ten lines to test, not which fifty. This skill reads coverage the way a senior test engineer does. It looks at branches, not just lines. It ranks gaps by what breaks if they're wrong. It writes tests that assert behavior, not tests that only execute code.

What it does

  • Gives the exact branch-coverage command for your stack (pytest-cov, Jest/Vitest, c8/nyc, Go, JaCoCo, coverlet, cargo-llvm-cov, SimpleCov) and reads the report you paste or it runs
  • Catches misleading numbers: files never imported so never counted, over-broad excludes, no cover abuse, unmerged parallel runs, snapshot tests that inflate coverage
  • Ranks uncovered branches by risk (money, auth, data integrity, error handling, recent churn) and flags dead code to delete instead of test
  • Writes the missing tests in your existing framework, fixtures, and mocking style, with real assertions on outcomes and side effects
  • Handles PR diff coverage and threshold-raising plans, and suggests mutation testing where line coverage can't prove the tests work

What you get

A ranked gap table (file, branch, risk, action), the test code that closes the top gaps, and the command to confirm the before/after numbers. Nothing is claimed as run unless it was.

Best for

Engineers and tech leads who have a coverage number they don't trust, a CI threshold to meet, or a critical module that keeps breaking despite "good" coverage.

SKILL.md preview

SKILL.md
---
name: test-coverage-gap-analysis
description: Measures line and branch coverage with the project's own tool, checks whether the number is trustworthy, ranks uncovered branches by risk (money, auth, data integrity, error paths, churn) instead of by percentage, and writes behavior-asserting tests in the existing framework to close the highest-risk gaps. Use when the user says "what's our test coverage", "coverage dropped on this PR", "CI is failing the coverage threshold", "find what's untested in this module", "write tests for the uncovered lines", "we're at 80% but keep shipping bugs", "my coverage says 100% but this broke in prod".
---

# Test Coverage Gap Analysis and Missing Tests

… (sign up to view the full skill)
Sign up to view, copy, and install the full skill

More development skills

View all Development skills →