/closedloop-core:prevent-recurrencefrom closedloop-core
Guides systematic prevention of recurring issues by fixing the instance, finding similar mistakes across the codebase, and adding the strongest available guard (types, static checks, tests, or AGENTS.md rules). Use after any fix that reveals a reusable lesson.
Ships in closedloop-core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A fixed instance is not a fixed mistake. Use this procedure whenever correcting an issue or failure reveals a reusable lesson that can prevent the same class from recurring. The correction may involve code, setup, measurement, validation, workflow, or another agent or system mistake. 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 external outages or flaky infrastructure with no agent or system mistake, unless they expose a missing guard.
Find what exists before choosing a prevention; never assume a mechanism.
workflow-code-review automation status), start from that classification and verify
it against what you found.Work down this trust ladder and stop at the first rung that can catch the class. Higher rungs enforce; lower rungs only advise.
| Rung | What it does | Fits when |
|---|---|---|
| 1. Architecture or types | Makes the bad state impossible to write | The 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 analysis | The repository's lint rules or source gates reject it | The mistake has a syntactic shape a check can see: a call, import, literal, file location, or a required pairing in one file |
| 3. Guard test | A targeted test fails if it returns | No 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 rule | Tells the next agent working there | Avoiding it takes judgment no check can encode |
| 5. Memory or notes hint | Advisory context only | Useful knowledge that is not a code rule (environment pitfalls, external system behavior); never enforcement |
Recognize the rung by asking, in order:
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.
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.
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.
Report this block in the PR description or final result:
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
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub closedloop-ai/claude-plugins --plugin closedloop-core12 skills in this plugin
/closedloop-intelClosedLoop ticket + codebase intelligence over a shared remote instance. Use PROACTIVELY for questions about ticket scope overlap or duplicate work ("do these tickets overlap", "is someone already doing this", "is this a duplicate"), blast radius ("if I change this file or symbol, what breaks", "which tickets touch this code", "what depends on this module"), ticket lookup by keyword or slug, ticket lineage (which plan produced which issue, branches and PRs for a ticket), and aggregate rollups ("what shipped last week", "what is in progress per project", "what is stale"). Answers with cited evidence (ticket slugs, file paths, graph facts) using the closedloop-graph MCP server. Read-only./decision-tableUse when the user wants a code-grounded decision table for current behavior, wants to compare current behavior against a plan or work item, or needs a control-flow artifact for recovery, retry, finalization, validation, state-machine, or review-heavy edge cases./erd-diagramGenerate or update an interactive ERD (entity relationship diagram) as a single offline HTML file for a Postgres repository, built only from the repo's schema code (a Prisma schema, a SQL schema dump, or a folder of SQL migrations; other ORMs through a model the agent writes from the code). Two styles, canvas-sidebar (one pannable canvas of every table with a table list) and schema-explorer (overview, focused table view, per-domain diagrams). Use when the user asks for an ERD, a database or schema diagram, a map of tables and relationships, or to refresh an existing ERD file./gh-monitor-prStart a detached GitHub pull-request monitor that wakes the exact launching Codex Desktop or CLI root through the managed Codex App Server when review, CI, conflict, merge-queue, closure, readiness, or merge events need attention. Use when the user asks Codex to watch, monitor, babysit, or wait on a PR or merge queue without keeping the current turn alive./guided-manual-qaDerive and run an interactive, evidence-recorded manual QA session for a code change, ticket, branch, or pull request. Use when a human should validate live behavior checkpoint by checkpoint after repository-aware setup; do not use as a substitute for automated tests or a read-only code review./measurement-disciplineUse when optimizing, benchmarking, profiling, or running a performance experiment; when evaluating whether a change actually helped; or when recording or checking past optimization attempts. Prioritizes the largest credible gains against experiment cost, then enforces one-variable experiments, repeated-run noise floors, a required mechanism behind any claimed win, and recorded refutations so failed attempts are not re-litigated.Other plugins' skills for the same job