macOS Disk Cleanup — Development skill for Claude Code
給 Claude Code、Codex 等 agent 用的 macOS 磁碟清理 skill:診斷「系統資料」佔用、唯讀掃描腳本、以及 10 個會造成誤判或資料損失的陷阱.
How to install macOS Disk Cleanup
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open himynameisben/macos-disk-cleanup and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What macOS Disk Cleanup does
給 Claude Code、Codex 等 agent 用的 macOS 磁碟清理 skill:診斷「系統資料」佔用、唯讀掃描腳本、以及 10 個會造成誤判或資料損失的陷阱.
Alternatives in Development
- System Cache Cleanup — Clean temporary files and caches to free disk space: $ARGUMENTS 23.4k ★
- Codenotch — A macOS app that pins usage limits from Claude Code, Cursor, Codex, and Antigravity to a screen edge 1.3k ★
- Chops — 1,000+ macOS app to browse, edit, and manage skills across Claude Code, Cursor, Codex, Windsurf, and Amp 1.1k ★
README
macOS 磁碟清理 Skill
給 AI coding agent 用的 skill,專門處理 macOS 上那塊 Finder 不肯告訴你內容的「系統資料 / System Data」。
適合任何 Mac 使用者,開發者受益最明顯——實測從 **25 GB 清回 132 GB**,其中 45 GB 來自 `~/.cache/uv`、`~/.npm`、`~/.gradle` 這些完全不在 `~/Library` 底下、一般清理工具掃不到的位置。
[!WARNING] **這個 skill 會刪除檔案,而執行判斷的是 AI。**
AI 有可能誤判、有可能把重要資料當成快取。Skill 內建三級安全分類與確認機制來降低風險,但**最後把關的人是你**:
- 動手前先確認有備份(Time Machine 或任何你信得過的方案)
- 逐項讀過 AI 提出的刪除清單再確認,不要無腦按 yes
- 對任何你不認得的路徑,直接叫它先列出內容再說
- 尤其注意
Documents、Group Containers這類位置——那裡放的通常是你唯一的副本作者與貢獻者不對任何資料損失負責。使用前請自行評估。
為什麼該留空間,留多少
**「還有 20 GB 可用」在 macOS 上不等於沒事。** 系統本身就需要相當大的活動空間:
| 用途 | 需求 |
|---|---|
| System volume | 約 15 GB |
| macOS 更新期間的 Update volume | 再 15 GB 以上 |
| Preboot + Recovery | 5 GB 以內 |
| Swap(記憶體吃緊時) | 可膨脹到 20 GB 以上 |
| APFS snapshot | 最大的意外來源——時機不巧的話,光裝一次 Xcode 就可能產生 64 GB 以上的 snapshot |
實務上的建議是**開機碟至少留 100 GB,200 GB 更舒服**([來源](https://eclecticlight.co/2022/05/18/how-much-free-space-does-an-apfs-disk-need/))。
至於流傳已久的「SSD 要留 10–20%」法則,說法從 5% 到 30% 都有,而且對現代 SSD 有爭議——現在的 SSD 內建 7–13% 的 over-provisioning,加上 APFS 的配置演算法,舊規則已不完全適用。但**空間充裕確實有助於 wear leveling 與 SSD 壽命**,這點沒有爭議。
空間不足時的實際症狀:swap 寫不下去導致系統卡死、macOS 更新裝不起來、Time Machine 備份失敗。
功能
- 唯讀掃描:一次列出
~/Library各層、Xcode/Simulator、套件管理器快取的實際用量排名 - 掃到別人漏掉的地方:
~/.cache/uv、~/.npm、~/.gradle、~/Library/pnpm/store、~/go/pkg/mod等家目錄底下的快取 - 稀疏檔偵測:VM 磁碟的「宣告大小 vs 實際佔用」(
Docker.raw顯示 60 G,實際可能只有 5 G) - 孤兒 container 偵測:找出 app 已經移除、但資料還佔著幾 GB 的殘留
- 三級安全分類:每個發現都標註是「自動重建的快取」還是「使用者唯一的副本」
- 完整移除清單:解除安裝 app 後該掃的 11 個位置
安裝
這是標準的 [Agent Skill](https://learn.chatgpt.com/docs/build-skills)(`SKILL.md` + YAML frontmatter),Claude Code、Codex、Cursor、Gemini CLI、GitHub Copilot 等工具都吃同一套格式,只是載入路徑不同。
**Claude Code**
git clone https://github.com/himynameisben/macos-disk-cleanup.git \
~/.claude/skills/macos-disk-cleanup
**Codex**
git clone https://github.com/himynameisben/macos-disk-cleanup.git \
~/.agents/skills/macos-disk-cleanup
Related Skills
Claude Pc Cleanup
Claude Code skill: scan a macOS machine for reclaimable disk space and clean it up safely, tier by tier, with
Spaceguard
macOS menu-bar app that watches free disk space and cleans stale dev caches, simulator runtimes and coding-age
Disk Cleanup.Es
Limpieza de disco — Prompt para agentes (Español)
Disk Cleanup.Pt BR
Limpeza de disco — Prompt para agentes (Português do Brasil)
Windows Disk Cleanup
An Agent Skill for Windows 10/11 disk space survey, safe cross-drive migration and cleanup. Read-only first, p
Disk Cleanup
Diagnose disk usage and reclaim space autonomously — finds the biggest offenders by reclaim value and clears t
Related Agents
Slim Wrapper
tfx-route.sh 경유 전용 래퍼 에이전트. 코드를 직접 읽거나 수정하지 않고 Bash(tfx-route.sh)를 통해 Codex/Antigravity에 위임하는 thin wrapper. OS
Import Validator
Validates that every import statement in the src/ JS files resolves to a file that actually exists on disk. Us
Crucible Qg Judge
Stagnation judge for Crucible quality-gate — mechanical cross-round comparison of finding sets. Pinned to Sonn