agentleFS
pabloleonalcaidepabloleonalcaide/development-skills/skills/disk-cleanup/SKILL.md

disk-cleanup

Skill1 starsChanged 36 days agoMITView on GitHub

Reclaim local disk space safely on a development machine — leftover git worktrees, Docker leftovers from integration tests (Testcontainers containers, orphan anonymous volumes, dangling images, build cache) and regenerable caches (Turborepo, Vite, Yarn Berry global, npm). Use when the disk is full or nearly full, on ENOSPC / "no space left on device" errors, when Docker Desktop hangs or won't open, when a SessionStart warning reports low free space, or when the user says "libera espacio", "limpia el disco", "disk cleanup", "free up space".

20 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use release.

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

    release

    Use ONLY when the user explicitly asks to cut/publish a Huabu desktop release or tag a version. Performs an outward action — bumps the version in apps/desktop/package.json, commits + annotated-tags vX.Y.Z, and pushes the branch + tag. That tag push auto-builds the macOS/Windows installers and publishes a GitHub Release. Provides `status`, `bump`, `tag-push`, and a one-command `run` (bump → tag-push).

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 13 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

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

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

    Only stale worktrees to tidy, no space pressure → run scripts/worktree-cleanup.sh on its own.

    line 14
  2. Very specific:

    All scripts live in scripts/ next to this file.

    line 21
  3. Very specific:

    Report: Run scripts/disk-report.sh.

    line 26

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

Disk cleanup

Free space by deleting only what can be regenerated or is already safe elsewhere: a report and a plan first, an explicit OK from the user, then execution. Never touch a container's data, a named volume, uncommitted work or an unpushed commit.

When NOT to use

  • Only stale worktrees to tidy, no space pressure → run scripts/worktree-cleanup.sh on its own.
  • Removing the worktree a PR was just opened from → /create-pr does that itself.
  • Docker data the user wants gone on purpose (reset a database, drop a named volume) — that is a deliberate, targeted command, not a cleanup sweep.

Process

All scripts live in scripts/ next to this file; run them from inside the repo.

  1. Unblock if the disk is at 0. With no free space even command output fails (ENOSPC). Measure with a read-only df -h "$HOME" and start with the biggest safe win (usually worktrees, ~30 GB each with their node_modules). Docker cannot start on a full disk: free space first.
  2. Report. Run scripts/disk-report.sh. It prints free space and the --plan of the three cleaners; nothing is deleted. Sizes of worktrees: du -sh <path> (slow — run in background).
  3. Present the plan to the user in their language, per area: what goes, how much it frees, what is kept and why (copy the script's reasons, don't paraphrase them away). REMOVABLE worktrees (open PR, clean, pushed) are offered one by one, never bundled into "all".
  4. Confirm. Explicit OK per area. A subset → run per item (worktree-cleanup.sh --remove <path>), not --execute.
  5. Execute the confirmed areas:
    • worktrees: scripts/worktree-cleanup.sh --execute (SAFE ones) / --remove <path>
    • Docker: scripts/docker-cleanup.sh --execute (needs the daemon up)
    • caches: scripts/cache-cleanup.sh --execute (stop dev servers first; it skips caches in use) Long removals (worktrees) go to the background; report when they finish.
  6. Report freed space (df -h before/after) and what was kept.

Docker Desktop hung (UI won't open) → restart it without losing containers: free space, osascript -e 'quit app "Docker"', wait; if the backend ignores it, SIGTERM com.docker.backend; SIGKILL only once no com.docker.virtualization/krun process is left (the VM is down, data is closed). Then open -a Docker and check docker ps -a. Never "Reset to factory defaults" / "Clean / Purge data".

Common Rationalizations

RationalizationReality
"The script says commits not in master, so it's unmerged"Squash merges leave the original commits out of master; check the PR state and whether the tip is pushed.
"docker system prune -a --volumes frees the most"It also deletes named volumes and stopped stack containers: local databases gone.
"The worktree is clean, its open PR doesn't matter"No code is lost, but the user may still be working there — offer it, don't assume.
"Deleting the cache while the dev server runs is fine"A running Vite/Turbo loses its cache mid-flight; stop it or let the script skip it.

Red Flags

  • docker system prune, docker volume prune -a or --volumes in a command.
  • git worktree remove --force or git branch -D without the user naming that exact item.
  • Deleting before the user saw the plan, or executing "all" when they picked a subset.
  • Reporting "freed X GB" without a df -h after.

Verification

  • disk-report.sh (or each --plan) output shown before deleting anything
  • user's OK recorded per area / per REMOVABLE worktree
  • df -h after, with the freed amount
  • docker ps -a still lists the stack containers (if Docker was touched)
  • kept items listed with their reason

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.