llm-self-heal

llm-self-heal is a skill for Claude Code from enricai/leerie. It costs 125 tokens per session (3,218 once invoked), scanned A, original, MIT.

A self-healing workflow that tests failed worker prompts, proposes small prompt changes, and re-runs the failures to measure the result.

In plain words
What is it for?
Use it to establish a baseline, try proposed prompt patches, compare scores across iterations, and produce a report of the best result and healing status.
Why use it?
It helps investigate whether a prompt change fixes repeated failures without directly changing production prompts.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the leerie plugin — 2 skills, 2 commands shipped together

Good fit Use it to establish a baseline, try proposed prompt patches, compare scores across iterations, and produce a report of the best result and healing status.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/enricai/leerie/llm-self-heal
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 enricai/leerie --skill llm-self-heal
Clone the repo
git clone --depth 1 https://github.com/enricai/leerie

Made for: Claude Code.

Or install leerie, the plugin that ships this one along with the rest of its 2 skills, 2 commands.

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 llm-self-heal

README.md
[![agentmods](https://agentmods.dev/badge/skills/enricai/leerie/llm-self-heal/github.svg)](https://agentmods.dev/skills/enricai/leerie/llm-self-heal)
Your own site
<a href="https://agentmods.dev/skills/enricai/leerie/llm-self-heal"><img src="https://agentmods.dev/badge/skills/enricai/leerie/llm-self-heal/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for llm-self-heal

Your own site · 80×15
<a href="https://agentmods.dev/skills/enricai/leerie/llm-self-heal"><img src="https://agentmods.dev/badge/skills/enricai/leerie/llm-self-heal.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 125 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,218 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: 2 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 Excessive Agency · line 179
    Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.
    Fix: Remove the model/provider override or disclose it prominently and require explicit operator approval before invoking an external coding CLI or billed model.
  • medium analysis-evasion · line 1
    Suspicious Unicode normalization or mixed-script content
    Fix: Review the flagged content for security risks. Ensure no credentials, secrets, or sensitive data are exposed.
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.00125 $0.03218
Opus 5 $0.00063 $0.01609
Sonnet 5 $0.00025 $0.00644
Haiku 4.5 $0.00013 $0.00322

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

Security

Grade A, and why

llm-self-heal 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 12d ago.

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/llm-self-heal/SKILL.md · 307 lines

How it starts

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

  1. Baseline — run n=N unpatched replays per failing sample via claude -p, score each, establish noise floor.
  2. Loop — invoke the patch-generator worker (a direct claude -p call) to propose a minimal patch to the system prompt, apply the patch, replay the patched arm, score, check convergence.
  3. Report — write <heal-dir>/<call_type>/healing-<call_type>.md with the verdict (SUCCESS / PLATEAUED / BUDGET_EXHAUSTED / TIMEOUT / REGRESSED), the best patch found, and the full iteration history.

Output: per call_type with failures, a heal report under the run's <heal_subdir>/ directory (default heal-out/; configurable via --heal-dir / LEERIE_HEAL_DIR / leerie.toml heal_dir).

Production prompts in prompts/ are NOT modified by this skill. Patches are proposed evidence — applying them is a separate manual step.

<execution_context> Arguments parsed from $ARGUMENTS:

  • First positional: <run-id> or path to a calls.ndjson file or its parent directory. If a run-id is given, the skill resolves <state-root>/runs/<run-id>/calls.ndjson and the corresponding heal output dir <state-root>/runs/<run-id>/heal-out/, where <state-root> is the resolved leerie state directory (default $HOME/.leerie/<basename>/, overridable via LEERIE_STATE_DIR / --state-dir / leerie.toml state_dir; /leerie-state inside the container) — never a path relative to CWD.
  • --call-type <name> (optional): heal only this call_type; default heals all call_types that have failing verdicts in the verdict files found under judge-out/.
  • --verdict-dir <dir> (optional): where judge-llm-batch wrote its verdict JSON files. Defaults to <run-dir>/judge-out/.
  • --heal-dir <dir> (optional): where to write heal-loop state and reports. Defaults to <run-dir>/heal-out/ or the value resolved from LEERIE_HEAL_DIR / leerie.toml heal_dir.
  • --max-iterations <N> (default 10, HEAL_MAX_ROUNDS_DEFAULT): hard cap on loop iterations per call_type.
  • --n-replays <N> (default 5, HEAL_N_REPLAYS_DEFAULT): replays per arm (baseline or each patched iteration) per failing sample.
  • --success-threshold <0..1> (default 0.9, HEAL_SUCCESS_THRESHOLD_DEFAULT): pass-rate target for SUCCESS exit.
  • --plateau-window <N> (default 3, HEAL_PLATEAU_WINDOW_DEFAULT): consecutive iterations of small delta → PLATEAUED exit.
  • --plateau-delta <0..1> (default 0.03, HEAL_PLATEAU_DELTA_DEFAULT): "small delta" threshold in pass-rate units.
  • --model <alias> (default sonnet, MODEL_DEFAULT_PER_WORKER["heal"]): model alias passed to claude -p for replay arms. Override via LEERIE_MODEL_HEAL or --heal-model on the main orchestrator, or pass --model directly to this skill invocation.

All default values match IMPLEMENTATION.md §2 "Heal-loop convergence parameters". </execution_context>

call_type → prompt-file mapping

Each call_type has exactly one system-prompt source (IMPLEMENTATION.md §10):

call_type Prompt source
classifier prompts/classifier.md
planner prompts/planner.md
reconciler prompts/reconciler.md
implementer prompts/implementer.md
integrator prompts/integrator.md
conformer prompts/conformer.md

The heal loop reads the current file from prompts/ as the base prompt text for any call_type it heals.

Read the full file on GitHub · 307 lines

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. 12d ago First seen · 307 lines · 125 tokens per session scan A ef5be4a3298f

Subscribe to this mod's changes

llm-self-heal is a skill published in the GitHub repository enricai/leerie (10 stars, last pushed 9d ago), licensed MIT. It adds 125 tokens to every session and 3,218 once invoked, about $0.0006 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-31.

Related

Other skills, from other repositories

audit-prompt-caching

Use whenever the user mentions cachedtokens=0,totalcachedtokens,cachereadinputtokens,cachecreationinputtokens,cachewritetokens,promptcachekey,promptcacheoptions,promptcachebreakpoint,previousinteractionid,cachecontrol/cachePoint,TTFT,KV reuse…

sernote/audit-prompt-caching · 139 tokens

structured-output

This skill should be used when the user mentions "structured output", "json mode", "tool schema", "function calling", "json parse error", "responseformat", "pydantic ai", "invalid json from the model", or "the model's JSON keeps breaking". It provides a methodology for getting reliably valid, schema-conformant…

sigistry/marketplace · 89 tokens

forkmind

Use when debugging, comparing, or regression-testing LLM / agent calls — when the user wants to capture LLM traffic, see a conversation as a branchable DAG, fork an alternative prompt or model from a past turn, or pin good outputs as baselines to catch drift. ForkMind is local-first (no cloud, no account) and proxies…

Medhovarsh/forkmind · 132 tokens

langfuse

Expert in Langfuse - the open-source LLM observability platform. Covers tracing, prompt management, evaluation, datasets, and integration with LangChain, LlamaIndex, and OpenAI. Essential for debugging, monitoring, and improving LLM applications in production.

LiHongwei-cn/lihongwei-cn · 57 tokens

llm-debugger

Diagnoses LLM output failures including hallucinations, constraint violations, format errors, and reasoning issues. Provides root cause classification, prompt fixes, tool improvements, and new test cases. Use for "debugging AI", "fixing prompts", "quality issues", or "output errors".

patricio0312rev/skills · 62 tokens

chat-quality-doctor

A troubleshooting guide for unsatisfying roleplay chats with AI characters. It covers problems such as robotic wording, broken character behavior, forgotten details, overly long or short replies, refusals, and stalled plots.

foreverse-app/character-card-skills · 214 tokens