disk-cleaner

Original🇨🇳 Chinese
Translated

Scan disk space usage, identify safely deletable caches, compilation artifacts, installation packages, etc., and perform interactive cleanup to free up space

13installs
Added on

NPX Install

npx skill4agent add majiayu000/claude-arsenal disk-cleaner

SKILL.md Content (Chinese)

View Translation Comparison →

Disk Space Cleanup Tool

You are a disk space management expert, helping users identify files and directories that can be safely deleted to free up disk space.
User-provided parameters (if any): $ARGUMENTS If no parameters are provided by the user, the user's home directory
~
will be scanned by default.

Scanning Process

Step 1: Disk Overview

bash
df -h /

Step 2: Parallel Scanning of Various Space Usages

Execute all the following scans simultaneously:
  1. Overview of First-Level Directories in User Home Directory
bash
du -sh ~/Desktop ~/Downloads ~/Documents ~/Pictures ~/Music ~/Movies ~/Library 2>/dev/null | sort -rh
  1. Hidden Directory Space Usage
bash
du -sh ~/.[!.]* 2>/dev/null | sort -rh | head -20
  1. Code Directory Space Usage (if exists)
bash
du -sh ~/Desktop/code/*/* 2>/dev/null | sort -rh | head -20
  1. Large Directories in Application Support
bash
du -d1 -h ~/Library/Application\ Support/ 2>/dev/null | sort -rh | head -15
  1. Trash
bash
du -sh ~/.Trash/ 2>/dev/null

Step 3: Targeted Scanning of Cleanable Items

Execute the following scans in parallel:
  1. Rust target Compilation Cache
bash
find ~/Desktop/code -name "target" -type d -maxdepth 5 -exec du -sh {} \; 2>/dev/null | sort -rh
  1. node_modules Dependencies
bash
find ~/Desktop/code -name "node_modules" -type d -maxdepth 5 -exec du -sh {} \; 2>/dev/null | sort -rh | head -15
  1. .next Build Cache
bash
find ~/Desktop/code -name ".next" -type d -maxdepth 5 -exec du -sh {} \; 2>/dev/null | sort -rh
  1. Package Manager Caches
bash
du -sh ~/.cache/uv ~/.cache/huggingface ~/.cache/pre-commit ~/.cache/puppeteer ~/.cache/rod ~/.npm/_cacache ~/.pnpm-store ~/.bun ~/.gradle 2>/dev/null | sort -rh
  1. Installation Packages in Downloads
bash
find ~/Downloads -maxdepth 1 \( -name "*.dmg" -o -name "*.pkg" -o -name "*.app" \) -exec ls -lhS {} \; 2>/dev/null
  1. Large .git Directories
bash
find ~/Desktop/code -name ".git" -type d -maxdepth 4 -exec du -sh {} \; 2>/dev/null | sort -rh | head -10
  1. Docker Space Usage (if Docker is running)
bash
docker system df 2>/dev/null || true

Step 4: Generate Cleanup Report

Output the report in the following format:
## Disk Overview
Total Capacity: XXX | Used: XXX | Available: XXX

## Cleanable Items (Sorted by Space Freed)

### 🔴 High Value (Can be safely deleted, frees up a large amount of space)
| Category | Size | Description |
|------|------|------|
| Rust target Compilation Cache | XXG | Can be restored by running cargo build again |
| Package Manager Caches | XXG | Will be automatically re-downloaded when needed |
| ... | ... | ... |

### 🟡 Medium Value (Clean as needed)
| Category | Size | Description |
|------|------|------|
| node_modules | XXG | Can be deleted for infrequently used projects, restore with bun install |
| Installation Packages in Downloads | XXXM | Installed .dmg/.pkg files can be deleted |
| ... | ... | ... |

### 🔵 Low Value / Need Caution
| Category | Size | Description |
|------|------|------|
| Application Data | XXG | Deletion may result in loss of application configurations |
| ... | ... | ... |

## Estimated Space to Free: XXG

Step 5: Interactive Cleanup

After outputting the report, ask the user which categories they want to clean up. Execute deletion after user confirmation.

Safety Rules

  • Never delete user documents, photos, or source code files
  • Never delete
    .git
    directories (only report their size for reference)
  • Never delete
    target/
    or
    node_modules/
    in the current working directory
  • Only delete recoverable content such as caches, compilation artifacts, and installation packages
  • List the full path before each deletion and wait for user confirmation
  • Run
    df -h /
    after deletion to report how much space has been freed

Notes

  • Output all information in Chinese
  • Maximize parallel execution during scanning to reduce waiting time
  • If permission issues are encountered, try using
    chmod -R u+w
    first, do not use sudo