npx skills add https://github.com/terrylica/cc-skills --skill disk-hygiene在 macOS 上审计磁盘使用情况、清理开发者缓存、查找被遗忘的大文件,并对 Downloads 文件夹进行分类整理。
在以下情况使用此技能:
1. 运行磁盘概览(df -h / 和主要目录)
2. 审计开发者缓存(uv、brew、pip、npm、cargo、rustup、Docker)
3. 扫描被遗忘的大文件(>50MB,超过 180 天未访问)
4. 使用 AskUserQuestion 展示发现结果并提供清理选项
5. 执行选定的清理操作
6. 报告回收的空间
1. 测量当前缓存大小
2. 运行安全的缓存清理(brew、uv、pip、npm)
3. 报告回收的空间
1. 列出 Downloads 内容及其日期和大小
2. 按类别分组(媒体、开发产物、个人文档、杂项)
3. 使用 AskUserQuestion 多选功能提供删除/移动选项
4. 执行选定的操作
1. 扫描主目录中超过 180 天未访问的大文件
2. 按位置和类型分组(媒体、ISO 镜像、开发产物、文档)
3. 按大小排序展示发现结果
4. 通过 AskUserQuestion 提供清理选项
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
在深入细节之前,先了解整体情况。
/usr/bin/env bash << 'OVERVIEW_EOF'
echo "=== 磁盘概览 ==="
df -h /
echo ""
echo "=== 主要目录 ==="
du -sh ~/Library/Caches ~/Library/Logs ~/Library/Application\ Support \
~/.Trash ~/Downloads ~/Documents ~/Desktop ~/Movies ~/Music ~/Pictures \
2>/dev/null | sort -rh
echo ""
echo "=== 开发者工具缓存 ==="
du -sh ~/.docker ~/.npm ~/.cargo ~/.rustup ~/.local ~/.cache \
~/.conda ~/.pyenv ~/.local/share/mise 2>/dev/null | sort -rh
OVERVIEW_EOF
| 缓存 | 位置 | 典型大小 | 清理命令 |
|---|---|---|---|
| uv | ~/Library/Caches/uv/ | 5-15 GB | uv cache clean |
| Homebrew | ~/Library/Caches/Homebrew/ | 3-10 GB | brew cleanup --prune=all |
| pip | ~/Library/Caches/pip/ | 0.5-2 GB | pip cache purge |
| npm | ~/.npm/_cacache/ | 0.5-2 GB | npm cache clean --force |
| cargo | ~/.cargo/registry/cache/ | 1-5 GB | cargo cache -a (需要 cargo-cache) |
| rustup | ~/.rustup/toolchains/ | 2-8 GB | rustup toolchain remove <old> |
| Docker | Docker.app | 5-30 GB | docker system prune -a |
| Playwright | ~/Library/Caches/ms-playwright/ | 0.5-2 GB | npx playwright uninstall |
| sccache | ~/Library/Caches/Mozilla.sccache/ | 1-3 GB | rm -rf ~/Library/Caches/Mozilla.sccache |
| huggingface | ~/.cache/huggingface/ | 1-10 GB | rm -rf ~/.cache/huggingface/hub/<model> |
/usr/bin/env bash << 'CACHE_CLEAN_EOF'
set -euo pipefail
echo "=== 测量当前缓存大小 ==="
echo "uv: $(du -sh ~/Library/Caches/uv/ 2>/dev/null | cut -f1 || echo 'N/A')"
echo "Homebrew: $(du -sh ~/Library/Caches/Homebrew/ 2>/dev/null | cut -f1 || echo 'N/A')"
echo "pip: $(du -sh ~/Library/Caches/pip/ 2>/dev/null | cut -f1 || echo 'N/A')"
echo "npm: $(du -sh ~/.npm/_cacache/ 2>/dev/null | cut -f1 || echo 'N/A')"
echo ""
echo "=== 清理 ==="
brew cleanup --prune=all 2>&1 | tail -3
uv cache clean --force 2>&1
pip cache purge 2>&1
npm cache clean --force 2>&1
CACHE_CLEAN_EOF
| 问题 | 原因 | 解决方案 |
|---|---|---|
uv cache 锁被占用 | 另一个 uv 进程正在运行 | 使用 uv cache clean --force |
brew cleanup 跳过某些 formulae | 已链接但不是最新版本 | 可以忽略,或使用 brew reinstall <pkg> |
pip cache purge 权限被拒绝 | 系统 pip 与用户 pip 冲突 | 使用 python -m pip cache purge |
| Docker 未运行 | Docker Desktop 未启动 | 先启动 Docker.app,或跳过 |
查找超过 180 天未访问的大文件。
/usr/bin/env bash << 'STALE_EOF'
echo "=== 被遗忘的大文件(>50MB,超过 180 天未访问) ==="
echo ""
# 扫描主目录(排除 Library、node_modules、.git、隐藏目录)
find "$HOME" -maxdepth 4 \
-not -path '*/\.*' \
-not -path '*/Library/*' \
-not -path '*/node_modules/*' \
-not -path '*/.git/*' \
-type f -atime +180 -size +50M 2>/dev/null | \
while read -r f; do
mod_date=$(stat -f '%Sm' -t '%Y-%m-%d' "$f" 2>/dev/null)
size=$(du -sh "$f" 2>/dev/null | cut -f1)
echo "${mod_date} ${size} ${f}"
done | sort
echo ""
echo "=== 文档与桌面(>10MB,超过 180 天未访问) ==="
find "$HOME/Documents" "$HOME/Desktop" \
-type f -atime +180 -size +10M 2>/dev/null | \
while read -r f; do
mod_date=$(stat -f '%Sm' -t '%Y-%m-%d' "$f" 2>/dev/null)
size=$(du -sh "$f" 2>/dev/null | cut -f1)
echo "${mod_date} ${size} ${f}"
done | sort
STALE_EOF
| 类型 | 典型位置 | 示例 |
|---|---|---|
| Windows/Linux ISO 镜像 | Documents, Downloads | 虚拟机设置留下的 .iso 文件 |
| CapCut/iMovie 导出文件 | Movies/ | 大型 .mp4 渲染文件 |
| 手机视频传输文件 | Pictures/, DCIM/ | 来自 iPhone 的 .MOV 文件 |
| 旧的 Zoom 录制文件 | Documents/ | 会议留下的 .aac、.mp4 文件 |
| 孤立的下载文件 | Documents/ | CFNetworkDownload_*.mp4 |
| 屏幕录制文件 | Documents/, Desktop/ | Capto/QuickTime .mov 文件 |
使用 AskUserQuestion 的多选功能,让用户选择要清理的内容。
~/Downloads 中的所有文件及其日期和大小/usr/bin/env bash << 'DL_LIST_EOF'
echo "=== 按日期和大小排列的 Downloads 内容 ==="
find "$HOME/Downloads" -maxdepth 1 \( -type f -o -type d \) ! -path "$HOME/Downloads" | \
while read -r f; do
mod_date=$(stat -f '%Sm' -t '%Y-%m-%d' "$f" 2>/dev/null)
size=$(du -sh "$f" 2>/dev/null | cut -f1)
echo "${mod_date} ${size} $(basename "$f")"
done | sort
DL_LIST_EOF
展示 Downloads 清理选项时,使用此模式:
| 工具 | 实际耗时 | CPU 使用率 | 交互式删除 | 安装方式 |
|---|---|---|---|---|
| dust | 20.4s | 637% (并行) | 否(仅查看) | brew install dust |
| gdu-go | 28.8s | 845% (高度并行) | 是 (TUI) | brew install gdu |
| dua-cli | 37.1s | 237% (中等) | 是(分阶段安全删除) | brew install dua-cli |
| ncdu | 96.6s | 43% (单线程) | 是 (TUI) | brew install ncdu |
dust 用于快速了解"我的空间去哪了?" - 最快的扫描器,树状输出dua i 或 gdu-go 用于支持删除的交互式探索# dust - 即时树状概览
dust -d 2 ~ # 深度 2
dust -r ~/Library # 反向排序(最小的在前)
# dua - 支持安全删除的交互式 TUI
dua i ~ # 导航、标记、确认后删除
# gdu-go - 类似 ncdu 的 TUI,在 SSD 上速度快
gdu-go ~ # 支持删除的完整 TUI
gdu-go -n ~ # 非交互式(用于脚本/基准测试)
brew install dust dua-cli gdu
注意:gdu 安装为 gdu-go 以避免与 coreutils 冲突。
按典型可回收空间排序(从高到低):
| 操作 | 典型节省空间 | 风险 | 命令 |
|---|---|---|---|
uv cache clean | 5-15 GB | 无(可重新下载) | uv cache clean --force |
brew cleanup --prune=all | 3-10 GB | 无(可重新下载) | brew cleanup --prune=all |
| 删除 Downloads 中的电影文件 | 2-10 GB | 先检查 | 在 AskUserQuestion 后手动操作 |
npm cache clean --force | 0.5-2 GB | 无(可重新下载) | npm cache clean --force |
pip cache purge | 0.5-2 GB | 无(可重新下载) | pip cache purge |
| 清理旧的 rustup 工具链 | 2-5 GB | 保留当前版本 | rustup toolchain list 然后移除 |
| Docker 系统清理 | 5-30 GB | 移除已停止的容器 | docker system prune -a |
| 清空废纸篓 | 不定 | 不可逆 | rm -rf ~/.Trash/* |
修改此技能后:
/usr/bin/env bash << 'EOF' 包装器$HOME)| 问题 | 原因 | 解决方案 |
|---|---|---|
uv cache clean 卡住 | 锁被正在运行的 uv 进程占用 | 使用 --force 标志 |
brew cleanup 释放 0 字节 | 已经清理过或 formulae 已链接 | 运行 brew cleanup --prune=all |
find 报告权限被拒绝 | 系统完整性保护 | 添加 2>/dev/null 来抑制 |
gdu 命令未找到 | 安装为 gdu-go | 使用 gdu-go(与 coreutils 冲突) |
dust 显示的大小与 df 不同 | 计数方法不同 | 正常 - df 包含文件系统开销 |
| 陈旧文件扫描很慢 | 深层目录树 | 限制 -maxdepth 或排除更多路径 |
| Docker 无法访问 | 桌面应用未运行 | 启动 Docker.app 或跳过 Docker 清理 |
每周安装次数
94
仓库
GitHub 星标数
26
首次出现
2026年2月9日
安全审计
安装于
opencode93
gemini-cli90
cursor89
codex88
kimi-cli87
amp87
Audit disk usage, clean developer caches, find forgotten large files, and triage Downloads on macOS.
Use this skill when:
1. Run disk overview (df -h / and major directories)
2. Audit developer caches (uv, brew, pip, npm, cargo, rustup, Docker)
3. Scan for forgotten large files (>50MB, not accessed in 180+ days)
4. Present findings with AskUserQuestion for cleanup choices
5. Execute selected cleanups
6. Report space reclaimed
1. Measure current cache sizes
2. Run safe cache cleanups (brew, uv, pip, npm)
3. Report space reclaimed
1. List Downloads contents with dates and sizes
2. Categorize into groups (media, dev artifacts, personal docs, misc)
3. Present AskUserQuestion multi-select for deletion/move
4. Execute selected actions
1. Scan home directory for large files not accessed in 180+ days
2. Group by location and type (media, ISOs, dev artifacts, documents)
3. Present findings sorted by size
4. Offer cleanup options via AskUserQuestion
Get the lay of the land before diving into specifics.
/usr/bin/env bash << 'OVERVIEW_EOF'
echo "=== Disk Overview ==="
df -h /
echo ""
echo "=== Major Directories ==="
du -sh ~/Library/Caches ~/Library/Logs ~/Library/Application\ Support \
~/.Trash ~/Downloads ~/Documents ~/Desktop ~/Movies ~/Music ~/Pictures \
2>/dev/null | sort -rh
echo ""
echo "=== Developer Tool Caches ==="
du -sh ~/.docker ~/.npm ~/.cargo ~/.rustup ~/.local ~/.cache \
~/.conda ~/.pyenv ~/.local/share/mise 2>/dev/null | sort -rh
OVERVIEW_EOF
| Cache | Location | Typical Size | Clean Command |
|---|---|---|---|
| uv | ~/Library/Caches/uv/ | 5-15 GB | uv cache clean |
| Homebrew | ~/Library/Caches/Homebrew/ | 3-10 GB | brew cleanup --prune=all |
| pip | ~/Library/Caches/pip/ | 0.5-2 GB | pip cache purge |
/usr/bin/env bash << 'CACHE_CLEAN_EOF'
set -euo pipefail
echo "=== Measuring current cache sizes ==="
echo "uv: $(du -sh ~/Library/Caches/uv/ 2>/dev/null | cut -f1 || echo 'N/A')"
echo "Homebrew: $(du -sh ~/Library/Caches/Homebrew/ 2>/dev/null | cut -f1 || echo 'N/A')"
echo "pip: $(du -sh ~/Library/Caches/pip/ 2>/dev/null | cut -f1 || echo 'N/A')"
echo "npm: $(du -sh ~/.npm/_cacache/ 2>/dev/null | cut -f1 || echo 'N/A')"
echo ""
echo "=== Cleaning ==="
brew cleanup --prune=all 2>&1 | tail -3
uv cache clean --force 2>&1
pip cache purge 2>&1
npm cache clean --force 2>&1
CACHE_CLEAN_EOF
| Issue | Cause | Solution |
|---|---|---|
uv cache lock held | Another uv process running | Use uv cache clean --force |
brew cleanup skips formulae | Linked but not latest | Safe to ignore, or brew reinstall <pkg> |
pip cache purge permission denied | System pip vs user pip | Use python -m pip cache purge |
| Docker not running |
Find large files that have not been accessed in 180+ days.
/usr/bin/env bash << 'STALE_EOF'
echo "=== Large forgotten files (>50MB, untouched 180+ days) ==="
echo ""
# Scan home directory (excluding Library, node_modules, .git, hidden dirs)
find "$HOME" -maxdepth 4 \
-not -path '*/\.*' \
-not -path '*/Library/*' \
-not -path '*/node_modules/*' \
-not -path '*/.git/*' \
-type f -atime +180 -size +50M 2>/dev/null | \
while read -r f; do
mod_date=$(stat -f '%Sm' -t '%Y-%m-%d' "$f" 2>/dev/null)
size=$(du -sh "$f" 2>/dev/null | cut -f1)
echo "${mod_date} ${size} ${f}"
done | sort
echo ""
echo "=== Documents & Desktop (>10MB, untouched 180+ days) ==="
find "$HOME/Documents" "$HOME/Desktop" \
-type f -atime +180 -size +10M 2>/dev/null | \
while read -r f; do
mod_date=$(stat -f '%Sm' -t '%Y-%m-%d' "$f" 2>/dev/null)
size=$(du -sh "$f" 2>/dev/null | cut -f1)
echo "${mod_date} ${size} ${f}"
done | sort
STALE_EOF
| Type | Typical Location | Example |
|---|---|---|
| Windows/Linux ISOs | Documents, Downloads | .iso files from VM setup |
| CapCut/iMovie exports | Movies/ | Large .mp4 renders |
| Phone video transfers | Pictures/, DCIM/ | .MOV files from iPhone |
| Old Zoom recordings | Documents/ | .aac, .mp4 from meetings |
| Orphaned downloads | Documents/ |
Use AskUserQuestion with multi-select to let the user choose what to clean.
~/Downloads with dates and sizes/usr/bin/env bash << 'DL_LIST_EOF'
echo "=== Downloads by date and size ==="
find "$HOME/Downloads" -maxdepth 1 \( -type f -o -type d \) ! -path "$HOME/Downloads" | \
while read -r f; do
mod_date=$(stat -f '%Sm' -t '%Y-%m-%d' "$f" 2>/dev/null)
size=$(du -sh "$f" 2>/dev/null | cut -f1)
echo "${mod_date} ${size} $(basename "$f")"
done | sort
DL_LIST_EOF
When presenting Downloads cleanup options, use this pattern:
| Tool | Wall Time | CPU Usage | Interactive Delete | Install |
|---|---|---|---|---|
| dust | 20.4s | 637% (parallel) | No (view only) | brew install dust |
| gdu-go | 28.8s | 845% (very parallel) | Yes (TUI) | brew install gdu |
| dua-cli | 37.1s | 237% (moderate) | Yes (staged safe delete) | brew install dua-cli |
dust for quick "where is my space going?" - fastest scanner, tree outputdua i or gdu-go for interactive exploration with deletion# dust - instant tree overview
dust -d 2 ~ # depth 2
dust -r ~/Library # reverse sort (smallest first)
# dua - interactive TUI with safe deletion
dua i ~ # navigate, mark, delete with confirmation
# gdu-go - ncdu-like TUI, fast on SSDs
gdu-go ~ # full TUI with delete support
gdu-go -n ~ # non-interactive (for scripting/benchmarks)
brew install dust dua-cli gdu
Note : gdu installs as gdu-go to avoid conflict with coreutils.
Ordered by typical space reclaimed (highest first):
| Action | Typical Savings | Risk | Command |
|---|---|---|---|
uv cache clean | 5-15 GB | None (re-downloads) | uv cache clean --force |
brew cleanup --prune=all | 3-10 GB | None (re-downloads) | brew cleanup --prune=all |
| Delete movie files in Downloads | 2-10 GB | Check first | Manual after AskUserQuestion |
npm cache clean --force |
After modifying this skill:
/usr/bin/env bash << 'EOF' wrapper$HOME)| Issue | Cause | Solution |
|---|---|---|
uv cache clean hangs | Lock held by running uv | Use --force flag |
brew cleanup frees 0 bytes | Already clean or formulae linked | Run brew cleanup --prune=all |
find reports permission denied | System Integrity Protection | Add 2>/dev/null to suppress |
gdu command not found |
Weekly Installs
94
Repository
GitHub Stars
26
First Seen
Feb 9, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
opencode93
gemini-cli90
cursor89
codex88
kimi-cli87
amp87
通过 LiteLLM 代理让 Claude Code 对接 GitHub Copilot 运行 | 高级变通方案指南
43,100 周安装
| npm | ~/.npm/_cacache/ | 0.5-2 GB | npm cache clean --force |
| cargo | ~/.cargo/registry/cache/ | 1-5 GB | cargo cache -a (needs cargo-cache) |
| rustup | ~/.rustup/toolchains/ | 2-8 GB | rustup toolchain remove <old> |
| Docker | Docker.app | 5-30 GB | docker system prune -a |
| Playwright | ~/Library/Caches/ms-playwright/ | 0.5-2 GB | npx playwright uninstall |
| sccache | ~/Library/Caches/Mozilla.sccache/ | 1-3 GB | rm -rf ~/Library/Caches/Mozilla.sccache |
| huggingface | ~/.cache/huggingface/ | 1-10 GB | rm -rf ~/.cache/huggingface/hub/<model> |
| Docker Desktop not started |
| Start Docker.app first, or skip |
CFNetworkDownload_*.mp4 |
| Screen recordings | Documents/, Desktop/ | Capto/QuickTime .mov |
| ncdu |
| 96.6s |
| 43% (single-thread) |
| Yes (TUI) |
brew install ncdu |
| 0.5-2 GB |
| None (re-downloads) |
npm cache clean --force |
pip cache purge | 0.5-2 GB | None (re-downloads) | pip cache purge |
| Prune old rustup toolchains | 2-5 GB | Keep current | rustup toolchain list then remove |
| Docker system prune | 5-30 GB | Removes stopped containers | docker system prune -a |
| Empty Trash | Variable | Irreversible | rm -rf ~/.Trash/* |
Installed as gdu-go |
Use gdu-go (coreutils conflict) |
dust shows different size than df | Counting method differs | Normal - df includes filesystem overhead |
| Stale file scan is slow | Deep directory tree | Limit -maxdepth or exclude more paths |
| Docker not accessible | Desktop app not running | Start Docker.app or skip Docker cleanup |