Claude
Skills
Sign in
โ† Back

disk-cleaner

Included with Lifetime
$97 forever

Cross-platform disk space management toolkit with intelligent optimization. REQUIREMENTS: Python 3.7+. UNIVERSAL COMPATIBILITY: Works with ALL AI IDEs (Cursor, Windsurf, Continue, Aider, Claude Code, etc.). PLATFORM-INDEPENDENT: Works at any location - global, project, or user level. SELF-CONTAINED: No pip install needed, includes intelligent bootstrap. KEY FEATURES: (1) PROGRESSIVE SCANNING: Quick sample (1s) + Progressive mode for large disks, (2) INTELLIGENT BOOTSTRAP: Auto-detection of skill location and auto-import of modules, (3) CROSS-PLATFORM ENCODING: Safe emoji/Unicode handling on all platforms, (4) DIAGNOSTIC TOOLS: check_skill.py for quick verification, (5) OPTIMIZED SCANNING: 3-5x faster with os.scandir(), concurrent scanning, intelligent sampling. AGENT WORKFLOW: (1) Check Python, (2) Find skill package (20+ locations auto-detected), (3) Run diagnostics, (4) Use progressive scanning for large disks. The skill package includes all optimization modules - no features are lost!

AI Agentsscripts

What this skill does


# Disk Cleaner Skill - Complete Feature Guide for All Agents

## ๐Ÿšจ IMPORTANT: Emoji Usage Policy

### For Script Output (Cross-Platform Safety)
- **NEVER use emoji in script output** - All scripts use ASCII-safe characters
- Scripts use: `[OK]`, `[X]`, `[!]`, `[*]`, `[i]`, `[DIR]`, `[FILE]`, `[PKG]`, `[x]`
- This ensures compatibility with Windows GBK and other non-UTF-8 consoles
- **DO NOT modify script output to add emoji** - This will break cross-platform compatibility

### For Agent-to-Human Communication (Recommended)
- **SHOULD use emoji when reporting results to humans** - Makes output more readable
- Use these emoji in your final reports to users:
  - `โœ…` (Success) - Completed operations, successful scans
  - `โŒ` (Error) - Failed operations, critical errors
  - `โš ๏ธ` (Warning) - Warnings, issues that need attention
  - `๐Ÿ”` (Scanning) - Search/scan operations
  - `๐Ÿ“Š` (Statistics) - Analysis results, statistics
  - `๐Ÿ“` (Directory) - Directory-related information
  - `๐Ÿ“ฆ` (Package) - Package/module information
  - `๐ŸŽ‰` (Success) - Celebratory messages for successful completion
  - `๐Ÿšจ` (Critical) - Critical warnings
  - `๐Ÿ’ก` (Tip) - Suggestions, recommendations
  - `๐Ÿ“‹` (List) - Checklists, summaries
  - `๐Ÿ”ง` (Tool) - Tools, utilities
  - `๐ŸŒ` (Global) - Cross-platform, universal features
  - `๐Ÿ›ก๏ธ` (Safety) - Safety-related information
  - `โšก` (Performance) - Performance improvements
  - `๐Ÿ“` (Document) - Documentation
  - `๐ŸŽ“` (Learning) - Educational content
  - `๐Ÿ“ž` (Support) - Help, support information
  - `๐Ÿ“ˆ` (Growth) - Improvements, gains
  - `๐ŸŽฏ` (Target) - Goals, objectives
  - `๐Ÿš€` (Launch) - Quick start, fast operations
  - `๐Ÿ› ๏ธ` (Tools) - Tool-related features

**Example:**
```
Script output (ASCII):    [OK] Scan completed: 50,000 files in 30 seconds
Your report to human:     โœ… Scan completed successfully! Found 50,000 files in 30 seconds
```

---

## ๐Ÿ“ฆ COMPLETE FEATURE LIST (READ THIS FIRST!)

### ๐Ÿšจ CRITICAL: Progressive Scanning (MANDATORY for Large Disks)
- โœ… **Quick Sample Mode**: 1-second estimation of disk size and scan time
- โœ… **Progressive Scan Mode**: Get partial results in 30 seconds for large disks
- โœ… **Smart Time Limits**: Prevent users from waiting hours
- โœ… **Real-time Feedback**: Progress updates every 2 seconds
- โœ… **Interruptible**: Ctrl+C to get partial results

### ๐Ÿ”ง Intelligent Bootstrap (Auto-Detection & Import)
- โœ… **Auto Location Detection**: Searches 20+ common skill package locations
- โœ… **Environment Variable Support**: DISK_CLEANER_SKILL_PATH override
- โœ… **Auto Module Import**: Automatically imports diskcleaner modules
- โœ… **Fallback Mechanisms**: Works even if some features unavailable
- โœ… **Cross-Platform Python Detection**: Tries both 'python' and 'python3'

### ๐ŸŒ Universal Compatibility
- โœ… **All AI IDEs**: Cursor, Windsurf, Continue, Aider, Claude Code, etc.
- โœ… **All Platforms**: Windows, macOS, Linux (including Windows GBK console)
- โœ… **All Installation Levels**: Global, project, user level
- โœ… **No Configuration Needed**: Works out of the box
- โœ… **Cross-Platform Encoding**: All scripts use ASCII-safe output (v2.0+)

