Back to loops
Testingmanual

Coverage Until Threshold

Add focused tests until coverage meets your threshold (e.g. 80%), without changing production behavior unnecessarily.

0 views0 usesby solo lemon.

// parameters

Triggermanual
Max iterations12
Check commandnpm test -- --coverage
Exit conditionCoverage threshold met and all tests pass

// run_this_loop

Copy the kickoff into your agent first. The blueprint below explains how the loop evaluates progress and when it should stop.

Open in CursorOpen in Claude

Use loop copies the kickoff prompt. Share copies the loop link. Open in Cursor / Claude only pre-fill that prompt — they do not install hook files. Download loop saves the loop as coverage-until-threshold.md.

Start the "Coverage Until Threshold" loop.

Goal: coverage meets the target threshold (default 80%) with all tests passing
Max iterations: 12
Between iterations run: npm test -- --coverage
Exit when: coverage threshold is met and tests exit 0

Step 1: Run coverage. Add focused tests for the biggest uncovered gaps, then repeat.

Self-pace this loop. After each iteration, run the check command, read the output, and only continue if the exit condition is not met. Stop when the exit condition passes or max iterations is reached. Give a short status update each pass.

// blueprint

The loop contract: target outcome, execution sequence, checks, stopping condition, and safety constraints.

Goal

coverage meets the target threshold (default 80%) with all tests passing

// loop_sequence

// loop_sequence_diagram.json
closed loop

Trigger

Manual start

Actions block

3 steps
1Measure coverage
2Add tests
3Re-measure

Feedback gate

Evaluate: npm test -- --coverage

Run the check, read the output, then decide whether the loop is complete.

Check failed

Repeat actions with the latest feedback.

Success

Coverage threshold met and all tests pass

Safety capMax 12 iterations

// steps

  1. 1
    Measure coverage

    Run tests with coverage reporting enabled.

    npm test -- --coverage
  2. 2
    Add tests

    Write the smallest tests needed to cover uncovered branches. No snapshot spam or trivial asserts.

  3. 3
    Re-measure

    Re-run coverage and confirm threshold is met.

    npm test -- --coverage