Dev clean mac

From Takazudo/claude-resources · View interactive version

Dev clean mac is an AI agent skill from the GitHub repository Takazudo/claude-resources. Reclaim disk space on a Mac dev machine by deleting regenerable dev caches (Cargo/zfb build output, node_modules, pnpm/npm caches, OS/app caches) and thinning APFS local snapshots so the space actually frees. Manual-only — invoke with /dev-clean-mac when a Mac is low on disk.

How to use this skill

Skill file

Dev Clean Mac

Frees disk on a Mac dev machine by deleting caches and build artifacts that

regenerate on demand. Tuned for this layout — $HOME/repos (with myoss/zfb),

a shared Cargo target dir, pnpm/npm caches — but every step is existence-guarded,

so it runs safely on any Mac with a similar structure (e.g. a second machine).

Why a script and not ad-hoc rm: on APFS, deleting files frees nothing while

local Time Machine snapshots still reference the data — df keeps showing the old

number. The script ends by thinning those snapshots (tmutil thinlocalsnapshots),

which is what makes the reclaimed space materialize. Skipping that step is the #1

reason a cleanup "does nothing."

Workflow

The script lives at scripts/clean-mac.sh in this skill directory.

  1. Dry run first — show the user what will be freed, delete nothing:

```bash

bash "$HOME/.claude/skills/dev-clean-mac/scripts/clean-mac.sh" --dry-run

```

Relay the per-path sizes and the measured total to the user.

  1. Confirm node_modules. By default the script deletes all node_modules

under $HOME/repos (reinstallable via pnpm/npm install). If the user is

mid-work on a project, pass --keep-node-modules to preserve them.

  1. Run for real:

```bash

bash "$HOME/.claude/skills/dev-clean-mac/scripts/clean-mac.sh" --run

# or, to keep node_modules:

bash "$HOME/.claude/skills/dev-clean-mac/scripts/clean-mac.sh" --run --keep-node-modules

```

The deletions can take a few minutes (millions of small files); it may

auto-background. Report the BEFORE/AFTER df lines it prints.

What it cleans

$HOME/.cargo-target, dominated by zfb), $HOME/.cargo/registry, and every

per-project target/ under $HOME/repos (detected by cargo's CACHEDIR.TAG).

Homebrew cache, Adobe/CreativeCloud logs, unavailable iOS simulators.

What it never touches

Any matched dir that contains git-tracked files (printed as kept (git-tracked)

— e.g. zfb's checked-in tests/fixtures/**/node_modules), source trees, image/data stashes (e.g. zmod-image-stash), browser profiles,

and app data (Claude/Chrome/Slack containers) — only regenerable caches and

artifacts. Every path is verified to be under $HOME before removal; missing

paths are skipped silently, which is what makes it portable across machines.

Notes

rebuild) — that's the expected trade for the space.

backup — thinning them does not affect Time Machine backups on disk/network.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.