agentleFS
gyujeongiongyujeongion/claude-code-rootcause/skills/rethink/SKILL.md

rethink

Skill1 starsChanged 5 months agoMITView on GitHub

Use when you're about to "add a rule so the AI won't do that again" — after a mistake, a correction, or any "update your instructions to prevent this" request. Instead of bolting another negative prohibition onto your instructions, this skill forces root-cause analysis, converts the ban into a positive process, routes it to the right layer (hook / skill / memory / project instructions), and audits your instruction file for bloat. Triggers on "/rethink", "add a rule so you don't…", "make sure you never…", "remember not to…", or any moment the thought "I'll just add a don't-do-that note" appears.

5 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use adversarial-review.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • MicrosoftSkill

    adversarial-review

    Adversarial review of a system design from 6 critical perspectives -- SRE, security, staff engineer, finance, operator, and developer advocate. Produces a unified risk assessment. Use for INTERACTIVE on-demand reviews during a design conversation (/adversarial-review). For RECIPE-DRIVEN reviews (where prior step context is needed), use the systems-design-critic agent instead.

    Also in 3 projects that use this

  • Other versions5 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 5

    1. epicenter-md/epicenter★ 4.8ksame name
    2. EpicenterHQ/epicenter★ 4.8ksame name
    3. fabioespindula/awesome-nanoclaw-skills★ 2same name
    4. qiulin/skills★ 0same name
    5. VanKyle00/claude-skills★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repositoryOne other file it gives its agents.

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 7 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When an AI agent makes a mistake, the reflex is to add a line to its instructions: *"Never do X."* It feels like progress.

    line 10
  2. Distinctive:

    This skill stops that: When you're tempted to add a prohibition, run this first.

    line 18
  3. Distinctive:

    Run this skill first, then decide where (and whether) anything gets written.

    line 23
  4. Distinctive:

    G1. Abstract the category: Treat the mistake as a *type*, not an incident.

    line 58
  5. Distinctive:

    G3. Convert to a positive process: Write a gate that *opens* the right behavior, not a prohibition that *closes* a wrong one.

    line 70
  6. Distinctive:

    Only adopt a structure that prevents the *whole category* at once.

    line 74
  7. Distinctive:

    Escape hatch: if even a positive process is overkill for a genuine one-off, mark Q4 as one-off and make Phase 2 a no-op.

    line 76

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/rethink — route a mistake to the right fix, not another ban

The problem this solves

When an AI agent makes a mistake, the reflex is to add a line to its instructions: "Never do X." It feels like progress. It isn't.

A negative rule is a one-time patch. Next time the agent fails with Y or Z instead — same root cause, different surface — and you add another ban. Your instruction file swells with "don't do this" notes, each one spending context budget on every single request, while the underlying structural gap is never closed.

This skill stops that. When you're tempted to add a prohibition, run this first.

The rule

"I'll add a rule so it won't happen again" is never the immediate action. Run this skill first, then decide where (and whether) anything gets written.

Correct order for fixing a mistake:

  1. Root-cause analysis (symptom → direct cause → structural cause)
  2. Negative → positive conversion (turn the ban into an enabling process)
  3. Layer routing (decide where it belongs — or that it belongs nowhere)
  4. Write + audit (apply it, then check the instruction file for debt)

Phase 1 — Root-cause analysis (REQUIRED)

Answer all six before moving on. Q3 and Q6 are the ones that matter — stopping at Q1/Q2 is symptom-patching, not structural improvement.

  • Q1. Symptom — What exactly went wrong? (concrete behavior)
  • Q2. Direct cause — Why did the agent do that? (the in-the-moment decision)
  • Q3. Upstream cause — Why did it decide that? What in the system, context, or instructions made that decision look correct?
  • Q4. Class — Pick one category (see Phase 1.5 table). If it's ambiguous, prefer the narrower scope.
  • Q5. Recurrence — One-off / pattern / chronic?
  • Q6. Structural flaw — State, in 1–2 sentences, the system weakness this mistake reveals.

Phase 1.5 — Negative → positive conversion (HARD GATE)

Pass this before Phase 2. This gate is what blocks the "pile up bans" anti-pattern.

