iterate

iterate is a skill for Claude Code from 0xDarkMatter/claude-mods. It costs 60 tokens per session (3,951 once invoked), scanned A, original, MIT.

An automated improvement loop that changes code, measures one defined result, keeps improvements, and discards regressions. Git records the accepted changes.

In plain words
What is it for?
Use it for repeated tasks such as improving test coverage or another measurable code result, with a defined scope and a higher-is-better or lower-is-better metric.
Why use it?
It prevents open-ended experimentation by giving the agent a clear goal, allowed files, measurement command, and stop conditions.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: reads .claude/ paths; names the AskUserQuestion tool; positional $N argument.

Part of the claude-mods plugin — 103 skills, 3 commands, 3 agents, 4 hooks shipped together

Good fit Use it for repeated tasks such as improving test coverage or another measurable code result, with a defined scope and a higher-is-better or lower-is-better metric.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/0xdarkmatter/claude-mods/iterate
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add 0xDarkMatter/claude-mods --skill iterate
Clone the repo
git clone --depth 1 https://github.com/0xDarkMatter/claude-mods

Made for: Claude Code.

Or install claude-mods, the plugin that ships this one along with the rest of its 103 skills, 3 commands, 3 agents, 4 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for iterate

README.md
[![agentmods](https://agentmods.dev/badge/skills/0xdarkmatter/claude-mods/iterate.svg)](https://agentmods.dev/skills/0xdarkmatter/claude-mods/iterate)
Your own site
<a href="https://agentmods.dev/skills/0xdarkmatter/claude-mods/iterate"><img src="https://agentmods.dev/badge/skills/0xdarkmatter/claude-mods/iterate.svg" alt="Measured on agentmods" height="20"></a>
Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,951 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 6 findings, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Tool Misuse · line 177
    Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
    Fix: Validate all tool parameters against an allowlist. Reject dangerous parameter values (shell=True, --force, -rf /) and use safe defaults.
  • high Tool Misuse · line 183
    Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
    Fix: Validate all tool parameters against an allowlist. Reject dangerous parameter values (shell=True, --force, -rf /) and use safe defaults.
  • high Tool Misuse · line 196
    Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
    Fix: Validate all tool parameters against an allowlist. Reject dangerous parameter values (shell=True, --force, -rf /) and use safe defaults.
  • high Tool Misuse · line 198
    Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
    Fix: Validate all tool parameters against an allowlist. Reject dangerous parameter values (shell=True, --force, -rf /) and use safe defaults.
  • medium MCP Rug Pull · line 290
    npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.
    Fix: Pin the version: npx @scope/[email protected]
  • medium MCP Rug Pull · line 291
    npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.
    Fix: Pin the version: npx @scope/[email protected]
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00060 $0.03951
Opus 5 $0.00030 $0.01975
Sonnet 5 $0.00012 $0.00790
Haiku 4.5 $0.00006 $0.00395

Measured 8d ago against content hash b2e4ef021c31, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

iterate scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/score.sh), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/iterate/SKILL.md · 359 lines

How it starts

The opening of the file, as written. The whole thing — 359 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Iterate - Autonomous Improvement Loop

Inspired by Karpathy's autoresearch: constrain scope, clarify success with one mechanical metric, loop autonomously. The agent modifies code, measures the result, keeps improvements, discards regressions, and repeats - until any stop condition fires or the user interrupts.

The power is in the constraint. One metric. One scope. One loop. Git as memory.

Preflight

Before the loop starts, do the work that makes the loop effective. Don't skip steps - this discipline is what separates a productive overnight run from a flailing one.

1. Collect Config

If provided inline, extract and proceed. If required fields are missing, ask once using AskUserQuestion with all missing fields batched together.

Field Required What it is Example
Goal Yes What you're improving, in plain language "Increase test coverage to 90%"
Scope Yes File globs the agent may modify src/**/*.ts
Verify Yes Shell command that outputs the metric (a number) npm test -- --coverage | grep "All files"
Direction Yes Is higher or lower better? higher / lower
Guard No Command that must always pass (prevents regressions) npm run typecheck
Batch No Changes per iteration. >1 enables bisect-on-regression. Default 1. 3
Iterations No Hard cap on iteration count. 30
Until No Stop when metric crosses this target value. 90
Stagnation No Stop after N consecutive iterations with no improvement. 15
Branch No Branch isolation. current (default), auto (slug from goal), or explicit name. auto

Stop conditions are OR'd: any combination of Iterations, Until, Stagnation may be set. The loop stops when any one is satisfied. If none are set, the loop is unbounded - it runs until interrupted.

2. Plan

Read all in-scope files. Understand the codebase before touching anything.

Read the full file on GitHub · 359 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 359 lines · 60 tokens per session scan A b2e4ef021c31

Subscribe to this mod's changes

iterate is a skill published in the GitHub repository 0xDarkMatter/claude-mods (33 stars, last pushed 15d ago), licensed MIT. It adds 60 tokens to every session and 3,951 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.