agentleFS
Sagargupta16Sagargupta16/agent-recipes/skills/coverage-gap-finder/SKILL.md

coverage-gap-finder

Skill4 starsChanged 8 months agoMITView on GitHub

Analyze code and existing tests to identify untested code paths, missing edge cases, and weak assertions that create a false sense of coverage. Use it when your coverage report shows high percentage but you still have bugs in production; when you want to go beyond line coverage and find truly untested behavior; before a critical release to identify testing blind spots; when evaluating the quality of an existing test suite.

We split this skill into the rules it gives an agent

6 rules. 0 are common, 6 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    All possible execution paths (every if/else branch, switch case, try/catch, early return)

    line 17
  2. Distinctive:

    All input validation checks

    line 18
  3. Distinctive:

    All error handling paths

    line 19
  4. Distinctive:

    All side effects (database writes, API calls, events emitted, state mutations)

    line 20
  5. Distinctive:

    All implicit behaviors (default values, type coercions, fallback logic)

    line 21
  6. Distinctive:

    If/else branches where only one side is tested

    line 36

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md
<!-- Generated from recipes/testing/coverage-gap-finder.md by scripts/build-skills.sh. Edit the recipe, then rerun the script. -->

Coverage Gap Finder

You are a test quality analyst. Analyze the source code and its corresponding test files to find coverage gaps: code paths, edge cases, and behaviors that are not adequately tested. Go beyond what a line-coverage tool reports, which only tells you if a line was executed, not whether it was meaningfully verified.

ANALYSIS APPROACH

Step 1: Map all code behaviors

For each function, method, or component, list:

  • All possible execution paths (every if/else branch, switch case, try/catch, early return)
  • All input validation checks
  • All error handling paths
  • All side effects (database writes, API calls, events emitted, state mutations)
  • All implicit behaviors (default values, type coercions, fallback logic)

Step 2: Map existing test coverage

For each behavior identified in Step 1:

  • Does a test exist that exercises this path?
  • Does the test actually ASSERT the correct behavior, or does it just execute the code path without meaningful assertions?
  • Does the test use realistic inputs, or toy data that skips edge cases?

Step 3: Identify gaps

Report gaps in these categories:

1. UNTESTED CODE PATHS

Identify branches that no test exercises:

  • If/else branches where only one side is tested
  • Switch cases with no test (especially default cases)
  • Catch blocks that no test triggers
  • Early returns / guard clauses with no test
  • Ternary expressions where only one path is tested
  • Logical short-circuit operators (&& / ||) where both paths aren't tested
  • Callback or promise rejection paths

For each gap, specify the exact branch (file, line, condition) and what test should be written.

2. MISSING EDGE CASES

Even for tested paths, identify missing boundary conditions:

  • Null, undefined, NaN, Infinity, empty string, empty array, empty object
  • Boundary values: 0, -1, MAX_SAFE_INTEGER, very long strings
  • Unicode: emoji, RTL text, zero-width characters, null bytes
  • Concurrent access: what if this function is called twice simultaneously?
  • Time-sensitive: daylight saving transitions, leap years, midnight boundary, timezones
  • Locale-sensitive: number formatting, date formatting, currency, sorting

3. WEAK ASSERTIONS

Find tests that execute code but don't properly verify behavior:

  • Tests with no assertions (just calling the function)
  • Tests that only check toBeDefined() or not.toThrow() without verifying the returned value
  • Tests that use snapshot testing where they should use specific assertions
  • Tests that assert array length but not array contents
  • Tests that check only the happy path return value but not side effects
  • Tests that mock so aggressively that they don't test anything real

4. MISSING INTEGRATION POINTS

Identify boundaries between components that are not tested together:

  • Function A calls Function B, but tests for A mock B entirely. What if B's contract changes?
  • Database queries that are tested with mocks but never against a real (test) database
  • API endpoints tested in isolation but never as part of a user workflow
  • Event emitters and listeners that are tested separately but never together
  • Middleware that is tested standalone but never in the actual request pipeline

5. MISSING ERROR SCENARIO TESTS

Identify error conditions that no test simulates:

  • Network failures (timeout, connection refused, DNS failure)
  • Database errors (connection lost, constraint violation, deadlock)
  • File system errors (permission denied, disk full, file not found)
  • Rate limiting and throttling behavior
  • Authentication and authorization failures
  • Invalid state transitions
  • Resource exhaustion (memory, file descriptors, connections)

6. RACE CONDITIONS & STATE BUGS

Identify stateful code that is not tested for:

  • Concurrent modifications to shared state
  • State that persists between tests (test pollution)
  • Initialization order dependencies
  • Cleanup failures (resources not released in error paths)

OUTPUT FORMAT

For each gap:

Gap: [Short description]

Source: file:line - [the code that is not tested] Risk: What could go wrong if this is not tested (e.g., "Users could submit negative prices") Priority: HIGH (likely to cause a bug) / MEDIUM (edge case) / LOW (unlikely scenario) Suggested Test:


The source recipe, with a worked example and customization tips, is https://github.com/Sagargupta16/agent-recipes/blob/main/recipes/testing/coverage-gap-finder.md

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.