agentleFS
matthullmatthull/my-skills/skills/technical/disk-cleanup/SKILL.md

disk-cleanup

Skill0 starsChanged 55 days agoMITView on GitHub

Analyze disk usage and clean package and container caches on an Arch Linux workstation. Use when the user mentions disk space, storage, cleanup, or that a drive is full.

  • Deletes or force-pushes

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 11 edited versions we read keep these.

  • 2

    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. Distinctive:

    Run these commands to build a usage picture.

    line 14
  2. Very specific:

    Check for orphaned worktree Docker environments — containers/volumes from worktrees that no longer exist.

    line 46
  3. Distinctive:

    All of these are safe — they clear caches that will be rebuilt on demand.

    line 58
  4. Very specific:

    If your project scopes Docker resources per worktree, tear those down before removing the worktree — otherwise wtp remove leaves orphaned …

    line 84
  5. Very specific:

    After cleanup, verify with df -h / and compare before/after.

    line 111

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

Analyze disk usage and clean package/container caches on an Arch Linux workstation.

Trigger: User mentions disk space, storage, cleanup, or "drive is full."

Analysis Phase

Run these commands to build a usage picture. Start broad, drill into the big items.

1. Overall State

df -h /

2. Top-Level Scan

Measure /home/<user>/* and /home/<user>/.* (hidden dirs) separately:

du -sh /home/<user>/* 2>/dev/null > /tmp/du-home.txt
sort -rh /tmp/du-home.txt > /tmp/du-home-sorted.txt

du -sh /home/<user>/.* 2>/dev/null > /tmp/du-hidden.txt
sort -rh /tmp/du-hidden.txt > /tmp/du-hidden-sorted.txt

Then read the sorted files. The usual suspects for hidden dirs:

  • ~/.cache (yay, pip, uv, yarn, npm, Cypress, Playwright, puppeteer, huggingface, browsers)
  • ~/.local/share (Steam, vosk, waydroid, whisper models, flatpak)
  • ~/.npm, ~/.gradle, ~/.gem, ~/.nvm, ~/.rustup, ~/.cargo

3. Docker

docker system df        # Summary: images, containers, volumes, build cache
docker system df -v     # Verbose: per-image and per-volume breakdown

Check for orphaned worktree Docker environments — containers/volumes from worktrees that no longer exist. Compare docker ps -a --format "{{.Names}}" against git worktree list.

4. System Caches

du -sh /var/cache/pacman 2>/dev/null   # pacman package cache
du -sh /var/log 2>/dev/null            # system logs
du -sh /opt 2>/dev/null                # optional packages (DaVinci Resolve, etc.)

Cleanup Commands (Safe)

All of these are safe — they clear caches that will be rebuilt on demand. No data loss risk.

Package Manager Caches

CacheCommandNotes
yay (AUR builds)yay -Sc --noconfirmOften the single biggest hog (100GB+). Clears build source + compiled packages.
pacmanpaccache -rKeeps last 3 versions. Use paccache -rk1 to keep only 1.
npmnpm cache clean --force
yarnyarn cache clean
pippip cache purge
uvuv cache clean
Go buildgo clean -cache
Gradlerm -rf ~/.gradle/cachesOnly if not actively building Android

Docker

WhatCommandNotes
Dangling imagesdocker image prune -fImages not tagged or referenced
All unused imagesdocker image prune -a -fImages not used by any container. Will require rebuild next time.
Orphaned volumesdocker volume prune -fVolumes not attached to any container
Full cleanupdocker system prune -a --volumes -fNuclear option: images + containers + volumes + networks

Worktree Docker Cleanup

If your project scopes Docker resources per worktree, tear those down before removing the worktree — otherwise wtp remove leaves orphaned containers and volumes behind:

cd /path/to/worktree
../../<project>/scripts/wtp-cleanup-env.sh

A per-worktree Docker Compose project is typically named <project>-wt-{ID}. Check your project's cleanup script for the exact naming.

Known gap: wtp remove does not call any such script automatically. It must be run manually before worktree removal.

Browser/Test Tool Caches

These are large and safe to clear, but will re-download on next use:

CacheLocationClear command
Cypress~/.cache/Cypressrm -rf ~/.cache/Cypress
Playwright~/.cache/ms-playwrightrm -rf ~/.cache/ms-playwright
Puppeteer~/.cache/puppeteerrm -rf ~/.cache/puppeteer
Selenium~/.cache/seleniumrm -rf ~/.cache/selenium

Verification

After cleanup, verify with df -h / and compare before/after.

What NOT to Clean Without Asking

  • ~/Videos, ~/Pictures, ~/docs — personal media, operator decides
  • ~/.local/share/Steam — games, operator decides
  • ~/.local/share/vosk, ~/.cache/huggingface — ML models, may be in active use
  • /var/lib/docker — never rm directly, use Docker CLI
  • Any git repo or worktree directory

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.