- Home
- Skills
- Testing & Debugging
- Self-Healing Verify Loop
Works with the AI Agents you already use
Self-Healing Verify Loop
by Rakgorak Rak
Tests pass, or your agent tells you exactly why: auto-detected test command, compact failure summaries and hard stop rules. No infinite loops, no fake "done".
$5
Self-Healing Verify Loop
Example session with this skill installed
Make the tests pass for the date-parsing change, and keep going until it's green.
- Read your context and instructions
- Compiled the self-healing verify loop
Verification command: npm run typecheck && npm test (from package.json, npm).
Attempt 1/3: FAILED (exit 1, 8.2s)
FAIL test/parseDate.test.ts > parses ISO week dates
AssertionError: expected 2026-01-05 to equal 2025-12-29
at test/parseDate.test.ts:22:31
Root cause: parseIsoWeek counts week 1 from Jan 1 instead of from the Monday of the week that contains Jan 4 (ISO 8601).
Fix: computed the week-1 Monday from Jan 4 in src/parseDate.ts:57.
Attempt 2/3: FAILED (exit 2, 3.1s)
src/parseDate.ts(61,7): error TS2322: Type 'number | undefined' is not assignable to type 'number'.
A different failure, so the fix made progress. I added the missing guard for an out-of-range week number.
Attempt 3/3: PASSED in 9.0s
#1 FAIL exit 1 8.2s b5bd3d38bf7868dc
#2 FAIL exit 2 3.1s 7586c078c8cfaaab
#3 PASS 9.0s
Summary
npm run typecheck && npm testnow passes: 112 tests, 0 failures.- Changed:
src/parseDate.ts(ISO week-1 rule, range guard). No tests were skipped or loosened.
Next step: commit, or run Cross-Model Review on the diff first.
Connects securely to your tools. The creator never sees your data.
About this skill
AI agents waste time and tokens in two ways after writing code: they say "done" without running anything, or they retry the same broken fix again and again. This skill stops both with a bounded test → fix → re-test loop whose exit codes tell the agent to continue or stop.
What it does
- Auto-detects the right check:
typecheck/lint+testwith the correct package manager (npm, pnpm, yarn, bun), pytest, cargo, go vet + go test, dotnet, Maven, Gradle, make. - Compact failure summaries: thousands of log lines become the error lines, their context and stack frames, with ANSI colours stripped. Your agent reads the error, not the noise.
- Failure fingerprinting: if a fix produces the same failure (ignoring timings, timestamps, addresses and line shifts), the loop stops with exit
5: no progress, report it. - Hard budget: 3 attempts by default, capped at 5.
- Anti-cheating rules: the agent may not delete tests, loosen assertions, add ignore comments or swallow errors to get a green run. Environmental failures are reported, not "fixed".
- Evidence:
historyshows every attempt's result and fingerprint for an honest final report.
How it works
node scripts/verify.mjs detectpicks the check and the agent tells you which command it will run.node scripts/verify.mjs runruns it with a timeout and prints a failure summary.- Exit
0passed,4fix and retry,5stop (same failure twice),6stop (budget used). - The agent reports exactly what it observed, with the attempt history.
Frameworks & tools
A single zero-dependency Node.js 18+ script. Works with Node, Python, Rust, Go, .NET, Maven, Gradle and Makefile projects on Windows, macOS and Linux.
Why this beats prompting it yourself
"Keep going until the tests pass" has no stop rule, so agents loop, burn tokens, or quietly weaken the tests. Deterministic exit codes and failure fingerprints make the agent stop at the right time and report honestly.
Security
Runs only your project's own verification command (detected from its manifest, or one you give) through the system shell, with a timeout that ends the whole process tree. Writes only .self-heal/log.json. No network calls of its own.
Known limitations
Needs a project with a runnable test, build or type-check command. It cannot fix environmental problems (missing services, credentials or network); it reports them instead.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 9 days ago
- Software
Node.js 18+
Python
- Optional
- Your project's own test toolchain
Permissions
File Scopes
Terminal: runs the project's own test/build command through the system shell (detected from package.json, pyproject.toml, Cargo.toml, go.mod and similar, or given explicitly), with a timeout. Environment Variables: the test process inherits the environment plus CI=1 and colour turned off; nothing is printed or stored. Write Files: .self-heal/log.json, plus the agent's code fixes. The script makes no network calls; your own tests may.
What's inside
Frequently Asked Questions
New in Testing & Debugging
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Testing & Debugging.