agentleFS
5uck1ess5uck1ess/devkit/skills/stuck/SKILL.md

stuck

Skill4 starsChanged 4 months agoMITView on GitHub

Detect when an agent is looping or failing repeatedly, and trigger structured recovery — backtrack, simplify, or escalate.

6 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

10 rules. 0 are common, 9 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 9

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read .devkit/scratchpads/current.md first.

    line 21
  2. Distinctive:

    Don't retry the same approach.

    line 25
  3. Distinctive:

    If the last 2+ attempts failed:

    line 32
  4. Distinctive:

    Remove the last thing you added and see if the base case works

    line 41
  5. Distinctive:

    Use the simplest possible implementation, even if inelegant

    line 42
  6. Distinctive:

    If the same approach failed twice:

    line 46
  7. Distinctive:

    Read the docs or source of the library/API you're calling

    line 48
  8. Distinctive:

    Check if the function signature or types changed

    line 49
  9. Distinctive:

    If you've tried 3+ different approaches:

    line 53
  10. Distinctive:

    Ask the user for guidance — they may know something you don't

    line 56

“Common” is measured: kept by at least 6 in 10 of the 6 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

Stuck Detection & Recovery

Symptoms

You are stuck if any of these are true:

  • Same error message appeared 2+ times in a row
  • You reverted the same change twice
  • The metric hasn't improved in 3+ iterations
  • You're making changes that don't address the actual error
  • You're adding complexity to work around a problem instead of fixing it

Recovery Protocol

0. Check the Scratchpad

Read .devkit/scratchpads/current.md first. It records what was already tried and why it failed. If the scratchpad shows 3+ failed iterations, skip straight to Step 5: Escalate — the pattern of failures is the diagnosis.

1. Stop and Diagnose

Don't retry the same approach. Read the error carefully:

  • What is the actual error message?
  • What file and line does it point to?
  • Is this the same error as last iteration, or a new one?

2. Backtrack

If the last 2+ attempts failed:

  • Revert to the last known-good state: git checkout -- .
  • Re-read the original goal and the current state of the code
  • The problem may be upstream of where you're looking

3. Simplify

Reduce scope:

  • Fix one thing at a time, not three
  • Remove the last thing you added and see if the base case works
  • Use the simplest possible implementation, even if inelegant

4. Change Strategy

If the same approach failed twice:

  • Try a fundamentally different approach, not a variation
  • Read the docs or source of the library/API you're calling
  • Check if the function signature or types changed

5. Escalate

If you've tried 3+ different approaches:

  • Report what you've tried and what failed
  • Show the exact error
  • Ask the user for guidance — they may know something you don't

Anti-Patterns

  • Retry loop — Running the same command hoping for a different result
  • Shotgun debugging — Changing multiple things at once without understanding why
  • Complexity spiral — Adding workarounds on top of workarounds
  • Ignoring the error — Suppressing or catching exceptions instead of fixing the 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.