TsinHzl/disk-cleanup-skill

macOS Claude Code skill — scan 20+ dev caches, classify into 🔴safe/🟡confirm/🔵display-only tiers, execute only what you approve. Covers CocoaPods · npm · Gradle · Cargo · Xcode · Flutter · Playwright and more. | 面向 macOS 开发机的磁盘清理技能:扫描分级,强制确认后执行,零静默删除。

★ 1Forks 0ShellGitHub ↗Compare
claude-codeclaude-skilldeveloper-toolsdisk-cleanupmacos

README

disk-cleanup

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+ 缓存与构建产物路径,按安全等级分级展示,经你确认后再执行清理。


Coverage · 覆盖范围

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

How it works · 工作流程

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

Safety · 安全设计

  • Hard-gate — no deletion runs until you confirm via interactive prompt 强制确认门:所有删除命令在用户交互确认前一律禁止执行
  • Dry-run — echo expands every rm -rf path before execution to catch glob mistakes 执行前用 echo 预演路径展开,防止通配符误扩展
  • Before/after diff — compares df -h to report actual bytes freed 清理前后对比 df -h,输出实际释放字节数
  • Anti-rationalization — model cannot skip confirmation steps by reasoning "it's obviously safe" 内置约束:模型无法以"显然安全"为由绕过确认步骤

Installation · 安装

# Copy to your Claude Code skills directory
cp -r . ~/.claude/skills/disk-cleanup

Then invoke with /disk-cleanup in Claude Code.


Requirements · 环境要求

  • macOS
  • Xcode CLI Tools (for simulator cleanup · 模拟器清理所需)

Contributors

TsinHzl

Issues