$ recombobulate _
home / tips / use-claude-to-analyse-test-coverage-and-fill-the-gaps
0

Use Claude to Analyse Test Coverage and Fill the Gaps

bagwaa @bagwaa · Mar 26, 2026 · Workflows
use-claude-to-analyse-test-coverage-and-fill-the-gaps

Most projects have test suites that cover the happy path but miss edge cases, error handling, and boundary conditions. Claude can audit your coverage and write the missing tests.

# Generate a coverage report first
npx vitest run --coverage --reporter=json --outputFile=coverage.json

# Then feed it to Claude
claude "Read coverage.json and identify the files with the lowest branch coverage.
For each of the bottom 5 files, read the source code, understand what's untested,
and write tests that cover the missing branches. Use Vitest with describe/it blocks."

You can also point Claude at a specific file for a deep-dive:

Look at src/services/payment.ts and its existing test file.
Run the tests with coverage for just this file.
Identify every uncovered branch and edge case, then write tests to hit them all.
Aim for 100% branch coverage.

Claude will read both the source and existing tests, understand what's already tested, and generate new test cases that specifically target the gaps — error paths, null checks, boundary values, and race conditions.

For a quick scan without generating a report file:

npx jest --coverage --coverageReporters=text 2>&1 | claude --print "Which files need more tests? List the top 5 priorities."

Coverage reports tell you what's missing — Claude actually writes the tests to fix it.

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Scan Pending Changes for Security Issues with /security-review

The /security-review command scans your uncommitted changes for injection vectors, auth gaps, hardcoded secrets, and other common vulnerabilities.

bagwaa @bagwaa · 1 hour ago
0
Run Setup Scripts on Every Session with the SessionStart Hook

The SessionStart hook fires when any session begins or resumes, making it ideal for loading environment variables and running one-time setup scripts.

bagwaa @bagwaa · 1 hour ago
0
Write Property-Based Tests with fast-check and Claude

Ask Claude to write property-based tests for your functions using fast-check — it identifies the mathematical invariants in your code and generates tests that cover inputs you'd never enumerate by hand.

bagwaa @bagwaa · 2 hours ago