disk-space-audit
Skill1 starsChanged 22 days agoMITView on GitHub
Audit disk usage on a developer machine and reclaim space safely. Use when a disk is full or nearly full, when asked to clean a workspace / Downloads / Documents folder, or when hunting what consumed tens of gigabytes. Combines size inventory, git safety checks, and platform traps (APFS atime, copy-on-write clones, hardlinks, git worktrees, PATH-resident tools) so nothing with unpushed work or a live dependency gets deleted.
- Deletes or force-pushes
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Haaaiawd/disk-space-audit-skilltheir own version, first seen Jul 22, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- Haaaiawd/disk-space-audit-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 repository76 other files it gives its agents.
- architecture-diagramSkill
- criteria-auditSkill
- frontend-slidesSkill
- gpt-researcherSkill
- banner-designSkill
- brandSkill
- designSkill
- design-systemSkill
- slidesSkill
- ui-stylingSkill
- ui-ux-pro-maxSkill
- intended-vs-implementedSkill
- cohort-analysisSkill
- brainstorm-okrsSkill
- create-prdSkill
- job-storiesSkill
- outcome-roadmapSkill
- pre-mortemSkill
- prioritization-frameworksSkill
- release-notesSkill
- retroSkill
- sprint-planSkill
- stakeholder-mapSkill
- strategy-red-teamSkill
- summarize-meetingSkill
- test-scenariosSkill
- user-storiesSkill
- wwasSkill
- beachhead-segmentSkill
- competitive-battlecardSkill
- growth-loopsSkill
- gtm-motionsSkill
- gtm-strategySkill
- ideal-customer-profileSkill
- marketing-ideasSkill
- north-star-metricSkill
- positioning-ideasSkill
- product-nameSkill
- value-prop-statementsSkill
- competitor-analysisSkill
- customer-journey-mapSkill
- market-segmentsSkill
- market-sizingSkill
- sentiment-analysisSkill
- user-personasSkill
- user-segmentationSkill
- analyze-feature-requestsSkill
- brainstorm-experiments-existingSkill
- brainstorm-experiments-newSkill
- brainstorm-ideas-existingSkill
- brainstorm-ideas-newSkill
- identify-assumptions-existingSkill
- identify-assumptions-newSkill
- interview-scriptSkill
- metrics-dashboardSkill
- opportunity-solution-treeSkill
- prioritize-assumptionsSkill
- prioritize-featuresSkill
- summarize-interviewSkill
- ansoff-matrixSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 9 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
6
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
- Distinctive: line 9
Every destructive mistake in practice comes from a confident single-signal rule ("nothing accessed in a week", "git says clean", "it is …
- Distinctive: line 25
If a check cannot be completed, report "uncertain".
- Distinctive: line 73
Check every local branch, not just HEAD:
- Distinctive: line 91
No remote means the commits exist only here, regardless of how old the checkout is.
- Very specific: line 99
Remove with git worktree remove <path>, never rm -rf, so the registry stays consistent.
- Distinctive: line 110
Verify per file, and account for two traps:
- Very specific: line 156
After each tier: df again and report before → after.
- Very specific: line 170
Delete the backup refs, or gc will not reclaim anything: git for-each-ref refs/original --format='%(refname)' | xargs -n1 git update-ref -d
- Very specific: line 173
Verify: git log --all --oneline -- <path> must return 0 lines, git fsck clean, commit count sane, working files intact.
- Very specific: line 176
Do not touch the working tree of a repository that another agent or build is actively using.
- Distinctive: line 182
Leave an auditable trail. For every deletion record:
- Distinctive: line 189
Write it to a dated file next to the work, not just to chat.
- Very specific: line 204
Only df is authoritative. du is an upper bound.
- Distinctive: line 214
Never prune volumes without checking: named volumes such as dependency or toolchain caches are reused across builds.
- Distinctive: line 246
Keep the uncertainty visible: list what could not be verified and why.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Disk Space Audit
Reclaiming space is not the hard part. The hard part is deciding what may be deleted. Every destructive mistake in practice comes from a confident single-signal rule ("nothing accessed in a week", "git says clean", "it is only a build dir").
The one rule
Never delete on a single signal. Age, size, git status, and access time are each
insufficient. A path is deletable only when all of these hold:
- No live dependency — not on
$PATH, not in shell config, no open file handles, no process has it as cwd, not a running app bundle. - No unpushed work —
dirty == 0and every local branch hasunpushed == 0and an origin remote exists. - No irreplaceable data — not user data, not experiment output existing only here.
- Reproducible — re-clonable, re-downloadable, or regenerable by a documented command.
- Measured with
df— never quoteduas the amount freed.
If a check cannot be completed, report "uncertain". Uncertainty must be an explicit outcome, never a silent pass. A tool that fails (empty output, encoding error, permission denied) invalidates the conclusion; it does not mean "nothing found".
Phase 0 — Baseline
Record the before-state so the result is measurable:
df -h /System/Volumes/Data # macOS data volume; use / elsewhere
df -k /System/Volumes/Data | awk 'NR==2{printf "%.2f GiB used\n",$3/1048576}'Capture the used bytes as a number. Every later claim of "freed N GB" is
before_used - after_used, nothing else. Do not sum per-directory du values across
phases: concurrent builds and logs write while you work and will corrupt the arithmetic.
Phase 1 — Inventory
Measure the top level, then drill into the largest entries.
cd "$TARGET"
du -sh . # total (approximate, see Phase 4 note)
for d in */ .[!.]*/; do d=${d%/}; [ -d "$d" ] || continue
printf "%8s MB %s\n" "$(du -sm "$d" | cut -f1)" "$d"; done | sort -rn | head -40Include hidden directories (.local-*, .mo-*, .cache). Local CI harnesses commonly
leave multi-GB working dirs behind and never clean them.
For each large entry, record: size, mtime, whether it is a git repo, whether it is in
$PATH, and whether any process holds it.
Phase 2 — Classify
Sort every candidate into exactly one bucket. Do not merge buckets "because they look alike".
| Bucket | Test |
| Live | running app, PATH entry, open handle — never touch |
| Contains unpushed work | git with dirty files or unpushed commits — needs a decision, not a deletion |
| Irreplaceable data | only copy of user/experiment data — needs explicit confirmation |
| Regenerable | build output, caches, dependency dirs, re-clonable repos |
| Duplicate | byte-identical copy exists elsewhere |
Git safety audit (the part that matters)
Check every local branch, not just HEAD:
# WRONG: only inspects the current branch
git rev-list --count HEAD --not --remotes
# WRONG: --all includes refs/tags, producing huge false positives
# (a repo with thousands of release tags reports tens of thousands "unpushed")
git rev-list --count --all --not --remotes
# RIGHT: per branch, heads only
for b in $(git for-each-ref --format='%(refname:short)' refs/heads); do
n=$(git rev-list --count "$b" --not --remotes)
[ "$n" -gt 0 ] && echo "$PWD $b unpushed=$n"
doneA repository is deletable only if it has an origin and every branch reports 0.
No remote means the commits exist only here, regardless of how old the checkout is.
Worktree rules
- The stash belongs to the host repository, not the worktree. Do not use
stash > 0as a reason to keep a worktree; every worktree will report the host's stash. - For a worktree, require
dirty == 0andHEADcontained in a remote ref:git branch -r --contains "$(git rev-parse HEAD)". - Remove with
git worktree remove <path>, neverrm -rf, so the registry stays consistent. git worktree listincludes entries whose directory is gone. Count real ones aftergit worktree prune; otherwise the population is overstated (observed 142 entries where 26 were prunable).git statusreporting clean does not mean the worktree has no data. Ignored directories such asmo-data/,logs/,data/can hold tens of GB. Always rungit status --porcelain --ignoredand inspect those paths separately.
Directory vs archive pairs
An extracted directory next to a .zip/.tar.gz is not automatically redundant.
Verify per file, and account for two traps:
- Archive entries often carry a top-level prefix (
pkg/file.txt) while the extracted tree does not — strip the common prefix before comparing. - ZIPs with legacy Chinese/Japanese filenames store names in CP437/GBK. A naive listing fails or produces mojibake; an empty listing is a failure, not "no unique files".
Compare names and MD5 of contents. Delete the archive only when the directory contains every entry and every hash matches.
Phase 3 — Verify before deleting
For the final candidate set, run all of:
# live dependency
echo "$PATH" | tr ':' '\n' | grep -F "$PWD/candidate"
grep -n "candidate" ~/.zshrc ~/.zprofile ~/.bashrc 2>/dev/null
# process usage
lsof +D ./candidate 2>/dev/null
for pid in $(pgrep -u "$USER"); do
lsof -a -p "$pid" -d cwd -Fn 2>/dev/null | sed -n 's/^n//p'
done | grep -F "$PWD/candidate"
# git state (repo or worktree)
git -C candidate status --porcelain --ignored
git -C candidate log --all --oneline -- .For running application bundles, also check the app's own lock file
(macOS: ~/Library/Application Support/<App>/…lock) and that the bundle is not the
only installation. Deleting the only installed editor or CLI while it runs is a common,
entirely avoidable accident.
Phase 4 — Execute in tiers
Order by risk, cheapest first, and stop between tiers to report.
- Regenerable caches and CI leftovers — no VCS, no handles, disposable.
- Stale repos that pass the full git audit — record each
HEADbefore removal. - Worktrees —
git worktree remove, thengit worktree prune. - Data-bearing directories — only after explicit confirmation, and state exactly what is not recoverable.
- History bloat — a separate, riskier operation (see below).
After each tier: df again and report before → after.
Reclaiming space inside git history
Large binaries committed a few times can dwarf the working tree (a 15 GB disk image
committed six times produced a 91 GB .git). Rewriting history is irreversible when
there is no remote, so:
- Extend
.gitignorefor the offending patterns. - Untrack first, keep the file:
git rm --cached <path>(or-r --cached <dir>), then commit. This makes the path untracked so the rewrite's finalreset --hardcannot delete or overwrite it. Verify it is still on disk before continuing. - Rewrite:
git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch <path>' --prune-empty -- --all(usegit filter-repowhen available). SetFILTER_BRANCH_SQUELCH_WARNING=1. - Delete the backup refs, or
gcwill not reclaim anything:git for-each-ref refs/original --format='%(refname)' | xargs -n1 git update-ref -d git reflog expire --expire=now --all && git gc --aggressive --prune=now- Verify:
git log --all --oneline -- <path>must return 0 lines,git fsckclean, commit count sane, working files intact.
Do not touch the working tree of a repository that another agent or build is actively
using. Check for .git/index.lock, recent commits by other authors, and processes whose
cwd is the repo. Wait for quiescence or ask.
Phase 5 — Record
Leave an auditable trail. For every deletion record:
- path, size, mtime,
HEAD(for repos/worktrees), remote URL - the exact criteria that passed, and the criterion that almost failed
dfbefore and after for the tier- what is not recoverable
Write it to a dated file next to the work, not just to chat.
Platform facts worth knowing
macOS / APFS
atimeis not maintained. Mount options typically omit atime updates, soatime == mtimefor nearly every directory. "Not accessed in a week" is unmeasurable; any tool offering it is really offering "not modified".duoverestimates, sometimes badly, for three distinct reasons:- copy-on-write clones — sibling directories cloned from one another each report full size (observed 3.5× on a database data tree);
- hardlinks — pnpm/node_modules link into a content store; deleting the directory only unlinks, so blocks are freed only when the store entry dies (observed 1.9×);
- shared packfiles / shared extents — similar effect.
Only
dfis authoritative.duis an upper bound.
- Process/
psmay be restricted in a sandbox;lsofstill works for cwd and handles.
Docker
docker system dfreports conservative reclaimable values; actual reclaim afterimage prune -acan be larger because shared layers finally drop.- Order:
docker container prune -f(stopped containers), thendocker image prune -a(unused images; images of running containers are protected), then considerdocker volume pruneanddocker builder prune -af. - Never prune volumes without checking: named volumes such as dependency or toolchain caches are reused across builds.
PATH-resident tool installs
Tools installed into a scratch directory and exported from ~/.zshrc
(export PATH="$HOME/Downloads/gh…/bin:$PATH") look exactly like disposable download
folders. Check $PATH and shell config before deleting anything that contains a bin/.
Anti-patterns
- Deleting by
mtime/atimealone. A four-week-old directory can hold dozens of unbacked commits; an untouched directory can be the only installed editor. - Trusting
git statusclean. Ignored data and caches do not appear in it. - Treating "directory + archive" or "name looks similar" as duplication.
- Summing
duacross phases, or reportingduas bytes freed. - Bulk-deleting many repos in one command with no per-item verification, then discovering a missing remote afterwards.
- Continuing a history rewrite while another process commits to the same repository.
- Leaving
.gitat its pre-rewrite size becauserefs/originalwas never removed.
Deliverable
A short report with:
- Baseline
dfand total target size. - Table of top consumers with classification (live / unpushed / data / regenerable / duplicate).
- Tiered delete list, each tier with size and risk.
- Explicit "keep" list with the reason (unpushed commits, no remote, running app, PATH).
dfbefore → after and the net figure.- What remains reclaimable and the cost of reclaiming it.
Keep the uncertainty visible: list what could not be verified and why.
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.

