disk-cleanup
Skill387 starsChanged 5 months agoMITView on GitHub
Scan and clean macOS caches, package-manager data, crash dumps, and app caches to reclaim disk space. Deterministic — a config registry (targets.json) plus two scripts (survey.py read-only, clean.py executor) do all the measuring and deleting; the agent only relays a compressed summary and makes the few human-judgment calls. IMPORTANT — use this skill whenever the user's request on macOS involves: freeing disk space, cleaning/clearing caches, "disk is full", "clean up my Mac", "free up space", "what's eating my disk", "running low on disk", needing space for an install, or any low-storage complaint. Covers the whole workflow survey → choose → clean → empty Trash.
12 other projects use a version of this.
Adopted by
Most recently taken up by
- galonge/free-claude-skillstheir own version, first seen Sep 6, 2026
- zhaochuang001/awesome-agent-skillstheir own version, first seen Sep 4, 2026
- gaganjainse/shesh-skillstheir own version, first seen Aug 15, 2026
- ebal/AI-Skillstheir own version, first seen Jul 15, 2026
- xiaxin5666/claude-skills-marketplacetheir own version, first seen Jul 6, 2026
- TsinHzl/disk-cleanup-skilltheir own version, first seen Jul 4, 2026
Other versions12 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 12
- jayll1303/AIEKit★ 18same name
- MakiDevelop/claude-skills★ 3same name
- vndee/engineering-skills★ 3same name
- foogunlana/skills★ 1same name
- galonge/free-claude-skills★ 1same name
- shell-nlp/skills★ 1same name
- skyvanguard/infra-ops★ 1same name
- TsinHzl/disk-cleanup-skill★ 1same name
- xiaxin5666/claude-skills-marketplace★ 1same name
- ebal/AI-Skills★ 0same name
2 more not listed
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 repository104 other files it gives its agents.
- automation-advisor/CLAUDE.mdCLAUDE.md
- agency-docs-updaterSkill
- agency-meetup-publishSkill
- agency-socialsSkill
- agent-cliSkill
- app-releaseSkill
- automation-advisorSkill
- balancedSkill
- brand-agencySkill
- browser-mateSkill
- browsing-historySkill
- chrome-historySkill
- coaching-session-summarizerSkill
- codexSkill
- cognitive-toolkitSkill
- context-builderSkill
- cull-release-checkSkill
- cull-release-prepareSkill
- cull-release-publishSkill
- cull-release-recoverSkill
- cull-releaseSkill
- cull-release-verifySkill
- cullSkill
- daydreamSkill
- decision-toolkitSkill
- deep-researchSkill
- design-tokensSkill
- doctorgSkill
- ecosystemSkill
- elevenlabs-ttsSkill
- elimination-researchSkill
- fathomSkill
- feature-factorySkill
- firecrawl-researchSkill
- font-featuresSkill
- github-gistSkill
- gmailSkill
- google-image-searchSkill
- gpt-image-2Skill
- granolaSkill
- gwsSkill
- health-dataSkill
- i18n-studioSkill
- init-tauri-appSkill
- init-xcode-appSkill
- insight-extractorSkill
- jtbdSkill
- lab-retroSkill
- learning-vaultSkill
- linearSkill
- llm-cliSkill
- local-modelsSkill
- meeting-prepSkill
- meeting-processorSkill
- metaSkill
- name-auditionSkill
- nano-bananaSkill
- nielsen-heuristicsSkill
- pdf-generationSkill
- peer-agent-collaborationSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 1 is distinctive, and 5 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Deterministic by design: All target knowledge lives in targets.json.
- Very specific: line 41
Run python3 scripts/survey.py --json.
- Distinctive: line 43
Do not dump the whole JSON.
- Very specific: line 62
Run clean.py with the resolved selection.
- Very specific: line 66
Add or correct targets by editing targets.json — no code change needed.
- Very specific: line 76
Keep installed software at risk: never (learned the hard way: uv/tools, uv/python, ~/.rustup/toolchains, ~/.bun, ~/.deno are NOT caches).
“Common” is measured: kept by at least 6 in 10 of the 6 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
Disk Cleanup
Deterministic by design. All target knowledge lives in targets.json; all measuring and
deleting lives in scripts/survey.py (read-only) and scripts/clean.py (executor, dry-run by
default). They run headless with zero dependencies (stdlib only) — a user can run them in a
terminal without any agent. The agent's job is small: run the scripts, relay the compressed
output, and decide the handful of things that need human judgment.
The two scripts
python3 scripts/survey.py # read-only: sizes, risk, flags, uncategorized. Touches nothing.
python3 scripts/survey.py --json # same, machine-readable (preferred for the agent)
python3 scripts/clean.py --preset safe # DRY-RUN plan (default — nothing deleted)
python3 scripts/clean.py --preset safe --go # execute (safe risk only)
python3 scripts/clean.py --preset full --allow-medium --go --empty-trash # safe+medium, then empty Trash
python3 scripts/clean.py --ids cargo-registry-cache,go-mod-cache --go # specific targets
python3 scripts/clean.py --preset safe --skip ollama-models --go # exclude onetrash is used for all file removal (never rm); freed space sits in Trash until emptied
(--empty-trash, or the user empties it). Sizes are du estimates — approximate on APFS.
Safety model (enforced in code, not prose)
- Risk gating:
saferuns automatically;mediumneeds--allow-medium;neveris refused even if named by id.advisorytargets only print guidance, never execute. - Preflight on every trashed path: canonical
realpath→ must resolve under anallowed_rootsentry → must not be a symlink → never$HOMEor/. Anything failing is skipped and reported, not deleted. - Dry-run by default:
clean.pyprints the plan and touches nothing unless--go.
Agent workflow
- Run
python3 scripts/survey.py --json. Relay the compressed summary: disk free,safe/mediumrecoverable totals, anyflags(e.g. crash-loop), and the top targets. Do not dump the whole JSON. - Auto-path: for a plain "clean up safe stuff", show the
safetotal and runclean.py --preset safe --go(offer--empty-trash). Safe targets are regenerable. - Escalate to the user ONLY for (these are genuine judgment calls the scripts deliberately
refuse to auto-decide):
mediumtargets (ML models, device support, projectnode_modules) — confirm before--allow-medium. ML-model targets (ollama-models,huggingface-models) carry alast_used_daysfield (newest file atime under the target, aggregate across all models in that store — not per-model) as a "how stale is this" signal; surface it before suggesting deletion.uncategorizeddiscoveries — unknown dirs >100 MB; ask or investigate before adding.advisorynotes — surface them (Telegram cache, simulators viasimctl,uv/tools, Chrome whole-dir, Xcode Archives,mo cleandeep-clean); never act on them automatically. Formole-deep-clean: suggest the user runmo cleanthemselves (interactive TUI, permanent deletes, sudo for system caches) — never invoke it from the agent. Never shell out tomoat all (not even--dry-run): it's TUI-only and blocks waiting for a real terminal even in dry-run mode — confirmed hanging under a piped subprocess,stdin=DEVNULL, and even ascript(1)-allocated pty. Amoleflag in survey.py's output only reads the mtime of mole's own leftover~/.config/mole/clean-list.txt(last-run recency), never invokes it.- surgical Docker / simulator decisions (see below).
- Run
clean.pywith the resolved selection. Relay the result (freed_human, disk before→after).
Maintaining the registry
Add or correct targets by editing targets.json — no code change needed. Each target:
{id, category, risk, method, paths|find, regenerates, priority, note}. Methods:
trash— trash literal paths (globs allowed).find-trash— exact-name dir sweep with amin_mbfloor (crash dumps, projectnode_modules).command— run a CLI (npm cache clean…); setscope_pathso freed bytes can be measured.simctl—xcrun simctl delete unavailable(removes only sims for uninstalled runtimes; safe).downloads-scan— config-driven (config.json→downloads_scan): files older thanage_dayswhose name doesn't matchexclude_patterns. The dry-run lists every file by name for review.advisory— never executes; only prints guidance.
Keep installed software at risk: never (learned the hard way: uv/tools, uv/python,
~/.rustup/toolchains, ~/.bun, ~/.deno are NOT caches). Every non-advisory target's paths
must resolve under allowed_roots or preflight will (correctly) refuse them.
Customization & setup (per-machine, never committed)
config.json ships generic, public-safe defaults. Anything personal — names, family
names, a non-English tax/legal/financial vocabulary — or machine-specific goes in
config.local.json (gitignored). load_config() deep-merges it over config.json:
lists are unioned (local terms only add protection to the Downloads exclude list), scalars
override. See config.local.example.json for the shape.
Setup mode — when the user first uses the skill, asks to personalize it, or has sensitive
files in ~/Downloads, offer to build config.local.json by asking (one short batch):
- Names/keywords in Downloads filenames that must never be swept (own name, family names).
- Their language's tax/legal/financial terms (e.g. German
steuer,rechnung,vertrag). - Their projects directory (for the
node_modulessweep) and any extra app caches. Then writeconfig.local.json(copyconfig.local.example.jsonand fill it in). Confirm what was saved. Never commit it.
Per-machine paths in targets.json (allowed_roots, the node-modules-projects find root
~/ai_projects) are examples — adjust them to the user's layout. Targets whose paths don't
exist on this machine simply measure 0 and are skipped.
Still agent-driven (only what genuinely can't be deterministic)
- Docker only — surgical and stateful: survey with
docker images/docker ps -as/docker system df -v, let the user pick per-name (docker rm/rmi/volume rm/builder prune), or bluntdocker system prune -a -f. A named volume removed = data gone; confirm by name. (Everything else — simulators via thesimctlmethod, Downloads viadownloads-scan, crash dumps, all caches — now runs through the scripts.)
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.

