agentleFS
FournineCSFournineCS/claude-skills/skills/mac-cleanup/SKILL.md

mac-cleanup

Skill0 starsChanged 7 months agoMITView on GitHub

Comprehensive MacBook cleanup, disk analysis, and system health audit. Use this skill whenever the user mentions freeing up disk space, cleaning their Mac, finding large files, checking for orphaned or unused apps, clearing caches, auditing launch agents or login items, cleaning Homebrew/npm/pip/Docker/Xcode waste, running a system health check, or investigating why their Mac is slow or running out of storage. Trigger on phrases like 'my Mac is full', 'clean up my laptop', 'what is using all my disk', 'find junk files', 'free up space', 'unused packages', 'Mac maintenance', 'disk audit', 'orphaned apps', 'system cleanup', or 'storage report'. Works on both Intel and Apple Silicon Macs.

  • Deletes or force-pushes

4 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions4 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 4

    1. WiseWong6/wise-skills★ 7same name
    2. Simple-With-Us/BotFleet★ 4same name
    3. nikotsy/niko-claude-skills★ 1same name
    4. janrocnik791/mac-cleanup★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Never touch SIP-protected paths: Do not modify anything under /System, /usr (except /usr/local), /bin, or /sbin.

    line 15
  2. Distinctive:

    Never delete without explicit approval: Before any cleanup action, show the user exactly what will be deleted, how much space it recovers, …

    line 16
  3. Very specific:

    Preserve user data: Never delete documents, photos, or source code in ~/Documents, ~/Desktop, ~/Pictures unless the user identifies …

    line 17
  4. Distinctive:

    If specific tools aren't installed (no Docker, no Homebrew), the script gracefully skips those sections.

    line 43
  5. Distinctive:

    If the user explicitly says they only want a report or health check (not cleanup), present the full report and stop.

    line 128
  6. Distinctive:

    After presenting the report, ask which categories the user wants to clean.

    line 132
  7. Distinctive:

    Report the result: After cleanup, show what was deleted and actual space freed.

    line 146

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Mac Cleanup & Health Analysis

Perform comprehensive MacBook disk analysis and guided cleanup. The workflow has two phases: a read-only analysis phase that produces a structured report, followed by an interactive cleanup phase where every destructive action requires explicit user approval.

Safety Rules

These rules protect the user's system and data:

  1. Analysis is read-only. The analysis phase never modifies, moves, or deletes anything. It only reads sizes, lists files, and checks configurations.
  2. Never touch SIP-protected paths. Do not modify anything under /System, /usr (except /usr/local), /bin, or /sbin.
  3. Never delete without explicit approval. Before any cleanup action, show the user exactly what will be deleted, how much space it recovers, and wait for confirmation. Treat silence or ambiguity as "no."
  4. Preserve user data. Never delete documents, photos, or source code in ~/Documents, ~/Desktop, ~/Pictures unless the user identifies specific items.
  5. Dry-run first. For package manager cleanup (brew, npm, pip), always show dry-run output before executing the real command.

Phase 1: Analysis

Step 1: Run the Analyzer Script

Execute the bundled analyzer script to collect system data in a single pass:

bash <skill-path>/scripts/mac_analyzer.sh

This script runs ~30 read-only commands and outputs structured data with section markers. It collects:

  • System info (macOS version, chip, model, disk usage)
  • Directory sizes for known space consumers
  • Package manager inventories (Homebrew, npm, pip, gem)
  • Docker artifact sizes
  • Xcode artifacts (DerivedData, Archives, Simulators)
  • Cache, log, and crash report sizes
  • Time Machine local snapshot info
  • Launch agents and daemons inventory
  • Large files (>500MB)
  • Old downloads (>90 days)
  • Orphaned app support directories

If specific tools aren't installed (no Docker, no Homebrew), the script gracefully skips those sections.

Step 2: Detect Orphaned App Data

The analyzer script compares bundle identifiers found in these Library locations against apps in /Applications and ~/Applications:

  • ~/Library/Application Support/
  • ~/Library/Preferences/
  • ~/Library/Containers/
  • ~/Library/Group Containers/
  • ~/Library/Caches/
  • ~/Library/Saved Application State/

An entry is "orphaned" if it references a bundle ID (e.g., com.example.app) for which no matching .app bundle exists. This is heuristic — some directories belong to system services, so use judgment when presenting results.

