A Claude Code skill for reclaiming disk space on macOS developer machines. 面向 macOS 开发机的 Claude Code 磁盘清理技能。
Invoke /disk-cleanup when your disk feels full — it scans 20+ known cache and build-artifact locations, classifies them into three safety tiers, and executes only what you explicitly approve.
运行 /disk-cleanup,自动扫描 20+ 缓存与构建产物路径,按安全等级分级展示,经你确认后再执行清理。
| Tier · 等级 | Targets · 目标 |
|---|---|
| 🔴 Safe · 安全缓存 | CocoaPods / npm / pip / Homebrew / Go / Chrome cache / Flutter pub-cache / Xcode ModuleCache / Gradle / Cargo / Maven / node-gyp / Swift PM / JetBrains / Bun / Playwright browsers |
| 🟡 Confirm · 需确认 | Xcode DerivedData / iOS Simulators / Android AVDs / Xcode DeviceSupport & Archives |
| 🔵 Display-only · 仅展示 | Chrome Profile / Downloads / iOS Backups / Time Machine snapshots |
Step 1 Scan — run scan.sh (read-only, no side effects)
Step 2 Report — render 🔴/🟡/🔵 tiered table with sizes
Step 3 Confirm — hard-gate: AskUserQuestion before any deletion
Step 4 Execute — run approved commands, compare df -h before/after
- Hard-gate — no deletion runs until you confirm via interactive prompt 强制确认门:所有删除命令在用户交互确认前一律禁止执行
- Dry-run —
echoexpands everyrm -rfpath before execution to catch glob mistakes 执行前用echo预演路径展开,防止通配符误扩展 - Before/after diff — compares
df -hto report actual bytes freed 清理前后对比df -h,输出实际释放字节数 - Anti-rationalization — model cannot skip confirmation steps by reasoning "it's obviously safe" 内置约束:模型无法以"显然安全"为由绕过确认步骤
# Copy to your Claude Code skills directory
cp -r . ~/.claude/skills/disk-cleanupThen invoke with /disk-cleanup in Claude Code.
- macOS
- Xcode CLI Tools (for simulator cleanup · 模拟器清理所需)