Test Coverage Gap Review

A list of untested branches in a diff along with the specific tests that would cover them.

Intermediate · Works with ChatGPT, Claude, Gemini, Copilot

The prompt

Look at this diff and its tests, and list the branches or conditions that aren't covered, each with the specific test that would cover it.

Say what this code makes harder to modify later if it stays untested, and keep the tone direct without hedging.

Code and existing tests:
{{CODE}}

Language and test framework:
{{STACK}}

Why this prompt works

Pairing each gap with a concrete test turns a coverage report into something immediately actionable.

How to customize it

  • Prioritize gaps in error-handling branches over cosmetic ones.
  • Add the suggested tests before merging, not as a follow-up ticket.

Common mistakes

  • Running this without pasting the existing tests, which produces redundant suggestions.
  • Treating 100% branch coverage as the goal instead of covering the risky branches.

Example

Input

Code and existing tests: New discount calculation function plus its 3 existing unit tests

What a good answer looks like

A list of untested branches, each with a ready-to-add test.

Make this prompt fit your work

ModelCoach.ai scores your version, shows what to improve and explains why, right inside ChatGPT, Claude, Gemini and Copilot.

Related prompts