agentleFS
karanmrnkaranmrn/karanagentskills/skills/mac-disk-cleanup/SKILL.md

mac-disk-cleanup

Skill11 starsChanged 24 days agoMITView on GitHub

Free disk space on a developer Mac safely. Measure first, back up what cannot be rebuilt, then delete. Use when a Mac is low on disk space, or when you clean caches, build output, simulators, containers or old agent worktrees.

  • Reads credentials
  • Deletes or force-pushes

9 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use skill-creator.

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.
  • SentrySkill

    skill-creator

    Create new agent skills following the Agent Skills specification. Use when asked to "create a skill", "add a new skill", "write a skill", "make a skill", "build a skill", or scaffold a new skill with SKILL.md. Guides through requirements, writing, registration, and verification.

    Also in 3 projects that use this

The file

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 7 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
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Prefer the tool's own clean-up command.

    line 30
  2. Very specific:

    Do not run docker volume prune or docker system prune --volumes without approval.

    line 43
  3. Distinctive:

    Before you delete anything that is not a rebuildable cache, make a copy or confirm that one exists.

    line 47
  4. Very specific:

    Delete by exact path. Never use a wildcard over a home folder, and never rm -rf a path built from a variable that can be empty.

    line 58
  5. Very specific:

    Run df -h /System/Volumes/Data again.

    line 65

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

Mac disk clean-up

Order: measure, classify, back up, delete, measure again. Delete only what you can rebuild or what a human approved.

1. Measure

df -h /System/Volumes/Data
du -xhd1 ~ 2>/dev/null | sort -hr | head -20
du -xhd1 ~/Library 2>/dev/null | sort -hr | head -20

Go down into the largest folders until each large item has a name and a size. Record the free space now. You compare against it at the end.

2. Classify

ClassExamplesAction
Rebuildable cache~/Library/Caches/*, ~/.npm/_cacache, ~/.cache/*, ~/Library/Caches/Homebrew, ~/.gradle/caches, ~/.cargo/registry/cacheDelete with the tool's own command when it has one.
Build outputnode_modules, target, .next, dist, build, DerivedData in projects that you do not use nowDelete. The project rebuilds them.
Tool dataDocker images and volumes, Xcode simulators and device support, old SDKs, Ollama or other model weightsUse the tool's command. Volumes can hold real data: ask first.
Agent workOld git worktrees and clonesUse audit-agent-worktrees. Never delete them as plain folders.
User dataDocuments, Desktop, Downloads, Photos, Mail, app data, databases, .env files, keysNever delete. Report the size and let the human decide.

Prefer the tool's own clean-up command. It knows what is safe:

npm cache clean --force
brew cleanup --prune=all
docker system df              # look first
docker image prune -a         # images can be pulled again
xcrun simctl delete unavailable
pnpm store prune
uv cache clean
go clean -cache

Do not run docker volume prune or docker system prune --volumes without approval. Volumes can hold the only copy of a database.

3. Back up

Before you delete anything that is not a rebuildable cache, make a copy or confirm that one exists. Examples: a git remote that holds every commit, a Time Machine snapshot, or an archive on another disk.

tmutil listlocalsnapshots /
tar -czf <backup-dir>/<name>.tar.gz -C <parent> <folder>

A backup on the same disk does not free space. Put it on another disk, or confirm the remote copy instead.

4. Delete

  • Delete by exact path. Never use a wildcard over a home folder, and never rm -rf a path built from a variable that can be empty.
  • Move user-visible files to the Trash (trash <path> or Finder), so the human can restore them.
  • Close the app that owns a cache before you delete the cache.
  • Empty the Trash only when the human approves.

5. Measure again

Run df -h /System/Volumes/Data again. Report the free space before and after, each item that you removed with its size, each backup path, and each large item that you left for the human.

APFS local snapshots can hold deleted data. If free space did not change, run tmutil listlocalsnapshots / and tell the human. Do not delete snapshots without approval.

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.