disk-cleanup
БесплатноЗапускает вложенные скриптыНе проверенFrees the disk that agents and worktrees leave behind: caches, merged worktrees, Docker build cache, old logs. Dry run lists safe, regenerable and ask-first…
от yonatangross★ 312 звёзд на GitHubОб этом скилле
disk-cleanup, get the disk back from your agents
Running many agents and worktrees fills a disk fast: a fresh node_modules per
worktree, a build cache per tool, Docker layers, browser downloads, session logs.
This skill finds all of it, sorts it by how safe it is to remove, and removes only
what is provably safe, after you confirm.
Critical rules
- Dry run first, always. Run the script without
--apply, show the inventory, and get an explicit yes from the user in the conversation before any--apply. --applytouches two tiers only. SAFE (caches that refill on their own) and REGENERABLE (merged, clean, idle worktrees; rebuildable stores). ASK FIRST items are listed with the command to run. The script never runs them and neither do you without the user naming the item.- Unreadable is KEEP. A failed
git,gh,lsofordockercall keeps the item and says why. Never remove on a guess. - A worktree is removed only when all of these hold: its tip is on the default branch
(or equals the head of a merged PR), the tree is clean, it holds no ignored file outside
a rebuildable folder (
node_modules,.venv,dist,build,.next,__pycache__and the like; an ignored.env.localkeeps the tree), it is not locked, no process has its working directory inside, nothing in it changed for 60 minutes, and it sits under the home directory. Removal isgit worktree removewithout force. The branch stays. - Report the measured number. The freed total is free space before versus after. The inventory total is an estimate and is labelled as one.
Instructions
Dry run. From a repo you work in (the script scans its worktrees) or with
--root DIRfor a folder that holds several repos:python3 "${CLAUDE_SKILL_DIR}/scripts/disk_cleanup.py" python3 "${CLAUDE_SKILL_DIR}/scripts/disk_cleanup.py" --root ~/codeExit 0 means nothing to clean, 3 means findings, 2 means it could not look.
Show the user the inventory as printed. Lead with the verdict line, then name the three biggest rows and any KEEP lines that explain why a worktree was left alone.
Ask the user to confirm. Offer the narrower forms when they hesitate:
--tier safe(caches only) or--only npm-cache(one item id, or a section such asdocker).Apply with the command the dry run printed under "To act on exactly this list". It pins
--onlyto the ids the user just saw, so anything that became removable after the dry run (a worktree that merged or went idle meanwhile) is left alone:python3 "${CLAUDE_SKILL_DIR}/scripts/disk_cleanup.py" --apply --only npm-cache --only 'worktree:/path/to/tree' python3 "${CLAUDE_SKILL_DIR}/scripts/disk_cleanup.py" --apply --tier safeExpected: one line per action (done or failed), then
freed (measured, before and after).For ASK FIRST rows, read the user the printed command and what it removes. Run it only when they confirm that specific row.
Optional:
--jsonfor a machine-readable inventory,--report FILEto save it. The report starts with a marker line and the script refuses to overwrite a file without it.
What counts as what
| Tier | Meaning | Examples |
|---|---|---|
| 🟢 SAFE | Pure cache, the tool refills it | npm, pip, uv, Cargo, Go caches, Homebrew downloads, Xcode DerivedData, browser caches, Docker build cache and dangling images, agent debug logs older than 14 days |
| 🟡 REGENERABLE | Rebuilds, but costs time or bandwidth | merged worktrees, pnpm store, Playwright browsers, unused Docker images |
| 🔴 ASK FIRST | Might be someone's work | unmerged or detached worktrees, session transcripts, Downloads, Trash, Docker volumes, orphan agent processes |
Full path list per OS and the evidence behind each gate: references/catalog.md.
Example output
disk-cleanup dry run: 47.1 G reclaimable, 24.0 G more needs you
DISK ~ (macOS)
[▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░]
used 355.0 G free 73.0 G 83 % full · 460.0 G total
────────────────────────────────────────────────────────────────────────
🟢 SAFE caches that refill on their own
────────────────────────────────────────────────────────────────────────
🐳 Docker build cache ▓▓▓▓▓▓▓ 14.5 G prune
🌐 Browser caches ▓▓▓▓░░░ 8.9 G clear
📦 npm cache ▓▓▓░░░░ 6.2 G clear
── 29.6 G
────────────────────────────────────────────────────────────────────────
🟡 REGENERABLE merged worktrees and rebuildable stores
────────────────────────────────────────────────────────────────────────
🗂️ app/fix-login merged PR #412 ▓▓▓▓░░░ 3.9 G remove
KEEP app/hotfix-7 dirty (3 files)
KEEP app/agent-3 process cwd inside (pid 4121)
🟢 29.6 G + 🟡 3.9 G = 33.5 G estimated → free 73.0 G → ~106.5 G
ℹ️ Sizes are allocated blocks, so sparse files read small.
Examples
User says
Установить disk-cleanup в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
BashReadAskUserQuestionВложенные файлы
FAQ
Что делает скилл disk-cleanup?
Frees the disk that agents and worktrees leave behind: caches, merged worktrees, Docker build cache, old logs. Dry run lists safe, regenerable and ask-first items with sizes; --apply after you confirm. Use when the disk is nearly full. Never deletes branches.
Как установить скилл disk-cleanup?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл disk-cleanup запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
ci-review
The scan that the plugin's GitHub Action runs.
от Anthropicazure-static-web-apps
Helps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
от GitHubai-ready
Make any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
от GitHubaws-cdk-python-setup
Setup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…
от GitHub