prevent-recurrence

prevent-recurrence is a skill for Claude Code from closedloop-ai/claude-plugins. It costs 131 tokens per session (2,216 once invoked), scanned B, original, Apache-2.0.

A bug-fixing procedure for mistakes or repeated error patterns that fixes the current problem and adds checks to help prevent the same class of mistake from returning.

In plain words
What is it for?
It is for investigating repeated agent mistakes, addressing accepted code-review findings, reproducing bugs, and adding a test or other guard where practical.
Why use it?
Fixing one bug alone may leave the underlying pattern in place, allowing the same failure to happen again.

Skill for Claude Code

Written for Claude Code: PreToolUse hook event. Also seen: mentions CLAUDE.md; mentions Claude Code; mentions AGENTS.md.

Part of the closedloop-core plugin — 12 skills shipped together

Good fit It is for investigating repeated agent mistakes, addressing accepted code-review findings, reproducing bugs, and adding a test or other guard where practical.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/closedloop-ai/claude-plugins/prevent-recurrence
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 closedloop-ai/claude-plugins --skill prevent-recurrence
Clone the repo
git clone --depth 1 https://github.com/closedloop-ai/claude-plugins

Made for: Claude Code.

Or install closedloop-core, the plugin that ships this one along with the rest of its 12 skills.

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 prevent-recurrence

README.md
[![agentmods](https://agentmods.dev/badge/skills/closedloop-ai/claude-plugins/prevent-recurrence/github.svg)](https://agentmods.dev/skills/closedloop-ai/claude-plugins/prevent-recurrence)
Your own site
<a href="https://agentmods.dev/skills/closedloop-ai/claude-plugins/prevent-recurrence"><img src="https://agentmods.dev/badge/skills/closedloop-ai/claude-plugins/prevent-recurrence/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 prevent-recurrence

Your own site · 80×15
<a href="https://agentmods.dev/skills/closedloop-ai/claude-plugins/prevent-recurrence"><img src="https://agentmods.dev/badge/skills/closedloop-ai/claude-plugins/prevent-recurrence.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 131 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,216 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.00131 $0.02216
Opus 5.5 $0.00052 $0.00886
Sonnet 5.5 $0.00026 $0.00443
Haiku 4.5 $0.00013 $0.00222

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

Security

Grade B, and why

prevent-recurrence scanned grade B with 1 finding 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 10d 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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

- Harness check: find which agent harnesses work here (`CLAUDE.md`, `.claude/`,
plugins/closedloop-core/skills/prevent-recurrence/SKILL.md · 159 lines

How it starts

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

Prevent Recurrence

A fixed instance is not a fixed mistake. Use this whenever correcting an issue or failure reveals a reusable lesson. The correction may involve code, setup, measurement, validation, workflow, or another agent or system mistake. It assumes nothing about the repository beyond step 3's findings.

Skip it for ordinary feature work, rejected review findings, and external outages or flaky infrastructure with no agent or system mistake, unless they expose a missing guard.

1. Fix the instance

  1. Reproduce the failure. Where practical, write a test at the observable surface (public function, route, CLI, rendered output) that fails on the current code, then fix the code and watch it pass. If not (prose, config, a one-off migration), say why in the closeout.
  2. Write the mistake as a class in one sentence: "did X when Y, causing Z". The class sentence, not the instance, drives what follows.

2. Find the class

  1. Search for the same shape: the same call, import, literal, pattern, or missing pairing; twin implementations of the same behavior (retries, recovery, another platform); and code from the same template, with text search and any code-intelligence tool available.
  2. Fix the other instances in the same change when they are small and in the same area. Otherwise list each one with its path for step 6.
  3. Keep the search commands for the closeout; one that found every instance with few false positives can seed a step 4 static check.

3. Learn the repository's own mechanisms

Find what exists before choosing a prevention; never assume a mechanism.

  • Read the root and nearest instruction files for the changed paths, plus contributing and testing docs. If a rule already covers this mistake, step 5 applies.
  • Find the lint configuration, custom rules, source-gate or policy scripts, allowlists and baselines, and what CI runs.
  • Learn the test conventions and existing guard tests (tests that scan source files or iterate a registry usually host a new guard).
  • Read review checklists and PR templates; start from any prevention a review already classified, and verify it.
  • Harness check: find which agent harnesses work here (CLAUDE.md, .claude/, AGENTS.md, .codex/, .agents/) and which instruction files each loads for the changed paths, and when:
    • Claude Code at launch: CLAUDE.md from its working directory up (AGENTS.md if there is none) and .claude/rules/**/*.md without paths:. On demand: a subdirectory's CLAUDE.md on a read, write or edit there (its AGENTS.md on a read, if it has no CLAUDE.md), and a paths: rule on a read, write or edit of a matching file.
    • Codex at start, once per run, in trusted projects only: one AGENTS.override.md, AGENTS.md or configured fallback per directory from the project root to its working directory, up to project_doc_max_bytes (default 32768) in total. Not loaded: files below its working directory, path-scoped text, or .claude/rules (its .rules files are command policy).
    • Both pass a PreToolUse or PostToolUse hook's additionalContext to the model.

Read the full file on GitHub · 159 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. 10d ago Changed · +9 lines · -2 tokens per session scan A → B 5acb96571451
  2. 1mo ago Changed · +1 lines · +17 tokens per session 8b351fa7ec7e
  3. 1mo ago First seen · 149 lines · 116 tokens per session scan A f5a14bb74db1

Subscribe to this mod's changes

prevent-recurrence is a skill published in the GitHub repository closedloop-ai/claude-plugins (122 stars, last pushed 3d ago), licensed Apache-2.0. It adds 131 tokens to every session and 2,216 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-10.

Related

prevent-recurrence compared with skills from other repositories

prevent-recurrence next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
prevent-recurrenceclosedloop-ai/claude-pluginsSkill1223d agoApache-2.0B131Claude Code
systematic-debuggingNousResearch/hermes-agentSkill267ktodayMITA16Claude Code, Codex
node-inspect-debuggerNousResearch/hermes-agentSkill267ktodayMITA19Claude Code, Codex
inspecting-hermes-desktop-domNousResearch/hermes-agentSkill267ktodayMITA20Claude Code, Codex
agent-introspection-debuggingaffaan-m/ECCSkill313k7d agoMITA46Claude Code, Codex
agent-merge-conflict-arbiterNousResearch/hermes-agentSkill267ktodayMITA19Claude Code, Codex
git-advanced-workflowswshobson/agentsSkill43k6d agoMITA54Claude Code