disk-cleanup
Skill1 starsChanged 5 months agoMITView on GitHub
Reclaim disk space on a Mac running heavy Claude Code workloads: scan, classify by risk, verify nothing live is using a target, purge staged, prove the result with df. Trigger on "disk is full", "clean up storage", "free up space", "disk cleanup", "/disk-cleanup", "storage almost full", or any macOS low-disk warning. Also covers the follow-on RAM/swap health check. Do NOT use for cleaning a single repo's build artifacts mid-task (just delete them), or for pruning agent memory files.
26 other projects use a version of this.
Adopted by
Most recently taken up by
- andradehenrique/agent-skillstheir own version, first seen Nov 29, 2026
- mizchi/skillstheir own version, first seen Nov 29, 2026
- Thoven-CORP/agent-skillstheir own version, first seen Nov 29, 2026
- rajofearth/disk-cleanuptheir own version, first seen Nov 22, 2026
- hfadhlullah/kaizentheir own version, first seen Nov 15, 2026
- addisonk/skillstheir own version, first seen Nov 8, 2026
Used with
Projects with it also use meta, api-design and 2 more.
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.
demithrasSkillmeta
Strategic decision analysis using CLEAR META framework. Use for architecture decisions, technology selection, strategic trade-offs.
Also in 3 projects that use this
MicrosoftSkillapi-design
Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.
Also in 3 projects that use this
GoogleSkilltdd
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
Also in 3 projects that use this
MicrosoftSkillrelease
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
Other versions26 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 26
- mizchi/skills★ 425same name
- glebis/claude-skills★ 416same name
- mtarcure/claude-vibe-squad★ 220same name
- DaraBoth/skilljmskill★ 8same name
- hfadhlullah/kaizen★ 7same name
- andradehenrique/agent-skills★ 5same name
- MakiDevelop/claude-skills★ 3same name
- vndee/engineering-skills★ 3same name
- TsinHzl/claude-code-config★ 2same name
- addisonk/skills★ 1same name
16 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 repository28 other files it gives its agents.
- advanced-prd-writerSkill
- calendar-reviewSkill
- challenge-before-buildSkill
- claude-build-hardeningSkill
- claude-memorySkill
- claude-product-demo-videoSkill
- codex-imagegenSkill
- codexSkill
- coding-craftSkill
- computer-controlSkill
- context-disciplineSkill
- image-generation-craftSkill
- infinite-working-skillSkill
- intelligent-delegationSkill
- linkedin-post-writerSkill
- okr-structuringSkill
- operator-standardSkill
- posthog-design-customizationSkill
- self-performance-reviewSkill
- session-namerSkill
- session-recallSkill
- skill-hardeningSkill
- slack-statusSkill
- slack-writerSkill
- subagent-briefSkill
- testing-standardsSkill
- verification-gatesSkill
- writing-craftSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 19 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
Run scripts/disk-sweep.sh scan first — it produces the full inventory in one shot.
- Very specific: line 68
Scratchpads: only UUID-named session dirs at depth 2 qualify — a bare glob also catches shared dirs like bundled-skills/ (observed).
“Common” is measured: kept by at least 6 in 10 of the 19 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
The protocol: scan → classify by risk → check live consumers → purge in stages →
prove with df. Nothing is deleted before its risk tier is known and its liveness
checked. Nothing above Tier 1 is deleted without the user's explicit go.
Run scripts/disk-sweep.sh scan first — it produces the full inventory in one shot.
scripts/disk-sweep.sh sweep executes Tier 1 only, with the liveness gates built in
(suitable for a weekly launchd/cron job).
Ground truth first
- Free space =
df -h /System/Volumes/Data. NEVERdf /— that's the sealed system snapshot and reads wildly wrong (12GB used vs a real 180GB, observed in practice). - A full disk breaks the scan itself:
du/sortwrite temp files and fail with "no space left on device". If that happens, purge a known Tier 1 target immediately (npm cache is the fastest safe win), then resume scanning. - Swap health while you're here:
sysctl vm.swapusage. Swap used beyond physical RAM means the real problem is memory residency, not disk — see "Swap follow-on" below.
Risk tiers
| Tier | Targets | Gate |
| 1 — regenerable, purge on request | ~/.npm (npm cache clean --force), ~/.cache/* (tool runtimes, uv, puppeteer, prisma, pre-commit), idle ~/Library/Caches/* (Homebrew + brew cleanup --prune=all, playwright browsers, *.ShipIt updater blobs, pip, swiftpm), Swift/Xcode .build dirs, dead-session scratchpads under /private/tmp/claude-<uid> | Liveness check only |
| 2 — recoverable elsewhere, confirm first | Claude agent vm_bundles (re-downloaded on demand), stale local repos (see repo gate), stale-repo node_modules, stale .claude/worktrees | Explicit yes per category |
| 3 — history, confirm + protect | ~/.claude/projects transcripts, desktop-app session stores | Pinned-session protection (below); never touch app session stores while Claude Desktop runs |
| Never | Caches of currently-running browsers/apps (open handles), anything with unpushed commits or unrescued dirty files, agent memory dirs, the current session's own scratchpad/transcript | — |
Liveness gates (the step that makes this safe)
- Open handles:
lsof +D <target>— empty means safe. One open_logsfile in~/.npmis fine (npm cache clean doesn't touch logs). - Active builds:
ps aux | grep -E 'swift-build|xcodebuild|npm (install|ci)'. - Peer sessions: list running Claude sessions, then map each process's cwd via
lsof -a -p <pid> -d cwd. No live session may sit inside a deletion target. - Zombie-freshness trap: a scratchpad can look "recently modified" solely because an
orphaned dev server is still writing logs into it (observed: three next-servers from
one dead session pinning 4.4GB). Detect orphans by a log/cwd path pointing into a
dead session's scratchpad; kill the process tree (the
next-serverparent, not just its workers), then delete. Kill-verify:ps -p <pid>after, not justkill's exit.
Category-specific gates
- Repo deletion (Tier 2): all three or no delete —
git status --porcelainempty,git log --branches --not --remotesempty,git ls-remote originsucceeds. A repo failing any check gets itsnode_modulesstripped instead, never the repo. - Worktrees:
git worktree listfirst; inspect dirty/untracked files — rescue unique artifacts into the main repo beforegit worktree remove --force+git worktree prune. Commits on worktree branches survive removal (shared.git); only uncommitted/untracked content is at risk. - Transcripts (Tier 3): find protected session UUIDs by grepping their titles in the
desktop app's session store (
~/Library/Application Support/Claude/claude-code-sessions/), then prune*.jsonl -mtime +7excluding those UUIDs and the current session's. Verify survivors after. Automation should use+60days — a paused-but-pinned session can sit untouched for weeks. - Scratchpads: only UUID-named session dirs at depth 2 qualify — a bare glob also
catches shared dirs like
bundled-skills/(observed). Double gate: no file modified in 2 days AND no open handles. Current session always excluded.
Verification (no claim without this)
- Freed space:
df -h /System/Volumes/Databefore and after, reported as numbers ("1.3GB → 39GB free"), never as "cleaned up". - Protected sessions: after a transcript prune,
findthe protected UUIDs and report the count found. - Kills:
ps -pon every killed pid.
Escalation
- Purge done but disk still tight → the remaining levers are Tier 3 app session stores (quit Claude Desktop first) and a storage audit outside the Claude footprint.
- Disk fine but machine slow → swap follow-on: check
vm.swapusage; the fixes are closing idle Claude sessions (each is a resident process), killing orphaned dev servers, running one browser instead of two, and a restart to drain swap. Physical RAM is the hardware ceiling — say so rather than promising software fixes.
Sync home
Sync home: this repo (github.com/justinwilliames/skills) is a sanitized distribution copy; the canonical copy lives in the author's private live library.
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.

