Agentic Loops skills for AI agents
8 practitioner-grade agentic loops skills, each a focused Markdown document your agent loads into context on demand. Search them from Claude Desktop, Cursor or any MCP client, or pull one with the CLI.
All 8 skills
- bug-hunt-loop
An adversarial find → dedup → verify → fix loop that audits a codebase or PR for REAL bugs — correctness, security, concurrency, resource leaks, API misuse — at high precision instead of a wall of false positives. Each round fans out perspective-DIVERSE finders (one lens each, because identical finders just agree on the same obvious bug), dedups fresh findings against ALL previously-seen items (not just the confirmed ones, or rejected findings reappear forever and it never converges), then puts every fresh finding through N independent skeptics each prompted to REFUTE with default-to-refuted (a verifier told to "confirm" rubber-stamps plausible-but-wrong claims). Only findings that survive a majority of skeptics AND carry a written repro get fixed; fixes must pass the project's existing test/typecheck gate. Loops until K consecutive rounds surface nothing new (loop-until-dry, not a fixed count — one dry round can be luck). Use when you need to adversarially hunt bugs in a codebase or PR with high precision, run an automated security/correctness audit, or converge a "is this actually broken?" review instead of dumping speculative nitpicks.
340 lines - data-backfill-loop
A cursor → batch → checkpoint → verify → resume loop for running a transformation over a LARGE dataset — a schema backfill, a re-index, a reprocessing job, millions of rows — that is too big for one pass and MUST survive interruption. Each iteration reads the next un-processed batch from a DURABLE cursor, processes it IDEMPOTENTLY (upsert by key, never blind insert, so a retried/crashed batch can't double-count), persists the new checkpoint, then GATES the batch on counts + invariants before advancing — a failing batch halts the loop and does NOT move the cursor. On restart it resumes from the last checkpoint, never from zero. It paces itself with backpressure so it doesn't melt the source DB, runs a read-only DRY-RUN/shadow first, verifies-as-it-goes to catch a bad transform at batch 3 not after 10M rows, and finishes with a full source-vs-destination RECONCILIATION (count + checksum) — because cursor-reached-end ≠ all-rows-correct. Use when you must backfill, migrate, re-index, or reprocess a large table/collection and need a job that resumes cleanly after a crash and is provably complete, not merely "stopped erroring".
416 lines - eval-driven-loop
An eval → improve-one-thing → re-eval hill-climbing loop for developing an LLM feature (prompt, pipeline, or agent) where "better" must be MEASURED, not vibed. You freeze a labeled eval set, score the current system per-component (accuracy, format, safety, latency — never one blended number), let an agent propose ONE attributable change (a prompt edit, a few-shot example, a tool, a guardrail), re-run the SAME evals, and KEEP the change only if the aggregate score holds and no category regresses past a threshold — otherwise revert. It guards against overfitting with a held-out test split you never optimize against, validates the LLM-as-judge against human labels so its bar doesn't drift, and stops on an honest plateau (or expands the eval set to surface new failures). Use when you're iterating on a prompt/agent/RAG pipeline and need to hill-climb a quality score with a regression gate instead of shipping changes that "look better."
371 lines - migration-loop
A scout → pipeline → gate-each → residue-loop pattern for a large MECHANICAL change across a codebase — an API rename, a framework/version upgrade, a library swap, an import rewrite — that is too big for one context and too risky for one giant diff. You SCOUT first (discover the full work-list of call-sites inline via ripgrep/AST), then pipeline() each site independently (transform → gate the single file → on failure drop it to a residue list), then re-run the loop on the RESIDUE until it is empty. Uses a deterministic AST codemod (jscodeshift/ts-morph/comby) for the 95% and reserves an agent for the bespoke long-tail call-sites a codemod can't safely handle. Gate is per-item: the file typechecks/builds AND a runtime/test check passes for the changed surface (compiles ≠ correct), with a whole-repo gate before commit. Use when you must apply the same change to hundreds of call-sites and want convergence (residue → 0) instead of one unreviewable 400-file diff.
361 lines - refactor-under-tests-loop
A characterize → green → tiny-refactor → green loop for restructuring code WITHOUT changing behavior — extract a function, rename, decompose a god-class, modernize a pattern — the dangerous kind where "it still compiles" is nowhere near enough proof. FIRST it establishes a green characterization-test net: if coverage of the target module is thin, the agent WRITES characterization tests that pin the CURRENT observable behavior — bugs and all — so "preserved" becomes verifiable instead of asserted. Then it loops in TINY steps: snapshot → make ONE structure-preserving change → run the FULL suite → green ⇒ commit the step; red ⇒ REVERT immediately and take a smaller step (never fix-forward inside a half-refactored state). The characterization tests are frozen — editing a test to make it pass is a behavior change masquerading as a refactor, and is forbidden. Loops until the target structure is reached with the suite green at EVERY step. Use when you must safely restructure, extract, rename, decompose, or modernize existing code under a test net without altering what it does.
373 lines - research-synthesis-loop
A gather → synthesize → critique-gaps → fill loop that builds a comprehensive, fully-cited answer or document from many sources, where any single pass always misses something. Each round fans out MULTI-MODAL searchers that each attack a DIFFERENT angle — by-entity, by-time-window, by-source-type, by-counter-argument — each blind to the others (N identical searches find ONE thing N times; N different angles find N things). It then synthesizes into a claim→source structure, and a COMPLETENESS-CRITIC agent — the ENGINE of the loop, not a rubber stamp — asks what is MISSING (a modality not searched, a claim unverified against read text, a key source unread, a steel-manned counter-argument absent, a contradiction left unresolved) and returns a structured gap list that becomes the NEXT round's targeted queries. The gate: every claim must cite a source that was actually retrieved and read — each citation is verified to resolve to gathered text (no hallucinated cites) — and the critic must sign off that no material gap remains. Sources dedup by URL/DOI; one focused expansion (the critic's top gap) per round, so progress is attributable. Loops until the critic returns "no material gaps" twice or the token budget is hit. Use when you need a deep, multi-source, fact-checked research report and want it to converge on completeness instead of stopping at the first plausible-looking draft.
423 lines - self-improvement-loop
A screenshot → critique → improve-one-thing → test loop that systematically develops an admin panel (or any auth-gated, multi-page UI) page by page, in parallel rounds, with a hard typecheck/lint gate and honest stopping criteria. Covers a headless Playwright screenshot harness that mints a real admin session via the Firebase Admin SDK (no auth-bypass code), a fan-out improvement pass where N agents each own a batch of pages, a non-negotiable tsc/eslint gate that makes parallel autonomy safe, an "improvement ladder" that deepens each round, and convergence by skip-rate so you stop instead of degrading into busywork. Use when you have a working-but-undeveloped multi-page UI and want to compound many small, tested improvements without breaking it.
270 lines - test-and-fix-loop
A red→green agentic loop for implementing or repairing code against an existing test suite. One iteration runs the test command, parses the FIRST failure, hands an agent only that failure plus the relevant source, takes the MINIMAL diff, and re-runs the WHOLE suite. The test command's exit code is the only oracle — green or it didn't happen. Includes a tamper guard (reject if the agent shrank or weakened the tests to go green), no-progress detection (same failure signature twice = stuck, escalate), flaky-test quarantine (a failure that passes on bare re-run is flaky, not a bug), environment-vs-test triage (a setup failure loops forever if treated as a code failure), and fan-out across independent failing modules. Use when you have a failing test suite or a broken build and want an agent to drive it to green safely — without it cheating by deleting assertions, looping on a flake, or "fixing" snapshots by regenerating them.
348 lines