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
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
- Run the complete test suite with coverage and save the baseline report.
- Prioritize uncovered branches and behavior by risk instead of file order.
- Add tests that assert meaningful outcomes, failure paths, and boundary conditions.
- 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.