Adding a negative prohibition ("never do B") to any layer is forbidden here. A ban is a single-use shield — next time it leaks through C or D, the instructions bloat, and the root structure is untouched. Convert in three steps.

G1. Abstract the category. Treat the mistake as a type, not an incident.

CategoryDefinitionPositive conversion direction
Wrong selectionChose B when A was right (wrong target/option)A compare-and-verify gate before deciding
Sequence errorSkipped a step or did them out of orderA fixed checklist / ordering
Priority failureDid the important thing late or not at allApply a priority frame first
Context blindnessMisread the session, state, or instructionsA context-check gate before starting

G2. Sibling failures. In the same category, would C, D, E also be prevented — or only B? If your fix only blocks B, the conversion isn't done.

G3. Convert to a positive process. Write a gate that opens the right behavior, not a prohibition that closes a wrong one.

  • ❌ "Never do B" → ✅ "Before deciding, check A's condition and state the result, then proceed"
  • ❌ "Never guess" → ✅ "If unsure, say so, then search N times; if still unknown, ask the user"
  • Only adopt a structure that prevents the whole category at once.

Escape hatch: if even a positive process is overkill for a genuine one-off, mark Q4 as one-off and make Phase 2 a no-op. Choosing to write nothing is a valid result.

Output of this phase: one converted positive-process sentence (or a no-op verdict). That sentence — never a ban — is the input to Phase 2.

See references/positive-process-examples.md for worked conversions.


Phase 2 — Layer routing

Decide where the positive process belongs. Match the diagnosis to the narrowest layer that actually fixes it:

LayerUse whenHow
Hook (deterministic)The behavior must fire automatically every time, not be rememberedAdd a hook that injects the gate at the right event
New skillIt's a reusable procedure worth its own triggerAuthor a skill
Existing skillIt belongs to a procedure you already haveEdit that skill
Memory / notesIt's a fact or preference to recall, not a procedureAppend to your memory file
Project instructions (e.g. CLAUDE.md / AGENTS.md)It genuinely applies to every request in this projectInsert into the most specific section
NothingOne-off, or no structural fix is warrantedLog it and stop

Before choosing project-wide instructions, ask: "Does this really apply to every session and every request? Is there no narrower layer it could live in?" If you can't answer yes, don't put it there. Global instruction files are the most expensive layer — every line is re-read on every request.

Present 1–2 candidate layers and pick. "Nowhere" is always a legitimate candidate.


Phase 3 — Write + audit + log

A. Write to the chosen layer. Apply the positive process — never a bare ban.

B. Audit the instruction file. While you're here, scan your project-wide instructions for prior rules on the same topic. Hooks and skills accrete; bans especially. There's a tiny helper for this — point it at your instruction file and it counts the negative rules and flags topics that already have multiple bans:

python3 ~/.claude/skills/rethink/audit.py CLAUDE.md
# → "Negative rules found: 14" + "Topics with multiple bans: 3× config, 2× commit"

It's a thermometer, not a doctor: it shows where bans are piling up; you still run rethink on each cluster to convert them into one positive gate. If you find duplication, contradiction, or a rule that should move to a narrower layer, flag it. Never auto-delete without the user's approval.

C. Log the change (optional but recommended). Keep a short changelog entry so the evolution of your agent's instructions is traceable:

### [CHG-N] YYYY-MM-DD — <title>
- Class: <category from Phase 1.5>
- Recurrence: <one-off | pattern | chronic>
- Target: <file/layer changed>
- Change type: <add | move-layer | delete | new-skill | new-hook | no-op>
- Structural cause: <Q3 / Q6 summary>
- What changed: <one line>

Done

End with a one-line summary, e.g.:

[rethink] wrong-selection → routed to a pre-decision check hook. Logged CHG-12.

When to reach for deusex instead

rethink is for the agent's own mistakes — it ends in a routing decision (hook / skill / memory / instructions). When the problem is a structural flaw in code, a system, or a workflow rather than the agent's behavior, use deusex, which ends in an architectural redesign. They share the same spine: never patch a symptom before you've found its structural cause.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.