agentleFS
jollyroger1480jollyroger1480/claude-code-worker-harness/skills/scan-before-rmrf/SKILL.md

scan-before-rmrf

Skill1 starsChanged 11 days agoMITView on GitHub

Before running rm -rf (or equivalent bulk delete) on any directory, list its actual current contents and check whether anything generated, downloaded, or relied-upon during THIS session lives inside it un-copied elsewhere. Never trust your memory of "what's in there" — re-list it right before the delete.

  • Deletes or force-pushes

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    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:

    If unsure, assume no.

    line 43
  2. Distinctive:

    If anything found is not safely duplicated elsewhere, copy or move it out first — even if that means creating a throwaway holding directory.

    line 44
  3. Distinctive:

    Only after that check comes back clean (or after confirmed copy-out) proceed with the delete.

    line 46
  4. Distinctive:

    Delete a directory based on what it was described as at the start of the session ("the broken ComfyUI install") without re-checking what it …

    line 54
  5. Distinctive:

    Treat "the replacement tool works" as proof the old directory is safe to delete — the replacement working and the old directory being empty …

    line 61

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “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

Scan Before rm -rf

<purpose> A directory that was "the old broken tool" at the start of a session can silently become "the folder I've been saving fresh output/models into" by the end of it. Deletion decisions get made based on what the directory WAS (a thing to replace), not what it currently CONTAINS (which may now include work done this session). The fix is cheap: re-list the directory's actual contents immediately before deleting, not from memory of what it used to hold. </purpose>

When To Activate

  • About to run rm -rf, shutil.rmtree, or any recursive delete on a directory (tool install, project folder, "old" anything) that existed before this session started.
  • Especially when that directory was ever used mid-session as an output path (-o, --output, redirected logs, saved files) or a source of files another tool now reads from (models, configs, generated assets).
  • Any time a user says "delete X now that Y works" — Y's own outputs may be sitting inside X.

Instructions

  1. Immediately before the delete, run find <dir> -newer <session-start-marker> or just ls -laR <dir> (or a scoped du -sh <dir>/* for large trees) — do NOT rely on "I remember what's in there."
  2. For every subpath that looks like output, input, or model data, ask: is this copied/backed up somewhere OUTSIDE the directory being deleted? If unsure, assume no.
  3. If anything found is not safely duplicated elsewhere, copy or move it out first — even if that means creating a throwaway holding directory.
  4. Only after that check comes back clean (or after confirmed copy-out) proceed with the delete.
  5. This check is cheap (one ls/find) — never skip it to save a step, especially right after you personally wrote files into that directory earlier in the same session.

NEVER

  • Delete a directory based on what it was described as at the start of the session ("the broken ComfyUI install") without re-checking what it currently holds.
  • Reuse a soon-to-be-replaced tool's own folder structure (its output/, input/, models/) as the save location for a NEW tool's generated files or downloaded assets, even temporarily — pick an independent path from the start.
  • Treat "the replacement tool works" as proof the old directory is safe to delete — the replacement working and the old directory being empty of un-backed-up content are two separate facts.

ALWAYS

  • Pick output/model paths for a new tool OUTSIDE any directory that is a candidate for later deletion, from the very first run — not just before the delete.
  • Re-list a directory's real contents right before deleting it, every time, no matter how confident you are about what's in there.

The Failure That Spawned This Skill

Built a replacement for a crashing ComfyUI install (stable-diffusion.cpp), and out of convenience pointed its --diffusion-model, --vae, --t5xxl flags and -o output path directly at files inside the old ComfyUI folder (its models/ and output/ folders already had the right structure). Generated 3 real video clips, verified them, reported success. Then the user said "yes delete" ComfyUI — and rm -rf on that directory silently destroyed the 3 just-generated clips, the ~18GB of Wan2.2 model weights, and the 3 source stills, none of which had ever been copied outside it. The tool wrapper being replaced does not mean its data directory is a safe delete target — its contents had changed since the session started.

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.