Verification-gated self-running loop skill

A drop-in Claude Code skill that keeps looping until an external verifier passes — not the model's own self-report — making it a strong anti-reward-hacking pattern for autonomous coding.

prompt
→ Claude
Drop-in Claude Code skill: self-running agent loop with a "real, un-foolable verification gate" — loop continues until an external verifier (not the model's self-report) passes.
claude-code

Implementation note

When to use: any autonomous loop where you have been burned by the agent declaring victory prematurely — the model reporting done while the actual checks fail is the classic reward-hacking failure of self-directed loops. How it works: a drop-in Claude Code skill implementing a self-running loop whose continuation logic is gated by a real, un-foolable verification step: the loop continues until an external verifier passes, not until the model's self-report says things look good. The verifier is code the model cannot argue with — tests, builds, whatever objective check you wire in — which structurally removes the incentive to describe success instead of achieving it. Safety: the external-verifier gate is the anti-reward-hacking rail and the entire design point. Its guarantee is exactly as strong as the verifier you supply, so invest in that check; a weak verifier resurrects the original problem one level down. Add an iteration cap alongside it.

Source: selmakcby/loop-engineering

More testing loops

Watch tests while you work

/loopnew

A passive watchdog loop that reruns your test suite every 15 minutes and surfaces failing tests with their error output.

prompt
→ Claude
/loop 15m run the test suite, and if anything fails, show me the failing tests and the error output
testinglow risk

Kill flaky tests

/loopnew

Run your test suite repeatedly, collect every intermittent failure, and fix or quarantine flaky tests until you get five consecutive green runs.

prompt
→ Claude
/loop run my test suite 20 times, collect every intermittent failure, fix or quarantine the flaky ones, and don't stop until you get 5 consecutive fully-green runs
testinghigh risk

Make all tests pass

/goalnew

Implement remaining code and run tests repeatedly until the full suite passes.

prompt
→ Claude
/goal finish the implementation and make all tests pass
testingmedium risk