
storage-analyzer
PopularmacOS / Windows read-only storage analysis assistant (automatically detects the operating system). It scans full-system disk usage to identify space hogs, classifies each item into three tiers—🟢 Automatically Cleanable / 🟡 Manual Review Required / 🔴 Proceed with Caution—and provides actionable cleanup plans. It generates beautifully formatted, collapsible, interactive HTML reports with one-click copyable commands, and can spin up a local server for one-click web page deletion (move to Trash / delete directly). The scanning process is completely read-only. Make sure to invoke this skill in scenarios such as: when the user asks for "storage analysis", "disk full", "C drive / hard drive full", "out of space", "clean up space", "clean disk", "what's taking up space", "check my storage", "check computer storage / space", "storage space", "insufficient storage", "memory full / running low" (in Chinese colloquialisms, "memory" often refers to disk storage), "storage analysis", "disk cleanup", "clear cache"; or when the user complains about lack of disk space, wants to know what is consuming disk space, or requests cleanup advice. Note: If the user explicitly refers to RAM / system memory (e.g., "which process is hogging RAM", "high RAM usage", or wants to view Activity Monitor), that refers to RAM rather than storage, which is outside the scope of this skill.
Related Skills
macOS / Windows read-only storage analysis assistant (automatically detects the operating system). It scans full-system disk usage to identify space hogs, classifies each item into three tiers—🟢 Automatically Cleanable / 🟡 Manual Review Required / 🔴 Proceed with Caution—and provides actionable cleanup plans. It generates beautifully formatted, collapsible, interactive HTML reports with one-click copyable commands, and can spin up a local server for one-click web page deletion (move to Trash / delete directly). The scanning process is completely read-only. Make sure to invoke this skill in scenarios such as: when the user asks for "storage analysis", "disk full", "C drive / hard drive full", "out of space", "clean up space", "clean disk", "what's taking up space", "check my storage", "check computer storage / space", "storage space", "insufficient storage", "memory full / running low" (in Chinese colloquialisms, "memory" often refers to disk storage), "storage analysis", "disk cleanup", "clear cache"; or when the user complains about lack of disk space, wants to know what is consuming disk space, or requests cleanup advice. Note: If the user explicitly refers to RAM / system memory (e.g., "which process is hogging RAM", "high RAM usage", or wants to view Activity Monitor), that refers to RAM rather than storage, which is outside the scope of this skill.
Storage Analyzer
Perform a read-only storage analysis on macOS to generate an interactive HTML report. Workflow: Scan → Analyze & Categorize → Generate Web Page → Open.
Iron Rules
- Read-only throughout. You are strictly limited to running scans, gathering stats, listing directories, and reading metadata (using
df,du,diskutil,stat,ls). Any write operations—such asrm,mv,rmdir, emptying the Trash, or changing permissions—are strictly forbidden. - Deletion commands are display-only and must not be executed. Cleanup commands provided in the report are intended for users to review and run in their own terminal. Even if the user explicitly says "delete it for me" in the chat, pause and confirm first (triggering the global safeguard: always confirm before deleting files) instead of executing them directly.
- Clearly label estimates. Any figures regarding "reclaimable space" must be explicitly stated as estimates.
- Keep paths and commands untranslated in their original form.
Execution Workflow
Step 1 Scan (Read-Only)
python3 scripts/scan.py > /tmp/storage_scan.json
scan.py automatically detects the operating system (sys.platform):
- macOS: Scans
home,library,caches,containers,group_containers,app_support,applications,downloads, anddev_caches, calculating sizes viadu. - Windows: Scans
user_profile,appdata_local,appdata_roaming,temp,downloads,program_files(_x86), anddev_caches, calculating sizes viaos.scandir;system.disksincludes all drive letters.
JSON Output: system (system/disk info, including disk_name for the main drive + disks for all drives) + groups (sizes of subdirectories per group, sorted in descending order and filtering out items below 50MB). Scanning can take time, so please be patient. Unreadable directories are marked as denied; these must be listed in the report along with an indication of their omitted volume.
Step 2 Analysis and Categorization
First check system.os to identify the OS, then refer to the relevant system layout guide: macOS users check references/macos.md, and Windows users check references/windows.md (which details file locations, identification methods, and tier assignments). Then read /tmp/storage_scan.json to complete the following tasks:
- Identify the Top 5 space consumers and classify their types (System Assets / Application Binaries / Application Data / Application Caches / Developer Caches / User Files / Media Content / Downloads / Virtual Machine Images / Trash / Other).
- Identify "mysterious large directories": Trace UUID-named Containers and obscure hidden directories to determine which App they belong to and what they store (e.g., a 97GB UUID Container might actually be Bilibili offline video cache). If necessary, perform a one-level deep inspection using
ls/du, remaining strictly read-only. - Three Tiers = Cleanup Decision Checklist, Not Full Inventory. Only include items that present a clear decision on whether to delete them. Everyday active applications, the operating system itself, and large volumes of scattered small files do not involve a cleanup decision and should not be placed in the three tiers; they fall under the blue "System & Other" segment on the disk usage bar. Classification criteria:
- 🟢 Automatically Cleanable: Pure caches, temporary files, leftover installation packages, items that are clearly safe to regenerate without affecting functionality or losing user data (developer caches like pip/uv/npm/Xcode DerivedData, browser caches).
- 🟡 Manual Review Required: Contains user data or requires evaluation costs (offline videos, documents, project code
node_modules, chat logs, design files). Provide a content profile + at least 3 sentences detailing execution paths (in-app cleanup / system utilities / file manager manual review, choosing the most appropriate option) + risk warnings. All yellow tier items automatically feature an "Open in Finder / File Explorer" button in server mode (allowing users to navigate there and review/delete manually). If an item has a verified safe subpath that won't break the app upon deletion (e.g., Bilibili offline video.Downloadsdirectory, old backup directories), assign ittrash_paths→ a "Move to Trash" button will appear on the web page (yellow tier items are only allowed to be moved to Trash—a reversible action—and are never given a "Delete Directly" option). App-managed directories lacking safe subpaths (e.g., Chrome/WeChat) should only display the Open button, withouttrash_paths. Explanatory notes will be automatically appended below the buttons (reminding users that opening is for viewing only, and moving to Trash is reversible until emptied); if an item uses an internal app format in the file manager that is inconvenient for manual selection, add anopen_notefield for objective clarification (displayed under the notes). Maintain a neutral, product-manual tone: Directly describe "what structure exists here, why manual deletion is tricky, and where to go for fine-grained management". Avoid developer-centric troubleshooting phrasing like "I noticed/note that/looks like no videos". - 🔴 Proceed with Caution (Decision exists, but manual deletion is discouraged): Specific items that users might want to touch, but where direct manual deletion is discouraged—such as duplicate app installs, large apps intended for uninstallation, or core runtime data of active apps. Provide "Why manual deletion is discouraged" + explicit uninstallation steps in
indirect_release(e.g., built-in uninstaller / Launchpad long-press / right-click move to Trash / AppCleaner residual cleanup / App Store reinstallation—actionable guidance rather than vague advice). For application items, provideapp_paths(an array of real.appabsolute paths) → displaying an "Open in File Manager (to Uninstall)" button on the web page to locate the App so the user can uninstall it properly. Red tier items must not display delete or uninstall buttons (apps in system directories may require admin privileges, have built-in uninstallers, or leave residuals, making automated deletion unreliable). Do not list pure system files or APFS snapshots as separate red cards (as they involve no cleanup decision); simply group them under the blue segment. System-level space reclamation tips (rebooting to clear swap, Time Machine snapshot management, automatic purging of purgeable space) should be recorded undersummary.long_termas long-term advice.
For each 🟢 item, provide: estimated reclaimable space, processes to close before cleanup, and one-click copyable cleanup commands (using safe methods like moving to Trash or app-native cleanup options; use rm with caution, and if rm is used, it must target explicit cache subdirectories).
Keep size fields clean: Format size / size_estimate as "~14 GB" or "Total ~8.6 GB". Using "~" already indicates an estimate, so do not append "(Estimated)"—it is redundant and unprofessional (templates will automatically strip such redundant parentheses). Regenerable properties are already covered by tier headings and button notes, so do not clutter size fields with them.
Step 3 Generate Interactive Report
Write the analysis results into an analysis JSON (see schema in the top comments of scripts/build_report.py).
🟢 items must include trash_paths (an array of absolute paths eligible for deletion, distinct from the human-readable path display field)—this is required for web page deletion buttons to appear; omitting it will hide the buttons.
By default, open reports using the one-click cleanup mode (server.py), as the core value of this skill lies in enabling direct web-based cleanup:
python3 scripts/server.py /tmp/storage_analysis.json # Automatically launches browser; press Ctrl+C to stop
server.py runs on 127.0.0.1 with a random port and random token. 🟢 items offer "Move to Trash" (reversible) + "Delete Directly" (instant cleanup, irreversible); 🟡 items offer "Open in Finder" + (when safe subpaths exist) "Move to Trash". Security Model—Three whitelists, enforcing strict access controls: rm only permits green tier trash_paths; trash permits green + yellow tier trash_paths (yellow tier items can never be target of rm); open (open in file manager, non-destructive) permits all the above + real yellow tier paths. All requests undergo realpath validation + must reside within $HOME + require token + Host header validation, prompting a browser confirm dialog on every click. Moving to Trash uses osascript/SHFileOperationW; on macOS, simply allow the Finder automation prompt on first run.
Use static mode only when the user explicitly requests a shareable or archivable read-only file (static pages opened via file:// cannot access the file system, so deletion buttons will be hidden):
python3 scripts/build_report.py /tmp/storage_analysis.json ~/Desktop/storage-report.html && open ~/Desktop/storage-report.html
Troubleshooting: No deletion/Trash buttons visible on the web page = Either the report was opened in static mode (switch to server.py), or 🟢 items missed trash_paths (populate the field and restart the server).
Report flow (fixed sequence): Disk Overview Card (capacity + progress bar + tri-color capacity pills + system info, pure data) → Top 5 Space Hogs → Actionable Recommendations → 🟢🟡🔴 Three-Tier Collapsible Cards (with one-click copyable commands) → Long-Term Optimization Advice. Following the structure: "Status Quo → Diagnosis → Prescription → Operations → Prevention".
Note that summary.overview should be phrased as a single-sentence insight (directly stating the largest consumer and total reclaimable space), without repeating total/used/available figures—as those are already displayed prominently in the card statistics. overview renders at the start of the "Actionable Recommendations" section as an introduction (in plain text), immediately followed by the summary.priority priority list.
The disk progress bar breaks down "Used Space" into segments: Green (automatically cleanable) + Yellow (manual review) + Red (identified items recommended not to delete manually) + Blue (System & Other, automatically calculated as Used − Green − Yellow − Red), with the remainder shown as Available (gray background). All three values for green, yellow, and red in summary.tier_stats must start with a parseable GB number (e.g., "~27.8 GB"), which the script parses to calculate segments; the blue segment and the "System & Other" pill are computed automatically by the template.
Pills only render the parsed pure numbers (e.g., "~5.5 GB") and omit supplementary notes from the data. Thus, keep the three values in tier_stats as clean numbers without adding defensive disclaimers like "Identified items only/System excluded". System files are inherently allocated to the blue segment, while red only holds quantifiable 🔴 items (duplicate apps, large apps ready to uninstall, etc.). System files and snapshots with uncertain sizes naturally settle into the blue segment.
Step 4 Summary in Conversation
After generating the report, provide a conclusion-first summary in the chat in a short paragraph: total estimated reclaimable space, the top 2–3 items to clean first, and the highest-risk item. Direct the user to the web page for detailed breakdowns.
Dependencies and Execution Prerequisites
- All scripts rely exclusively on the Python 3 standard library with zero third-party dependencies (no
pip installrequired). - macOS comes with
python3,du,diskutil, andosascriptbuilt-in, ready out of the box. - Windows does not install Python by default—Python 3 must be installed first, and commands typically run as
pythonorpy -3(rather thanpython3). Command examples in this skill writepython3, which should automatically adjust topython/py -3on Windows. - This skill is agent-driven: after scanning the data, the agent (Claude) handles categorization and analysis; it is not a standalone executable application.
Platform Readiness
- macOS: Fully implemented and tested (scanning, report generation, and one-click deletion are fully verified).
- Windows: Code implemented (
scan_windowsinscan.py,_trash_windowsinserver.pyviaSHFileOperationW), but not yet tested on a physical Windows environment. On the first Windows run, verify: target directory paths,os.scandirsize calculations, and Recycle Bin deletion behavior. Multi-drive support is implemented (main drive progress bar + secondary drive list).
Materials for Long-Term Advice (To be included in report summary.long_term)
- Periodic maintenance:
brew cleanup, Xcode DerivedData, browser caches - Visualization tools: DaisyDisk, GrandPerspective, OmniDiskSweeper
- Archiving large files to external drives / iCloud / NAS; macOS optimization options under "System Settings > General > Storage"





