Skip to content
analyzing-test-coverage logo

Test Coverage Analyzer

analyzing-test-coverage

Analyze code coverage metrics and identify untested code paths.

SKILL.md

Full skill instructions

Test Coverage Analyzer

Current State

!ls package.json pyproject.toml Cargo.toml go.mod 2>/​dev/​null || echo 'No project manifest found' !node -v 2>/​dev/​null || python3 --version 2>/​dev/​null || echo 'No runtime detected'

Overview

Analyze code coverage metrics to identify untested code paths, dead code, and coverage gaps across line, branch, function, and statement dimensions. Supports Istanbul/​nyc (JavaScript/​TypeScript), coverage.py (Python), JaCoCo (Java), and Go coverage tools.

Prerequisites

  • Coverage tool installed and configured (Istanbul/​nyc, c8, coverage.py, JaCoCo, or go test -cover)
  • Test suite that can run with coverage instrumentation enabled
  • Coverage threshold targets defined (recommended: 80% lines, 70% branches)
  • Coverage output format set to JSON or LCOV for programmatic analysis
  • Git history available for coverage trend comparison

Instructions

  1. Run the test suite with coverage instrumentation enabled:
    • JavaScript: npx jest --coverage --coverageReporters=json-summary,lcov
    • Python: pytest --cov=src --cov-report=json --cov-report=term-missing
    • Go: go test -coverprofile=coverage.out ./​...
    • Java: Configure JaCoCo Maven/​Gradle plugin with XML report output.
  2. Parse the coverage report and extract per-file metrics:
    • Line coverage percentage per file.
    • Branch coverage percentage per file.
    • Function coverage percentage per file.
    • Uncovered line ranges (specific line numbers).
  3. Identify critical coverage gaps by prioritizing:
    • Files with coverage below the threshold (sort ascending by coverage %).
    • Files with high complexity but low coverage (use cyclomatic complexity if available).
    • Recently modified files with decreasing coverage trends.
    • Public API functions and exported modules lacking any tests.
  4. Analyze uncovered branches specifically:
    • Find if/​else blocks where only one branch is tested.
    • Identify switch/​case statements with missing case coverage.
    • Locate error handling paths (catch, except) never exercised.
    • Check || and && short-circuit conditions.
  5. Generate a prioritized action plan:
    • List top 10 files needing coverage improvement with specific line ranges.
    • Suggest test scenarios for each uncovered branch.
    • Estimate effort (small/​medium/​large) for each coverage improvement.
  6. Compare current coverage against the previous commit or baseline:
    • Calculate coverage delta per file.
    • Flag files where coverage decreased.
    • Verify new code added since baseline has adequate coverage.
  7. Write coverage enforcement configuration (coverage thresholds in Jest config, .coveragerc, or CI checks).

Output

  • Coverage summary report with overall and per-file metrics
  • Prioritized list of uncovered code paths with file:line references
  • Coverage delta report comparing against baseline
  • Suggested test cases for top coverage gaps
  • Coverage threshold configuration file for CI enforcement

Error Handling

ErrorCauseSolution
Coverage report shows 0%Tests ran but coverage instrumentation was not enabledVerify --coverage flag is passed; check that source files are not excluded by config
Coverage includes node_modulesCoverage collection scope too broadAdd collectCoverageFrom in Jest config; set --cov=src in pytest; exclude vendor dirs
Branch coverage much lower than line coverageConditional logic is only partially testedWrite tests for both truthy and falsy conditions on each branch; focus on edge cases
Coverage drops after refactorNew code added without corresponding testsSet coverageThreshold with global minimums; add --changedSince for incremental checks
Flaky coverage numbers between runsNon-deterministic test execution skipping code pathsSort tests deterministically; run coverage with --runInBand for consistent results

Examples

Jest coverage configuration with thresholds:

{
  "jest": {
    "coverageThreshold": {
      "global": {
        "branches": 70,
        "functions": 80,
        "lines": 80,
        "statements": 80
      },
      "src/​utils/": {
        "branches": 90,
        "lines": 95
      }
    },
    "collectCoverageFrom": [
      "src/​**/​*.{ts,tsx}",
      "!src/​**/​*.d.ts",
      "!src/​**/​index.ts"
    ]
  }
}

Coverage gap analysis output:

Coverage Gaps (sorted by impact):
1. src/​auth/​oauth.ts        Lines: 45%  Branches: 30%  [Lines 42-67, 89-103 uncovered]
   Suggestion: Add tests for token refresh failure and expired session handling
2. src/​api/​middleware.ts     Lines: 62%  Branches: 41%  [Lines 28-35, 71-80 uncovered]
   Suggestion: Test rate limiting edge cases and malformed header handling
3. src/​utils/​parser.ts       Lines: 71%  Branches: 55%  [Lines 112-130 uncovered]
   Suggestion: Test malformed input, empty string, and encoding edge cases

Resources

More skills from jeremylongshore

openrouter-compliance-review logo
jeremylongshore/claude-code-plugins-plus-skills

openrouter-compliance-review

Review OpenRouter integration for regulatory compliance (SOC2, GDPR,

2.8K 0
View
maintainx-data-handling logo
jeremylongshore/claude-code-plugins-plus-skills

maintainx-data-handling

Data synchronization, ETL patterns, and data management for MaintainX.

2.8K 0
View
groq-core-workflow-a logo
jeremylongshore/claude-code-plugins-plus-skills

groq-core-workflow-a

Execute Groq primary workflow: chat completions with tool use and JSON

2.8K 0
View
validating-csrf-protection logo
jeremylongshore/claude-code-plugins-plus-skills

validating-csrf-protection

Validate CSRF protection implementations for security gaps. Use when

2.8K 0
View
api-contract logo
jeremylongshore/claude-code-plugins-plus-skills

api-contract

Configure this skill should be used when the user asks about "API contract",

2.8K 0
View
ideogram-incident-runbook logo
jeremylongshore/claude-code-plugins-plus-skills

ideogram-incident-runbook

Execute Ideogram incident response with triage, mitigation, and postmortem.

2.8K 0
View
gamma-sdk-patterns logo
jeremylongshore/claude-code-plugins-plus-skills

gamma-sdk-patterns

Reusable patterns for the Gamma REST API (no SDK exists).

2.8K 0
View
deepgram-sdk-patterns logo
jeremylongshore/claude-code-plugins-plus-skills

deepgram-sdk-patterns

Apply production-ready Deepgram SDK patterns for TypeScript and Python.

2.8K 0
View
openrouter-upgrade-migration logo
jeremylongshore/claude-code-plugins-plus-skills

openrouter-upgrade-migration

Migrate to OpenRouter from direct provider APIs or upgrade between SDK/model

2.8K 0
View
openrouter-common-errors logo
jeremylongshore/claude-code-plugins-plus-skills

openrouter-common-errors

Diagnose and fix common OpenRouter API errors. Use when encountering

2.8K 0
View
linear-cost-tuning logo
jeremylongshore/claude-code-plugins-plus-skills

linear-cost-tuning

Optimize Linear API usage, reduce unnecessary calls, and maximize

2.8K 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View