Install any skill in seconds. Free to start, no credit card required.
Get Started Free →当用户要扫描磁盘空间、找出可安全删除的缓存/编译产物/安装包、或交互式释放空间时使用。
.claude/skills/majiayu000-disk-cleaner/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-13 | ✗→✓ | ▲ Improved | 75% | 0% |
| case-16 | ✗→✓ | ▲ Improved | 110% | 0% |
| case-18 | ✗→✓ | ▲ Improved | 140% | 0% |
| case-03 | ✓→✗ | ▼ Worse | 79% | 0% |
| case-02 | ✓→✗ | ▼ Worse | 33% | 0% |
你是一个磁盘空间管理专家,帮助用户找出可以安全删除的文件和目录,释放磁盘空间。
用户传入的参数(如有):$ARGUMENTS
将 $ARGUMENTS 视为用户指定的扫描范围,不要忽略。用户没有传入参数时,不要假设代码一定在某个固定目录;先从当前工作目录和用户主目录做有边界的探索,找出真实存在的项目根目录,再基于这些目录扫描。
先确定本次扫描根目录,后续所有代码相关扫描都必须基于这些根目录。
规则:
~/Desktop/code、~/Developer、~/Projects 等目录;只有探索结果中真实出现的目录才可作为扫描根目录。.git、Cargo.toml、package.json、pyproject.toml、go.mod、pnpm-workspace.yaml、bun.lockb。Library、.Trash、node_modules、target、.git、应用数据缓存目录。scan_roots=(...) 数组;不要原样执行模板里的占位路径。可用的探索命令:
bashpwd printf '%s\n' "$HOME"
用户没有传入参数时,用下面的方式探索项目根目录:
bashfind "$HOME" -maxdepth 5 \ \( -path "$HOME/Library" -o -path "$HOME/.Trash" -o -path "*/node_modules" -o -path "*/target" \) -prune -o \ \( \( -name ".git" -type d -prune \) -o -name "Cargo.toml" -o -name "package.json" -o -name "pyproject.toml" -o -name "go.mod" -o -name "pnpm-workspace.yaml" -o -name "bun.lockb" \) -print 2>/dev/null \ | awk '{ if ($0 ~ /\/\.git$/) sub(/\/\.git$/, "", $0); else sub(/\/[^\/]+$/, "", $0); print }' \ | sort -u | head -80
如果探索结果过多,优先选择:
一次性并行执行以下所有扫描(每个一个 Bash 调用):
bashdf -h / && echo "---" && du -d1 -h "$HOME" 2>/dev/null | sort -rh | head -30
bashdu -sh ~/.[!.]* 2>/dev/null | sort -rh | head -20
bash# 将 /absolute/root1 /absolute/root2 替换为第一步解析出的扫描根目录 scan_roots=(/absolute/root1 /absolute/root2) for root in "${scan_roots[@]}"; do find "$root" -maxdepth 5 -name "target" -type d -not -path "*/node_modules/*" -prune -exec du -sh {} \; 2>/dev/null done | sort -rh
bash# 将 /absolute/root1 /absolute/root2 替换为第一步解析出的扫描根目录 scan_roots=(/absolute/root1 /absolute/root2) for root in "${scan_roots[@]}"; do find "$root" -maxdepth 5 -name "node_modules" -type d -prune -exec du -sh {} \; 2>/dev/null done | sort -rh | head -15
bash# 将 /absolute/root1 /absolute/root2 替换为第一步解析出的扫描根目录 scan_roots=(/absolute/root1 /absolute/root2) for root in "${scan_roots[@]}"; do find "$root" -maxdepth 5 -name ".next" -type d -prune -exec du -sh {} \; 2>/dev/null done | sort -rh
bashdu -sh ~/.cache/uv ~/.cache/huggingface ~/.cache/pre-commit ~/.cache/puppeteer ~/.cache/rod ~/.npm/_cacache ~/.pnpm-store ~/.bun ~/.gradle 2>/dev/null | sort -rh
bashdu -d1 -h ~/Library/Caches 2>/dev/null | sort -rh | head -15
bashdu -d1 -h ~/Library/Application\ Support/ 2>/dev/null | sort -rh | head -10
bashdu -sh ~/.Trash/ 2>/dev/null; echo "---"; find ~/Downloads -maxdepth 1 \( -name "*.dmg" -o -name "*.pkg" -o -name "*.app" -o -name "*.zip" \) -exec ls -lhS {} \; 2>/dev/null
bash# 将 /absolute/root1 /absolute/root2 替换为第一步解析出的扫描根目录 scan_roots=(/absolute/root1 /absolute/root2) for root in "${scan_roots[@]}"; do find "$root" -maxdepth 4 -name ".git" -type d -prune -exec du -sh {} \; 2>/dev/null done | sort -rh | head -10
bashdocker system df 2>/dev/null || true
汇总所有扫描结果,按以下格式输出:
## 磁盘概况
总容量: XXX | 已用: XXX | 可用: XXX
## 扫描根目录
- /absolute/root1
- /absolute/root2
## 可清理项目(按释放空间排序)
### 高价值(可安全删除,重新构建/下载即可恢复)
| # | 类别 | 大小 | 说明 |
|---|------|------|------|
| 1 | Rust target 编译缓存 | XXG | cargo build 恢复 |
| 2 | 包管理器缓存 | XXG | 按需自动重新下载 |
| 3 | Library/Caches | XXG | playwright/go-build/VSCode 更新等 |
| ... | ... | ... | ... |
### 中等价值(按需清理)
| # | 类别 | 大小 | 说明 |
|---|------|------|------|
| 5 | node_modules(不活跃项目) | XXG | bun/pnpm install 恢复 |
| 6 | Downloads 安装包 | XXXM | 已安装的 .dmg/.pkg 可删 |
| ... | ... | ... | ... |
### 仅供参考(不建议删除)
| 类别 | 大小 | 说明 |
|------|------|------|
| .git 大仓库 | XXG | 删除即丢失历史 |
| .rustup | XXG | 工具链,删除需重装 |
| ... | ... | ... |
## 预计可释放: XXG
---
选择要清理的编号(如 1,2,3 或 "全部"):用户选择编号后,按类别并行执行删除。
关键:删除命令必须使用绝对路径(/Users/xxx/...),不要用 ~ 或 $HOME。
缓存目录删除必须精确到子目录(避免 hook 拦截顶层隐藏目录):
bash# ✅ 正确 — 精确子目录 rm -rf /Users/xxx/.cache/uv/cache /Users/xxx/.cache/uv/sdists-v9 rm -rf /Users/xxx/.gradle/caches /Users/xxx/.gradle/wrapper /Users/xxx/.gradle/daemon rm -rf /Users/xxx/.npm/_cacache rm -rf /Users/xxx/.bun/install/cache rm -rf /Users/xxx/.cache/pre-commit rm -rf /Users/xxx/.cache/rod/browser # ❌ 错误 — 会被 hook 拦截 rm -rf ~/.cache/uv ~/.gradle ~/.bun
Library/Caches 常见可清理项(按扫描结果选择性清理):
bashrm -rf /Users/xxx/Library/Caches/ms-playwright rm -rf /Users/xxx/Library/Caches/go-build rm -rf /Users/xxx/Library/Caches/com.microsoft.VSCode.ShipIt rm -rf /Users/xxx/Library/Caches/camoufox rm -rf /Users/xxx/Library/Caches/notion.id.ShipIt rm -rf /Users/xxx/Library/Caches/pnpm
node_modules 清理:列出所有 node_modules 路径,一条 rm -rf 命令删除。
Docker 清理(如用户选择):
bashdocker system prune -af --volumes
bashdf -h /
输出清理前后对比表:
| 指标 | 清理前 | 清理后 |
|------|--------|--------|
| 可用空间 | XXG | XXG |
| 使用率 | XX% | XX% |
释放了约 XXG.git 目录(只报告大小供参考)target/ 或 node_modules/df -h / 报告释放了多少空间chmod -R u+w 尝试,不要用 sudodu 对大目录可能很慢,给所有 Bash 调用设置 timeout: 120000| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-03 | pass→fail | 14,781 | 21,939 | +48% | 1 | 1 | 0% | 2,484 | 4,451 | +79% | 0 | 0 | — |
case-04 | pass→pass | 16,216 | 7,428 | -54% | 1 | 1 | 0% | 2,540 | 3,809 | +50% | 0 | 0 | — |
case-05 | pass→pass | 12,424 | 3,637 | -71% | 1 | 1 | 0% | 2,178 | 3,085 | +42% | 0 | 0 | — |
case-01 | fail→fail | 16,269 | 5,958 | -63% | 1 | 1 | 0% | 2,523 | 3,266 | +29% | 0 | 0 | — |
case-02 | pass→fail | 15,143 | 9,547 | -37% | 1 | 1 | 0% | 2,428 | 3,234 | +33% | 0 | 0 | — |
case-06 | fail→fail | 13,171 | 40,554 | +208% | 1 | 1 | 0% | 1,934 | 9,856 | +410% | 0 | 0 | — |
case-07 | fail→fail | 11,034 | 26,821 | +143% | 1 | 1 | 0% | 1,822 | 3,146 | +73% | 0 | 0 | — |
case-08 | fail→fail | 2,943 | 12,288 | +318% | 1 | 1 | 0% | 394 | 3,723 | +845% | 0 | 0 | — |
case-09 | pass→pass | 9,726 | 10,430 | +7% | 1 | 1 | 0% | 1,495 | 3,333 | +123% | 0 | 0 | — |
case-10 | fail→fail | 12,466 | 14,014 | +12% | 1 | 1 | 0% | 2,168 | 4,027 | +86% | 0 | 0 | — |
case-11 | pass→fail | 11,660 | 9,305 | -20% | 1 | 1 | 0% | 1,712 | 3,224 | +88% | 0 | 0 | — |
case-12 | fail→fail | 7,170 | 11,961 | +67% | 1 | 1 | 0% | 1,066 | 3,381 | +217% | 0 | 0 | — |
case-13 | fail→pass | 12,878 | 4,360 | -66% | 1 | 1 | 0% | 1,878 | 3,280 | +75% | 0 | 0 | — |
case-14 | fail→fail | 3,164 | 45,794 | +1347% | 1 | 1 | 0% | 409 | 3,884 | +850% | 0 | 0 | — |
case-15 | fail→fail | 14,461 | 16,954 | +17% | 1 | 1 | 0% | 2,339 | 3,123 | +34% | 0 | 0 | — |
case-16 | fail→pass | 13,303 | 9,480 | -29% | 1 | 1 | 0% | 1,952 | 4,098 | +110% | 0 | 0 | — |
case-17 | fail→fail | 9,853 | 4,031 | -59% | 1 | 1 | 0% | 1,593 | 3,114 | +95% | 0 | 0 | — |
case-18 | fail→pass | 10,189 | 7,239 | -29% | 1 | 1 | 0% | 1,538 | 3,698 | +140% | 0 | 0 | — |
case-19 | fail→fail | 5,642 | 13,359 | +137% | 1 | 1 | 0% | 902 | 3,721 | +313% | 0 | 0 | — |
case-20 | pass→pass | 10,164 | 9,789 | -4% | 1 | 1 | 0% | 1,721 | 4,301 | +150% | 0 | 0 | — |
case-21 | pass→pass | 9,810 | 7,305 | -26% | 1 | 1 | 0% | 1,695 | 3,681 | +117% | 0 | 0 | — |
case-22 | pass→pass | 11,201 | 8,950 | -20% | 1 | 1 | 0% | 1,856 | 4,035 | +117% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 15 counted toward the lift figure. The other 7 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of 0 percentage points is the difference between those two pass rates over the 15 comparable cases. 3 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.