Agent skill

Prevent Recurrence

by closedloop-ai in closedloop-ai/claude-plugins

A skill your agent uses when fixing a bug or an accepted code-review finding caused by an agent's mistake or by a pattern agents repeat; when a reviewer catches an agent error; when someone says…

Apache-2.0Auto-check passedAgent Workflows

Install Prevent Recurrence

skills CLI
$ npx skills add closedloop-ai/claude-plugins --skill prevent-recurrence -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install closedloop-ai/claude-plugins prevent-recurrence --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/closedloop-ai/claude-plugins.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/closedloop-core/skills/prevent-recurrence .claude/skills/prevent-recurrence && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
prevent-recurrence
GitHub stars
122
Token cost
~2.2k tokens
SKILL.md length
1,288 words
Files
2 (incl. references)
Skills in repo
44
Repo updated
First seen
Licence
Apache-2.0

At a glance

A skill your agent uses when fixing a bug or an accepted code-review finding caused by an agent's mistake or by a pattern agents repeat; when a reviewer catches an agent error; when someone says…

  • Works in 7 steps: Fix the instance → Find the class → Learn the repository's own mechanisms → …
  • An accepted code-review finding caused by an agents mistake
  • SKILL.md covers 1. Fix the instance, 2. Find the class, 3. Learn the repository's own… and 4. Choose the highest rung…, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Prevent Recurrence is an agent skill from closedloop-ai/claude-plugins. Use when fixing a bug or an accepted code-review finding caused by an agent's mistake or by a pattern agents repeat; when a reviewer catches an agent error; when someone says "this keeps happening" or asks how to stop it; or in post-incident follow-up. Fixes the instance (failing-first test where practical), finds and fixes the same mistake elsewhere, then adds the strongest prevention the repository supports (types or architecture, static checks, a guard test, an owning AGENTS.md rule, advisory notes). Not for…

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/rung-examples.md`).

It sits in Agent Workflows, covering Code review and Agent instruction files. The repository describes itself as: Open-source Claude Code plugins for multi-agent software delivery. Plan-first SDLC workflow, code review, LLM quality judges, and self-learning — grounded in your codebase… The licence is Apache-2.0.

When your agent uses it

  • An accepted code-review finding caused by an agents mistake
  • By a pattern agents repeat
  • A reviewer catches an agent error
  • Someone says this keeps happening

Example prompts

  • “this keeps happening”
  • “/prevent-recurrence”

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. Fix the instance
  2. Find the class
  3. Learn the repository's own mechanisms
  4. Choose the highest rung that can catch it
  5. A rule already existed
  6. Scope
  7. Record the event, only where a log exists

What it can do on your machine

Read from SKILL.md and the folder at commit 76594a3. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Prevent Recurrence loads about 2.2k tokens when it runs, and up to ~3k if it reads all its reference files. Until then it costs about 140 tokens; SKILL.md has 1,288 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~140
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from closedloop-ai/claude-plugins at commit 76594a3, republished under its Apache-2.0 licence (© closedloop-ai). 1,288 words, ~2,159 tokens.

Download SKILL.mdSave it as .claude/skills/prevent-recurrence/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
prevent-recurrence
description
Use when fixing a bug or an accepted code-review finding caused by an agent's mistake or by a pattern agents repeat; when a reviewer catches an agent error; when someone says "this keeps happening" or asks how to stop it; or in post-incident follow-up. Fixes the instance (failing-first test where practical), finds and fixes the same mistake elsewhere, then adds the strongest prevention the repository supports (types or architecture, static checks, a guard test, an owning AGENTS.md rule, advisory notes). Not for ordinary feature work.

Prevent Recurrence

A fixed instance is not a fixed mistake. Use this procedure whenever a bug or an accepted review finding was caused by an agent's mistake, or by a pattern agents keep repeating, so the same class of mistake cannot come back unnoticed. It works in any repository and any workflow; it assumes nothing about the repository beyond what you find in step 3.

Skip it for ordinary feature work, rejected review findings, and failures with no mistake behind them (an outage, a flaky runner) unless they expose a missing guard.

1. Fix the instance

  1. Reproduce the failure. Where a test is practical, write one 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 no test is practical (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 the rest of this procedure.

2. Find the class

  1. Search the codebase for the same shape: the same call, import, literal, pattern, or missing pairing; parallel implementations of the same behavior (a twin path for retries, recovery, another platform, another plugin); and code written from the same template. Use text search plus any code-intelligence tool the session has (callers, importers, symbol search).
  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 the follow-up in step 6.
  3. Keep the search commands. They go in the closeout so a reviewer can rerun them, and a search that found every instance with few false positives is often the start of a static check in step 4.

3. Learn the repository's own mechanisms

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

  • Read the root and nearest AGENTS.md and CLAUDE.md (or equivalent) files for the changed paths, plus contributing and testing docs. Note any rule that already covers this mistake; if one exists, step 5 applies.
  • Find the lint configuration and any custom rules, source-gate or policy scripts, allowlists and baselines, and what CI actually runs (workflow files, package scripts, Makefile, justfile).
  • Learn the test conventions: where tests live, how they are named, and whether guard or contract tests already exist (tests that scan source files or iterate a registry are the usual home for a new guard).
  • Read review checklists, PR templates, and review prompt packs if the repository has them. If a review already classified the finding's prevention (for example a workflow-code-review automation status), start from that classification and verify it against what you found.

4. Choose the highest rung that can catch it

Work down this trust ladder and stop at the first rung that can catch the class. Higher rungs enforce; lower rungs only advise.

RungWhat it doesFits when
1. Architecture or typesMakes the bad state impossible to writeThe mistake is an invalid combination, a missing case, a raw value where a typed one belongs, or an API that is easy to misuse and can be reshaped so the safe path is the only path
2. Static analysisThe repository's lint rules or source gates reject itThe mistake has a syntactic shape a check can see: a call, import, literal, file location, or a required pairing in one file
3. Guard testA targeted test fails if it returnsNo syntactic shape, but a test can observe it at a real surface: an output, a contract, an invariant over every registered item, parity between twins
4. Owning AGENTS.md ruleTells the next agent working thereAvoiding it takes judgment no check can encode
5. Memory or notes hintAdvisory context onlyUseful knowledge that is not a code rule (environment pitfalls, external system behavior); never enforcement

Recognize the rung by asking, in order:

  1. Could the code be shaped so the mistake does not compile or cannot be constructed?
  2. Could a check find every instance from its text alone, with few false positives?
  3. Can a test observe the mistake at a public surface without mocking the thing that went wrong? Prefer a test that enumerates all instances (every route, every registry entry, every skill file) over one that pins only the fixed one.
  4. Does it need judgment? Then it is a rule, unless step 5 applies. Put it in the instruction file closest to the owning code, not the root by default: the nearest existing AGENTS.md (or the file the repository treats as canonical when AGENTS.md and CLAUDE.md both exist), or a new nested one only if the repository already uses nested instruction files. Keep it to one or two lines: the rule, why, and how to check.
  5. Otherwise, a memory or notes hint, if the repository or workflow keeps one. A hint is never the only prevention for a correctness mistake: pair it with a rung 4 rule or a follow-up proposing a higher rung.
Show full SKILL.md (443 more words)Show less

If the fitting rung needs a large change outside the current scope, add the highest rung that fits now and propose the higher one as a follow-up. A lower rung may accompany a higher one (for example, a one-line rule pointing at a new lint rule), but do not stack rungs without a reason.

For rungs 1 to 3, prove the prevention works: temporarily reintroduce the mistake (or run the check against the pre-fix code) and confirm the type error, check, or test fails, then restore. A check that never failed has not been shown to catch anything. Rungs 4 and 5 cannot fail; say so in the closeout rather than claiming proof.

Extend an existing mechanism before creating a new one, and do not introduce a new toolchain because of one bug; propose it as a follow-up instead.

Never loosen an existing check to make a change pass: no disabled rules, new suppressions, widened thresholds, or skipped tests. Allowlists and baselines only shrink. If a new check cannot pass yet, start it with an explicit list of the remaining known instances from step 2, which may only shrink, and file the follow-up to clear it.

references/rung-examples.md has labeled examples of each rung.

5. A rule already existed

If a written rule already covered this mistake and was not followed, do not add another rule saying the same thing. Move up a rung: propose or add the static check or guard test that enforces it. If it truly cannot be mechanized, fix why it was missed (wrong file, too far from the code, buried in prose) by moving or tightening the existing rule rather than duplicating it.

6. Scope

  • Include the prevention in the same change when it is small and in the same area: a few files, no new toolchain, no behavior change outside the touched code.
  • Otherwise file a ticket in the tracker the repository or workflow uses, or propose a follow-up in the PR description or final report when you cannot file one. Include the class sentence, the instances with paths, the chosen rung and why, and the proposed check or rule.
  • Never drop it silently. The closeout always names the rung added or proposed, or why none applies.

7. Record the event, only where a log exists

If the repository or the workflow you are running in documents a correction-event log, lessons file, or learning store, record this event there in its documented format. Find it through the instruction files from step 3 or the workflow's own instructions. Do not create one, and do not assume one exists.

Closeout

Report this block in the PR description or final result:

text
Prevention
- Class: <one sentence>
- Instances: fixed <paths> | listed for follow-up <paths> | none found
- Search: <commands used>
- Rung: <rung> via <file or mechanism>
- Proof: <evidence it failed on the reintroduced mistake> | advisory rung, no proof possible
- Why not higher: <reason>
- Follow-up: <ticket or proposal> | none
- Event recorded: <where> | no log defined

© closedloop-ai, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in plugins/closedloop-core/skills/prevent-recurrence of closedloop-ai/claude-plugins.

  • SKILL.md
  • references/rung-examples.md

Open the folder on GitHubat commit 76594a3

Compare with similar skills

Prevent Recurrence next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Prevent Recurrence compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Prevent Recurrence this skillclosedloop-ai/claude-plugins122—~2.2kAutomated safety check: PassApache-2.0
Reviewmorpho-org/morpho-blue-liquidation-bot115—~703Automated safety check: PassMIT
Reviewjuliepy/AI-Engineer-from-scrach441—~417Automated safety check: PassNone
Code Reviewimbenrabi/Financial-Modeling-Prep-MCP-Server150—~2.6kAutomated safety check: PassApache-2.0
Shipmillionco/react-doctor15k—~716Automated safety check: PassCustom licence
Project Prompt CreatorPhilip-Cao-9527/code-note-helper273—~693Automated safety check: PassMIT

Similar skills

  • Review

    morpho-org/morpho-blue-liquidation-bot

    Review code against CLAUDE.md standards with focus on multi-chain safety, BigInt precision, and config separation.

    115 GitHub stars~703 tokensUpdated 2 mo ago
    Agent WorkflowsAuto-check passed
  • Review

    juliepy/AI-Engineer-from-scrach

    Delegate the latest implementation diff to the code-reviewer sub-agent for a PASS/CONCERNS verdict against CLAUDE.md rules, then write the verdict to reports/<feature-review.md.

    441 GitHub stars~417 tokensUpdated 1 mo ago
    Agent WorkflowsAuto-check passed
  • Code Review

    imbenrabi/Financial-Modeling-Prep-MCP-Server

    Review a PR or working diff against this repo's intent layer (the AGENTS.md hierarchy), toolception pitfalls, and core invariants.

    150 GitHub stars~2.6k tokensUpdated today
    DevelopmentAuto-check passed
  • Ship

    millionco/react-doctor

    Take the current branch from done-coding to merge-ready in one pass — review the diff against AGENTS.md, deslop, commit and push, open a PR using rule-validate's PR copy, then babysit until mergeable.

    15k GitHub stars~716 tokensUpdated today
    DevelopmentAuto-check passed
  • Project Prompt Creator

    Philip-Cao-9527/code-note-helper

    在项目 AGENTS.md 约束下生成可直接交给 Codex 或 Agent 执行的中文任务 prompt。用于开发、修复、文档、验证、审计、治理或交接任务的 prompt 化,但不承载 Plan mode 和 code review 的完整模式规则。

    273 GitHub stars~693 tokensUpdated 2 mo ago
    Agent WorkflowsAuto-check passed
  • Promptkit

    microsoft/PromptKit

    Official

    PromptKit composition engine. An agent skill from microsoft/PromptKit.

    111 GitHub stars~420 tokensUpdated 22 days ago
    DevelopmentAuto-check passed

More from closedloop-ai/claude-plugins

All 44 skills in this repo
  • Codex Review

    closedloop-ai/claude-plugins

    Run Codex to review a plan file and return structured feedback with a verdict.

    122 GitHub stars~1.4k tokensUpdated today
    Auto-check: notes
  • Critic Cache

    closedloop-ai/claude-plugins

    Check if critic reviews are still valid before re-running Phase 2.5 critics.

    122 GitHub stars~528 tokensUpdated today
    Auto-check: notes
  • Cross Repo Cache

    closedloop-ai/claude-plugins

    Check if cross-repo coordinator results can be reused, avoiding redundant Sonnet agent launches.

    122 GitHub stars~683 tokensUpdated today
    Auto-check: notes
  • Eval Cache

    closedloop-ai/claude-plugins

    Check for a cached plan-evaluation.json result before launching the plan-evaluator agent.

    122 GitHub stars~516 tokensUpdated today
    Auto-check: notes
  • Find Plugin File

    closedloop-ai/claude-plugins

    This skill should be used when needing to locate files within the Claude Code plugins cache directory (~/.claude/plugins/cache).

    122 GitHub stars~812 tokensUpdated today
    Auto-check passed
  • Plan Validate

    closedloop-ai/claude-plugins

    Deterministic plan.json validation via Python script, replacing most plan-validator agent calls.

    122 GitHub stars~1.2k tokensUpdated today
    Auto-check: notes

Questions about Prevent Recurrence

What does Prevent Recurrence do?

A skill your agent uses when fixing a bug or an accepted code-review finding caused by an agent's mistake or by a pattern agents repeat; when a reviewer catches an agent error; when someone says…. Prevent Recurrence is an agent skill from closedloop-ai/claude-plugins. Use when fixing a bug or an accepted code-review finding caused by an agent's mistake or by a pattern agents repeat; when a reviewer catches an agent error; when someone says "this keeps happening" or asks how to stop it; or in post-incident follow-up.

When should I use Prevent Recurrence?

Prevent Recurrence fits situations like: an accepted code-review finding caused by an agents mistake; by a pattern agents repeat; A reviewer catches an agent error; someone says this keeps happening.

How do I install Prevent Recurrence in Claude Code?

Run `npx skills add closedloop-ai/claude-plugins --skill prevent-recurrence -a claude-code`. Or copy the skill folder (plugins/closedloop-core/skills/prevent-recurrence in closedloop-ai/claude-plugins) into .claude/skills/prevent-recurrence in your project. Claude Code loads it when a task matches its description.

How do I install Prevent Recurrence in Codex?

Run `npx skills add closedloop-ai/claude-plugins --skill prevent-recurrence -a codex`. Or copy the skill folder (plugins/closedloop-core/skills/prevent-recurrence in closedloop-ai/claude-plugins) into .agents/skills/prevent-recurrence in your project. Codex loads it when a task matches its description.

Can I use Prevent Recurrence in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add closedloop-ai/claude-plugins --skill prevent-recurrence -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/prevent-recurrence, .gemini/skills/prevent-recurrence, .github/skills/prevent-recurrence and .opencode/skills/prevent-recurrence in your project.

What does Prevent Recurrence need to run?

SKILL.md names no scripts, command-line tools or credentials: Prevent Recurrence is instructions for the agent only.

Does Prevent Recurrence access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Prevent Recurrence safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Prevent Recurrence use?

Prevent Recurrence is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Prevent Recurrence use?

About 2.2k tokens (SKILL.md is roughly 8.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 880 tokens, read only when the agent opens those files.

What are the alternatives to Prevent Recurrence?

Skills that share tags, products or a category with Prevent Recurrence: Review (morpho-org/morpho-blue-liquidation-bot, 115 stars), Review (juliepy/AI-Engineer-from-scrach, 441 stars), Code Review (imbenrabi/Financial-Modeling-Prep-MCP-Server, 150 stars) and Ship (millionco/react-doctor, 15k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Prevent Recurrence?

closedloop-ai (a GitHub organization) maintains it in closedloop-ai/claude-plugins, which has 122 GitHub stars. The repository holds 44 skills in this directory. The repository was last updated on October 10, 2026.

Source: closedloop-ai/claude-plugins on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.