### ๐Ÿ›ก๏ธ Safety & Reliability
- โœ… **Diagnostic Tool**: check_skill.py - verifies all functionality
- โœ… **Safe Encoding**: All scripts use ASCII characters (no emoji in output)
- โœ… **Safe Defaults**: --dry-run for cleaning, smart limits for scanning
- โœ… **Protected Paths**: Never deletes system directories or executables
- โœ… **Error Handling**: Graceful degradation on errors
- โœ… **GBK/UTF-8 Compatible**: Works on Windows GBK, UTF-8, and all other encodings

### โšก Performance Optimizations (ALL INCLUDED)
- โœ… **QuickProfiler**: Fast sampling to estimate scan characteristics
- โœ… **ConcurrentScanner**: Multi-threaded I/O for 3-5x speedup
- โœ… **os.scandir() Optimization**: 3-5x faster than Path.glob
- โœ… **IncrementalCache**: Cache scan results for faster repeat scans
- โœ… **Memory Monitoring**: Auto-adapts based to available memory
- โœ… **Early Stopping**: Configurable file/time limits
- โœ… **Enhanced Cache Detection**: 26+ cache paths (was 8) - 225% improvement

### ๐Ÿ†• v2.2+ New Features
- โœ… **Duplicate File Detection**: Find and remove duplicate files with adaptive strategies
- โœ… **Growth Trend Analysis**: Track disk usage over time, predict when disk will be full
- โœ… **Interactive Wizard**: Step-by-step guided cleanup with safety confirmations
- โœ… **File Organization**: Intelligent file archival and organization (4 strategies)
- โœ… **Enhanced Scan Limits**: 500K files (was 50K), 120s timeout (was 30s)
- โœ… **Deep Scan Mode**: `--deep-scan` for unlimited scanning
- โœ… **Windows Directory Support**: `--include-windows` for system directory scanning

### ๐Ÿ“Š Available Scripts (13+ Total)
**Core Analysis:**
1. **analyze_disk.py** - Disk analysis with smart sampling (enhanced v2.2)
2. **analyze_progressive.py** - Progressive scanning for large disks
3. **find_duplicates.py** - Duplicate file detection (NEW v2.2)
4. **analyze_growth.py** - Growth trend analysis (NEW v2.2)

**Cleaning & Organization:**
5. **clean_disk.py** - Safe junk file cleaning (enhanced cache detection)
6. **interactive_wizard.py** - Interactive guided cleanup (NEW v2.2)
7. **organize_files.py** - File archival and organization (NEW v2.2)

**Monitoring & Diagnostics:**
8. **monitor_disk.py** - Disk usage monitoring
9. **check_skill.py** - Diagnostic tool

**Developer Tools:**
10. **skill_bootstrap.py** - Intelligent bootstrap module
11. **package_skill.py** - Package creation tool
12. **scheduler.py** - Automated scheduling

### ๐Ÿš€ Multi-Agent Acceleration (CRITICAL FOR PERFORMANCE)

**๐ŸŽฏ KEY INSIGHT: Use Sub-Agents for Parallel Processing**

This is one of the MOST POWERFUL features of disk-cleaner when used by AI Agents!

#### Why Use Multiple Agents?

Single-threaded scanning:
```
Agent scans โ†’ [Dir1] โ†’ [Dir2] โ†’ [Dir3] โ†’ ... (sequential, slow)
```

Multi-Agent parallel scanning:
```
Main Agent
  โ”œโ”€ Sub-Agent-1 scans โ†’ [Dir1, Dir2, Dir3] (parallel)
  โ”œโ”€ Sub-Agent-2 scans โ†’ [Dir4, Dir5, Dir6] (parallel)
  โ””โ”€ Sub-Agent-3 scans โ†’ [Dir7, Dir8, Dir9] (parallel)
Result: 3-10x faster! โšก
```

#### When to Use Multi-Agent Mode?

โœ… **ALWAYS use when:**
- Scanning multiple top-level directories (e.g., C:\, D:\, E:\)
- Cleaning multiple user profiles
- Processing large file sets (>100K files)
- Time-critical operations

โŒ **Don't use when:**
- Single small directory (<10K files)
- Quick analysis (<30 seconds)
- Simple cleanup tasks

#### How to Implement Multi-Agent Scanning

**Option 1: Use Agent Tool (Recommended for Claude Code)**

```python
# Agent code that spawns sub-agents
from anthropic import Anthropic

def parallel_scan_directories(directories_list):
    """
    Scan multiple directories in parallel using sub-agents
    """
    # Split directories among sub-agents (3-5 agents optimal)
    chunks = split_list(directories_list, n_chunks=3)
    
    # Launch sub-agents in parallel
    agents = []
    for i, chunk in enumerate(chunks):
        agent = Anthropic().agent.create(
            name=f"scanner-{i}",
            instructions=f"""
            Scan these directories: {chunk}
            Use disk-cleaner with: --file-limit 50000 --time-limit 60
            Return results in JSON format
            """,
            model="claude-sonnet-4-20250514"  # Fast model
        )
        agents.append(agent)
    
    # Wait for all agents and collect results
    results = [agent.wait() for agent in agents]
    return merge_results(results)
```

**Option 2: Parallel Subprocess (Platform Independent)**

```python
import subprocess
from concurrent.futures import ThreadPoolExecutor, as_completed

def parallel_scan_subprocess(directories_list):
    """
    Scan multiple directories using parallel subprocess calls
    Works with ALL AI IDEs that support subprocess
    """
    def scan_directory(directory):
        """Scan a single directory"""
        cmd = [
            'python',
            'skills/disk-cleaner/scripts/analyze_dis
Files: 51
Size: 695.2 KB
Complexity: 87/100
Category: AI Agents

Related in AI Agents