Claude Local Cleanup
Safely audit, back up, and clean Claude Code / Claude Desktop local state on macOS with a whitelist-driven script.
UtilitiesIntermediate★ 453⑂ 42AI score 9/10Last updated: Oct 19, 2026
What it does
- Runs a read-only audit first via
scripts/claude_cleanup.py --auditso you see exactly what exists. - Before any write, makes and verifies a full copy of
~/.claudeplus a backup of~/.claude.json. - Auto-queues regenerable caches and logs (
~/.claude/cache,~/Library/Caches/claude-cli-nodejs,~/Library/Logs/Claude, crash reports, etc.) without item-by-item prompting. - Everything removed goes to a timestamped trash directory, never a permanent delete.
- Hard-protects
projects,sessions,history.jsonl,skills,plugins,hooks,settings.json, Git repos and project folders. - Optional risky actions, each explicitly chosen: local ID rotation, Keychain credential removal, Claude Desktop login reset or app removal, minimal-prompt mode (
CLAUDE_CODE_SIMPLE=1), Asia/Taipei timezone change. - Inherits existing telemetry env values instead of flipping them.
Who it's for
- macOS users whose long-running Claude Code install has accumulated caches and logs.
- Anyone who wants disk space back without losing session history or settings.
- People reinstalling or re-authenticating Claude Desktop from a clean state.
- Anyone uncomfortable hand-rolling
rm -rfand who wants a recoverable backup.
Examples
- "Just tell me what Claude files are on this machine" → audit-only run, no writes.
- "Clear caches and logs but keep every session transcript" → auto safe-cleanup list only.
- "Log me out of the CLI and remove Claude Desktop entirely" → pick the risk items, then type
CONFIRMonce.
Caveats: macOS only, requires
python3, cannot kill running processes for you, and the write phase should be run from a normal terminal (not from Claude Code itself). Explicitly not for ban or platform-risk evasion.
· · · Install guide · · ·
Try it now, no install
Paste this into Claude to use the skill without installing anything.
Read the instructions in this file and follow them to help me: https://raw.githubusercontent.com/suyuan2022/suyuan-skill/HEAD/claude-cleanup/SKILL.md What I want: (describe your task here)
If Claude can't open the link, open it yourself and paste the contents instead.
↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.
Install in the Claude app (no terminal)
- Download the ZIP with the button below.
- In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
- Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Install in Claude Code
Let Claude do it — paste this into Claude Code
Install the skill I found on AI Skill Mart. Copy the claude-cleanup folder from the GitHub repo suyuan2022/suyuan-skill into my ~/.claude/skills/claude-cleanup/. When it's done, tell me in one line what this skill can do.
Install with a command instead
git clone https://github.com/suyuan2022/suyuan-skill.git /tmp/suyuan-skill && mkdir -p ~/.claude/skills && cp -r /tmp/suyuan-skill/claude-cleanup ~/.claude/skills/⚠ This is a third-party skill. Check the source repository before installing.
- Open Terminal on macOS.
- Clone the repo:
git clone https://github.com/suyuan2022/suyuan-skill.git /tmp/suyuan-skill - Create the skills directory:
mkdir -p ~/.claude/skills - Copy the skill in:
cp -r /tmp/suyuan-skill/claude-cleanup ~/.claude/skills/ - Verify the helper script is present:
ls ~/.claude/skills/claude-cleanup/scripts/ - Do a dry, read-only check first:
python3 ~/.claude/skills/claude-cleanup/scripts/claude_cleanup.py --audit - For the real run, quit Claude Code and Claude Desktop, use a normal terminal, run
python3 ~/.claude/skills/claude-cleanup/scripts/claude_cleanup.py, review the expanded list, and typeCONFIRM.
View source on GitHub ↗License: MIT