disk-scan
Skill638 starsChanged 3 months agoMITView on GitHub
Report what is actually taking up space in a directory tree — the biggest subdirectories and the biggest individual files, largest first. Use this skill whenever the user asks where their storage went or what is eating space: "why is my phone full", "what's using all my space", "find the big files", "what's in this folder taking up 8 GB", "which folder should I clean", "外接盘爆了", "手机满了", "哪个文件夹最大", "找大文件", "磁盘占用", "清理空间", 용량 확인, 가장 큰 파일, ストレージ不足, 大きいファイル. Also use it before any cleanup, archive or move, so the target is chosen from measurements rather than from a guess — and when a scan comes back empty or short, to confirm the directory really is empty instead of assuming the tool failed.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- hifizz/skillstheir own version, first seen Oct 15, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- hifizz/skills★ 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 repository56 other files it gives its agents.
- android-devSkill
- android-ui-automationSkill
- android-vdisplaySkill
- apple-remindersSkill
- appstoreprice-hubSkill
- asc-cliSkill
- bilibili-hubSkill
- Clash 控制器Skill
- cloudflare-dnsSkill
- codex-imageSkill
- codex-on-ishSkill
- contact-vcard-extractorSkill
- deepseek-usageSkill
- doubao-ttsSkill
- douyin-downloaderSkill
- evidence-chain-builderSkill
- exa-searchSkill
- free-ttsSkill
- fucai3d-latestSkill
- generative-ui-minisSkill
- github-sync-helperSkill
- health-sleep-analysisSkill
- health-training-checkinSkill
- hyperframes-cliSkill
- hyperframesSkill
- korea-stockSkill
- maimai-hubSkill
- memos-apiSkill
- nano-bananaSkill
- notion-hubSkill
- openstreetmap-markerSkill
- pdf-converterSkill
- production-agent-publicSkill
- qbt-hubSkill
- quark-hubSkill
- reverse-dcfSkill
- self-improving-agentSkill
- shortcuts-builderSkill
- shortcut-share-fileSkill
- spotify-hubSkill
- stock-fund-flowSkill
- stock-priceSkill
- tavily-searchSkill
- tg-hubSkill
- todoocardSkill
- twitter-downloaderSkill
- twitter-x-hubSkill
- us-stockSkill
- web-content-extractorSkill
- web-searchSkill
- weibo-hubSkill
- whenpeakSkill
- xianyu-hubSkill
- xiaohongshu-hubSkill
- youtube-downloaderSkill
- ytmusic-hubSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
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 28
Read-only by construction.
- Very specific: line 83
Run python3 scripts/disk_scan.py --help for the authoritative flag list.
- Distinctive: line 113
When the user's real goal is reclaiming space, pair the measurement with an explicit decision about what can go: name the candidates, state …
- Distinctive: line 162
Nothing here is destructive, so it is safe to run unprompted: when the user is only asking a question.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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 Scan
Overview
scripts/disk_scan.py walks a directory tree once and reports it back in two ranked
lists: the largest subdirectories, and the largest files. Sizes are subtree totals,
so a directory figure is everything underneath it, not just the files sitting
directly inside.
Read-only by construction. There is no cleanup mode, no --apply, and no code path
that modifies the filesystem. Cleaning up is a decision that deserves its own explicit
confirmation; a measurement tool that can also delete is one flag away from a
disaster, so this one cannot.
Why one pass matters
The obvious implementation sizes each directory separately, which re-walks every
subtree: the root's walk plus each child's walk plus each grandchild's, and so on.
That is quadratic in depth, and it is exactly the case that hurts — a media library,
a project with node_modules, a backup folder. The same tree that answers in three
seconds with one pass can take fifteen with the naive version, and the gap grows with
every level.
Nothing here is clever — it accumulates each file's size into its ancestors during the one walk it already has to do. On a real tree of 3,483 directories and 19,354 files that is 3.1 s against 14.9 s, and the difference widens with depth.
Command
python3 scripts/disk_scan.py --dir /path/to/scan --top 15| flag | meaning |
--dir PATH | root to scan (default: current directory) |
--top N | rows per section (default 15) |
--min-mb M | hide files smaller than M MB — use when a long tail buries the real hogs |
--exclude NAME[,NAME...] | skip directories by name, e.g. .git,node_modules |
--json | machine-readable output, including total_bytes and file_count |
Typical output:
root: /workspace/projects
total: 1.9 GB in 24,118 files
excluded: .git
largest directories (4):
812.4 MB media
604.1 MB archive
233.7 MB node_modules
92.8 MB docs
largest files (2):
310.2 MB archive/2025-06-backup.zip
204.9 MB media/raw/dsc_0421.mov
read-only scan; nothing was changed.Exit codes: 0 scanned; 2 bad path or bad usage. An empty result is a successful
scan of an empty tree, not an error — say so rather than reporting a failure.
Run python3 scripts/disk_scan.py --help for the authoritative flag list.
Which number answers the question
The two lists point at different actions, and conflating them sends the user to the wrong place:
- A large directory with no large files is a breadth problem — many small files. Cleaning it means deleting sets, and the directory ranking is the useful one.
- A large file inside a small directory is a single-artifact problem, and the file
ranking is the useful one.
--min-mbmakes these visible when a long tail of small files outranks them. - A directory showing as large but surfacing nothing large inside usually means one nested directory holds everything; scan that path directly to descend.
Report the measurement and the shape, not a verdict. "media is 812 MB, mostly video" is actionable; "your storage is a mess" is not.
What this cannot do
| limitation | consequence |
| Reports logical size, not on-disk size | Block rounding, sparse files, compression and copy-on-write means the bytes a clean-up actually frees can be smaller — sometimes much smaller — than the figure here |
| Does not follow symlinks | A symlink to a huge tree contributes nothing; the same as never following symlinks to avoid loops. Follow the link yourself and scan the target |
| Counts hard links once per path | A file hard-linked in two places is counted twice, so totals can exceed the real usage |
| Skips what it cannot read | Permission errors are counted as skipped_entries in --json, never as zero. A sandbox root will skip a lot — report the skip count instead of presenting the total as complete |
| Reads metadata only | It does not open files, so it cannot detect duplicates. Two identical 300 MB files are 600 MB here, correctly |
| Single filesystem | Mount points appear as directories on the same filesystem; there is no per-device breakdown |
| Cannot clean anything | Deletion is out of scope by design. Never present this output as a cleanup |
When the user's real goal is reclaiming space, pair the measurement with an explicit decision about what can go: name the candidates, state what freeing them would actually recover in the user's terms, and get confirmation before anything is removed.
Examples
"Why is my phone full?" Find the reachable root first — on a sandboxed device the answer is often that the big data is outside what the scanner can see, which is itself the finding worth reporting. Scan, then compare against the device's reported free space: if the scan totals far less than the storage that is missing, the remainder is in app containers the sandbox cannot reach, and that is the honest answer.
Descend into a hot directory.
python3 scripts/disk_scan.py --dir /workspace/media --top 20Cut the noise in a code project.
python3 scripts/disk_scan.py --dir . --top 10 --exclude .git,node_modules --min-mb 5Excluding is for readability here, not for accuracy — if the question is "what could I
free", do not exclude: node_modules may well be the answer.
Machine-readable, for a report.
python3 scripts/disk_scan.py --dir /workspace --json > scan.jsontotal_bytes, file_count, skipped_entries and both ranked lists are all present,
so a downstream step can quantify rather than parse the human output.
Working on Minis
- Run it in the on-device shell.
python3 scripts/disk_scan.py --dir <path>needs no install — the sandbox already has the interpreter this needs. - Scan the workspace, not the whole device. What is reachable depends on what the sandbox has been granted, and the app container is deliberately not open. Establish what the user means by "full" — the sandbox, the shared folders, or the device overall — before scanning, because a scan of the reachable tree will not add up to the device's storage and presenting it as if it did would be wrong.
- Read
skipped_entriesbefore you report a total. On a device it will rarely be zero, and a total that silently dropped unreadable directories reads as complete when it is not. If it is non-zero, one line stating what was skipped belongs in the answer. - Nothing here is destructive, so it is safe to run unprompted when the user is only asking a question. The moment the conversation turns to deleting, stop and get an explicit decision per item; do not slide from measurement into cleanup.
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.

