mac-disk-cleanup
Skill0 starsChanged 2 days agoMITView on GitHub
macOS only. Find what is filling a Mac's disk and free space safely, one agreed step at a time, with every step measured and logged in a live tracker page. Use for "disk space notification", "my disk is full", "free up space", "what's using my disk", "clean up caches", "/mac-disk-cleanup". When a tool fails with "No space left on device", offer this skill rather than starting a cleanup unasked. Covers APFS containers, Time Machine local snapshots, developer caches (uv, npm, Homebrew, Terraform/Terragrunt, Nix, Colima/Docker), project build output, duplicate git clones, models, VMs and Downloads.
- Reads credentials
- Deletes or force-pushes
- Installs packages
4 other projects use a version of this.
Adopted by
Most recently taken up by
- deBilla/claude-skillstheir own version, first seen Oct 25, 2026
- Shaybush/claude-skillstheir own version, first seen Sep 10, 2026
- MaksimZinovev/mac-disk-cleanup-skilltheir own version, first seen Jun 28, 2026
- Mateeb11/skillstheir own version, first seen Jun 27, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- Shaybush/claude-skills★ 3same name
- Mateeb11/skills★ 1same name
- deBilla/claude-skills★ 0same name
- MaksimZinovev/mac-disk-cleanup-skill★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository7 other files it gives its agents.
- browser-selectSkill
- claude-usageSkill
- diagram-styleSkill
- docs-sweepSkill
- md-tocSkill
- session-exportSkill
- tracker-pageSkill
The file
We split this skill into the rules it gives an agent
9 rules. 0 are common, 2 are distinctive, and 7 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
measure: before anything else;
- Very specific: line 18
macOS only: If uname -s isn't Darwin, say so and stop.
- Very specific: line 19
Is a cleanup already running?: Look for another agent (Claude, Codex) or a terminal running one: pgrep -fl 'uv …
- Very specific: line 26
Use dust or dua, never du -sh ~.
- Very specific: line 48
Run each agreed step with python3 $S/run_step.py <run-dir> <item> -- <command…>.
- Distinctive: line 50
Before each step,: run that item's preflight from the catalogue: running processes, open files, git reachability.
- Very specific: line 57
When a step shows little or no free-space gain, check local snapshots: tmutil listlocalsnapshots /.
- Very specific: line 58
If a snapshot was taken before the deletions, it holds the deleted blocks.
- Very specific: line 70
Handover: write REVIEW-WHEN-BACK.md in the run folder with the open decisions.
“Common” is measured: kept by at least 6 in 10 of the 3 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.
Files
Mac disk cleanup
A disk cleanup goes wrong in three ways: deleting something the user wanted, killing something that was running, or reporting space that never came back. This skill avoids all three:
- measure before anything else;
- agree each step at the right level;
- run one step at a time, measuring free space before and after;
- log the step.
The hotspot list, with clean commands and gotchas, is in references/catalog.md. Read it before you propose cleanups. Scripts: S=<this skill's folder>/scripts (~/.claude/skills/mac-disk-cleanup for a global install, .claude/skills/mac-disk-cleanup in a project).
0. Before touching anything
- macOS only. If
uname -sisn'tDarwin, say so and stop;measure.shrefuses too. Checkdustis installed (brew install dust). - Is a cleanup already running? Look for another agent (Claude, Codex) or a terminal running one:
pgrep -fl 'uv cache|nix-collect-garbage|brew cleanup|npm cache', and look for a recent run folder under~/disk-cleanup-tracker/runs/. If you find one, join that tracker and log there. Don't start a second one. Run the baseline:
bash $S/measure.sh ~/disk-cleanup-tracker/runs/$(date +%F). It is read-only and reports:- which APFS container is full (the internal one is usually
disk3; an external backup disk is a different container); - free space;
- local snapshots;
- the biggest folders, measured with
dust.
Use
dustordua, neverdu -sh ~;dutakes minutes on a large home folder.- which APFS container is full (the internal one is usually
- Less than ~5% free is urgent. Say so, and offer tier A caches first: they are the fastest safe win.
1. Answer and propose
Tell the user which disk it is, then list candidates biggest first, grouped by tier:
| Tier | What | Approval |
| A | Caches that rebuild themselves | one approval can cover the batch |
| B | Tool data with side effects (Nix, Colima, provider binaries, build output) | one at a time, side effects stated first |
| C | Personal data (Downloads, models, VMs, media) | one at a time, always; give sizes and last-used dates; never push |
| D | Git (duplicate clones, gc) | one at a time, with the evidence from git_redundancy.py |
For each candidate give: size, the exact command, what breaks or must happen afterwards, and whether it can be undone. Use GiB, and label any size that comes from an earlier estimate rather than a fresh measurement.
2. Tracker
Use the tracker-page skill (same repo; install it alongside this one) in the run folder: one item per candidate, grouped by tier. Items move from review, to decision (waiting for the user), to in-progress, to done or blocked. Start tracker.py serve in the background and give the user the URL. Log every approval in the user's words: tracker.py log "User selected …".
3. Run one step at a time
- Run each agreed step with
python3 $S/run_step.py <run-dir> <item> -- <command…>. For plain deletions use--delete <paths…>.--deleterefuses symlinks, paths outside$HOME, and these folders themselves:~,~/Library,~/Library/Application Support,~/Library/Caches,~/Documents,~/Desktop,~/Downloads,~/Pictures,~/code,~/.cache,~/.local,~/.local/share,~/.config,~/.ssh(things inside them can still be deleted once approved). - It records
df -kbefore and after, the output, the exit code,results.jsonl, and updates the tracker item and log. - Before each step, run that item's preflight from the catalogue: running processes, open files, git reachability. Re-check the scope right before deleting, not just when you proposed it.
- Stop owning processes gracefully, and only the ones that block the step. Tell the user what will disconnect: for example, uv-launched MCP servers drop until
/mcpreconnect. - If a command is denied or needs sudo, log the exact error and hand the user a ready line:
! sudo …. Never edit permission settings yourself. - If a step fails, log it and keep it
blocked. Don't fall back torm -rfon something that has its own clean command.
4. Get the space back
When a step shows little or no free-space gain, check local snapshots: tmutil listlocalsnapshots /.
- If a snapshot was taken before the deletions, it holds the deleted blocks. Give the user
! sudo tmutil deletelocalsnapshots <date>(or tell them it clears itself within about a day). - Re-measure afterwards with
df -kand log the real number. If a shell wrapper or hook filtersdfoutput, check the Avail column survived.
5. Close the run
- Summary table: each item, its status, and the measured change in free space; the total, from the baseline to now.
- Prevention:
TF_PLUGIN_CACHE_DIR;--rmon MCPdocker runlines;- a Spotify cache limit;
uv cache prunenow and then;- asking before large downloads land in Downloads.
- Handover: write
REVIEW-WHEN-BACK.mdin the run folder with the open decisions. - Catalogue: tell the user about any new lesson (new hotspot, new failure, new command) so it can go into
references/catalog.mdupstream. Don't edit the installed copy:npx skills updatereplaces it. In a clone of the repo, edit the file there.
Rules
- Nothing gets deleted without approval at its tier. An approval in one run doesn't carry over to the next.
- Free space is measured, never inferred from folder sizes. Measurements taken while other things are running are noisy; say so.
- Times: chat follows the user's time convention from their CLAUDE.md, if any. Logs and reports use the system clock and are append-only; fix a mistake by adding a correction, never by editing history.
- Personal data: report it, don't judge it. Offer, never push.
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
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.

