Loop 005

The 100% test coverage loop

A goal-based coding-agent workflow that identifies uncovered behavior, adds meaningful tests, and stops when the full suite passes at 100% coverage.

Ready-to-use prompt

Copy the loop

Add tests until we have 100% test coverage.

Verify / stop

The full test suite passes at 100% coverage.

Use the project's coverage report as the source of truth.

Context and guidance When to use it, steps, safety notes, and related loops
Published
Updated

Use this when

Use this when 100% coverage is an explicit project requirement and the repository has a trustworthy coverage command, clear exclusions, and a test suite that can be run repeatedly.

How to run it

  1. Run the complete test suite with coverage and save the baseline report.
  2. Prioritize uncovered branches and behavior by risk instead of file order.
  3. Add tests that assert meaningful outcomes, failure paths, and boundary conditions.
  4. Repeat until the full suite passes and the configured coverage report reaches 100%.

Why it works

A concrete coverage target gives the agent a measurable stopping condition and makes skipped code visible. Risk-first ordering keeps the work focused on behavior that matters.

Implementation note

Coverage measures which code ran, not whether the assertions are good. Review test quality, avoid tests that only execute lines, and keep justified generated-code or platform exclusions explicit.