Step 3: Build the Report

Present findings using this report template:

# Mac Cleanup Report - [YYYY-MM-DD]

## System Overview
| Property        | Value                              |
|----------------|------------------------------------|
| macOS Version  | [version + build]                  |
| Mac Model      | [model identifier]                 |
| Chip           | [Apple M-series or Intel]          |
| Total Disk     | [size]                             |
| Used           | [size] ([percentage]%)             |
| Available      | [size] ([percentage]%)             |

## Critical - Immediate Attention Needed

Items where recoverable space exceeds 5 GB or disk usage is above 90%.

### [Category Name]
- **Location:** [path]
- **Current Size:** [size]
- **What it contains:** [brief description]
- **Recommendation:** [what to do]
- **Recoverable:** ~[estimated size]

## Warning - Worth Cleaning

Items where recoverable space is between 500 MB and 5 GB.

### [Category Name]
- **Location:** [path]
- **Current Size:** [size]
- **What it contains:** [brief description]
- **Recommendation:** [what to do]
- **Recoverable:** ~[estimated size]

## Info - Maintenance Suggestions

Items under 500 MB or informational findings (login items, launch agents, etc.).

### [Category Name]
- **Finding:** [description]
- **Recommendation:** [what to do]

## Summary

| Category                    | Recoverable Space |
|----------------------------|-------------------|
| [category 1]               | ~[size]           |
| [category 2]               | ~[size]           |
| **Total Estimated**        | **~[total size]** |

### Top 5 Quick Wins
1. [action] - saves ~[size]
2. [action] - saves ~[size]
3. [action] - saves ~[size]
4. [action] - saves ~[size]
5. [action] - saves ~[size]

Severity classification:

  • Critical: >5 GB recoverable, or disk usage >90%, or system stability risk
  • Warning: 500 MB - 5 GB recoverable
  • Info: <500 MB, or informational findings (audit items, suggestions)

Analysis-Only Mode

If the user explicitly says they only want a report or health check (not cleanup), present the full report and stop. Do not offer cleanup unless the user later asks.

Phase 2: Cleanup

After presenting the report, ask which categories the user wants to clean. Present categories as a numbered list. The user might say "clean everything", "just 1 and 3", or ask about a specific category.

Cleanup Protocol

For each category the user approves:

  1. Show exactly what will happen. List specific files/directories to be deleted, or show the exact command (including dry-run output for package managers).
  2. Show estimated space recovery.
  3. Ask for confirmation:
    This will delete [N items / specific paths] and free approximately [size].
    Proceed? (yes/no)
  4. Execute only after explicit "yes."
  5. Report the result. After cleanup, show what was deleted and actual space freed.

Cleanup Categories

CategoryApproach
Homebrewbrew cleanup, brew autoremove (show dry-run first)
npm cachenpm cache clean --force
pip cachepip cache purge
gem cachegem cleanup
Dockerdocker system prune, docker image prune
Xcode DerivedDatarm -rf ~/Library/Developer/Xcode/DerivedData/*
Xcode ArchivesRemove selected archives
iOS Simulatorsxcrun simctl delete unavailable
System CachesRemove specific app caches from ~/Library/Caches
System LogsRemove old logs from ~/Library/Logs
Crash ReportsClear ~/Library/Logs/DiagnosticReports
Trashrm -rf ~/.Trash/*
Old DownloadsMove or delete files older than 90 days
Large FilesUser selects individual files to remove
Orphaned App DataRemove specific orphaned directories
Time Machine Snapshotstmutil deletelocalsnapshots [date]
Launch AgentsDisable or remove specific agents
node_modulesRemove orphaned node_modules directories

For detailed commands for each category, read references/cleanup-commands.md.

What NOT to Clean

Even if asked, warn and discourage cleaning:

  • /System/ or any SIP-protected path
  • ~/Library/Keychains/ — credential data
  • ~/Library/Mail/ — suggest reviewing in Mail.app instead
  • Active Docker containers or images currently in use
  • Homebrew packages that are dependencies of other installed packages
  • Any file the user has not explicitly approved for deletion

Architecture Notes

The skill works on both Intel and Apple Silicon Macs. The analyzer script detects architecture via uname -m and adjusts Homebrew paths accordingly (/opt/homebrew on Apple Silicon, /usr/local on Intel).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.