soloopx.by solo lemon.
Back to loops
Testingevent

Post-Edit Test Guard

Hook-based loop that runs related tests after file edits to catch regressions early.

0 views0 usesby solo lemon.

// parameters

Triggerevent
Max iterations10
Check commandnpm test -- --findRelatedTests
Exit conditionRelated tests pass after each edit batch

// 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 post-edit-test-guard.md.

Install and run the "Post-Edit Test Guard" loop.

Goal: after each batch of file edits, related tests must pass before continuing.
Between iterations run: npm test -- --findRelatedTests <edited files>
Exit when: related tests exit 0.

Step 1: After edits, run related tests. If they fail, fix before making more changes.

// blueprint

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

Goal

after each batch of file edits, related tests must pass before continuing.

// loop_sequence

// loop_sequence_diagram.json
closed loop

Trigger

event event

Actions block

2 steps
1Detect edited files
2Run related tests

Feedback gate

Evaluate: npm test -- --findRelatedTests

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

Check failed

Repeat actions with the latest feedback.

Success

Related tests pass after each edit batch

Safety capMax 10 iterations

// steps

  1. 1
    Detect edited files

    Identify which source files were edited in the last turn.

  2. 2
    Run related tests

    Run the smallest relevant test subset for edited files. Fix failures before continuing.

    npm test -- --findRelatedTests