storage-analyzer
Read-only Storage Analysis Assistant for macOS / Windows (auto-detects system). Scans the entire disk usage to identify space hogs, categorizes each item into three levels: 🟢 Auto-cleanable / 🟡 Manual judgment required / 🔴 Clean with caution, and provides actionable disposal plans. Generates an interactive HTML report with beautiful formatting, collapsible sections, and one-click copy commands. Also supports starting a local service to delete files directly via the web (move to trash / delete immediately). The entire scanning process is read-only. Must be used in the following scenarios: When users mention "storage analysis", "disk full", "C drive/hard disk full", "insufficient space", "clean up space", "disk cleanup", "space occupied", "what's taking up space", "help me check storage", "check computer storage/space", "storage space", "computer space insufficient", "memory full/insufficient" (in Chinese colloquial, "memory" often refers to storage), "storage analysis", "disk cleanup", "clear cache", "disk cleanup"; or when users complain about insufficient computer space, want to know what's taking up hard disk space, or need cleanup suggestions. Note: If users explicitly refer to RAM (e.g., "which process is using memory", "high memory usage", want to see Activity Monitor), that's RAM, not storage, and does not belong to this skill.
NPX Install
npx skill4agent add kkkkhazix/khazix-skills storage-analyzerTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →Storage Analyzer
Iron Rules
- Read-only throughout. Only run scanning/statistics/directory listing/metadata reading (df, du, diskutil, stat, ls). Strictly prohibit any write operations such as rm, mv, rmdir, emptying the recycle bin, changing permissions, etc.
- Only display deletion commands, do not execute them. The cleanup commands provided in the report are for users to run in the terminal after confirmation. Even if the user says "help me delete" in the conversation, stop to confirm first (hit global red line: must ask before deleting files), do not run the command directly.
- Clearly mark estimates. Always indicate that "releasable space" is an estimated value.
- Keep paths and commands in original language without translation.
Execution Process
Step 1 Scan (Read-only)
python3 scripts/scan.py > /tmp/storage_scan.jsonscan.pysys.platform- macOS: Scans home, library, caches, containers, group_containers, app_support, applications, downloads, dev_caches, calculates sizes using .
du - Windows: Scans user_profile, appdata_local, appdata_roaming, temp, downloads, program_files(_x86), dev_caches, calculates sizes using ;
os.scandirincludes all drive letters.system.disks
systemdisk_namedisksgroupsdeniedStep 2 Analysis and Categorization
system.os/tmp/storage_scan.json- Select Top 5 space hogs, determine their types (system assets, application installations, application data, application caches, development caches, user files, media content, downloaded content, virtual machine images, recycle bin, others).
- Identify "mysterious large directories": UUID-named Containers, unknown hidden directories. Trace which App they belong to and what they contain (e.g., a 97GB UUID Container is actually Bilibili offline video cache). If necessary, use /
lsto look one level deeper, but remain read-only.du - Three-level classification = cleanup decision list, not a full inventory. Only include items that require a "should I move it" decision in the three-color categories. Regular daily applications, the operating system itself, and massive small files without cleanup decisions are not included in the three-color categories; they fall into the blue "System and Others" section of the disk bar. Judgment criteria:
- 🟢 Auto-cleanable: Pure cache, temporary files, installation package residues, clearly regenerable without affecting functionality or losing user data (development caches like pip/uv/npm/Xcode DerivedData, browser caches).
- 🟡 Manual judgment required: Contains user data or requires judgment (offline videos, documents, project code node_modules, chat records, design drafts). Provide content profiling + at least 3 disposal paths (in-app cleanup / system tools / manual review via file manager, choose the most suitable three) + risk warnings. All yellow items automatically have an "Open in Finder/File Explorer" button in service mode (jump to review and delete manually); if the item has a verified safe subpath that can be deleted without damaging the App (e.g., directory for Bilibili offline videos, old backup directories), assign it
.Downloads→ a "Move to Trash" button appears on the webpage (yellow items can only be moved to trash, reversible, never allow "direct deletion"). Apps hosted without safe subpaths (Chrome/WeChat) only provide an open button, notrash_paths. Notes are automatically displayed below the buttons (open only for viewing not deletion, moving to trash is reversible and requires emptying to release space, etc.); if an item is in an App-internal format that is inconvenient to manually select in the file manager, add antrash_pathsfield for objective explanation (will be displayed in the notes). Tone should be neutral, like product instructions: Directly describe "what structure this is, why it's not easy to delete manually, where to go for fine-grained operations", do not write from a developer's perspective like "I found/remind you/it looks like no videos".open_note - 🔴 Clean with caution (decision needed but not recommended to delete manually): Specific items you might want to move but are advised not to delete manually—duplicate applications, large apps you want to uninstall, core data of running apps, etc. Provide "why manual deletion is not recommended" + with specific uninstall steps (built-in uninstaller / long press in Launchpad / right-click to move to trash / AppCleaner to clear residues / reinstall via App Store, etc., must be actionable not empty words). For app items, assign
indirect_release(array of realapp_pathsabsolute paths) → an "Open in File Manager (to uninstall)" button appears on the webpage, locating the App for users to uninstall formally. Red items do not have delete/uninstall buttons (apps are in system directories, may require administrator password, may have built-in uninstallers and residues, background deletion is unstable). Pure system files, APFS snapshots should not be listed separately as red cards (no cleanup decision), they belong to the blue section; system-level release techniques (restart to release swap, Time Machine snapshot strategy, automatic recovery of freeable space) are written into.applong-term suggestions.summary.long_term
rmrmsizesize_estimateStep 3 Generate Interactive Report
scripts/build_report.pytrash_pathspathserver.pypython3 scripts/server.py /tmp/storage_analysis.json # Automatically opens browser, Ctrl+C to stopserver.pyrmtrash_pathstrashtrash_pathsopenpathfile://python3 scripts/build_report.py /tmp/storage_analysis.json ~/Desktop/storage-report.html && open ~/Desktop/storage-report.htmlserver.pytrash_pathssummary.overviewsummary.prioritysummary.tier_statsStep 4 Provide Summary in Conversation
Dependencies and Prerequisites
- All scripts use Python 3 standard library, zero third-party dependencies (no need for pip install).
- macOS comes with python3, ,
du,diskutilout of the box.osascript - Windows does not have Python installed by default—need to install Python 3 first, and commands are often or
python(notpy -3). This skill usespython3in command examples, which will automatically switch topython3/pythonon Windows.py -3 - This skill is agent-driven: After scanning data, the agent (Claude) performs classification analysis, it is not a double-click-to-run independent App.
Platform Status
- macOS: Fully implemented and tested (scanning / report / one-click deletion fully verified).
- Windows: Code is written (in
scan_windows,scan.pyin_trash_windowsusesserver.py), but not tested on real Windows. When running on Windows for the first time, verify: target directory paths,SHFileOperationWsize, recycle bin deletion functionality. Multi-drive support is already implemented (main disk progress bar + other disk list).os.scandir
Long-term Optimization Suggestions Material (write into report summary.long_term)
- Regular cleanup: , Xcode DerivedData, browser caches
brew cleanup - Visualization tools: DaisyDisk, GrandPerspective, OmniDiskSweeper
- Archive large files to external drive / iCloud / NAS; macOS "System Settings > General > Storage" optimization options