disk-cleaner
Skill1 starsChanged 8 months agoMITView on GitHub
High-performance cross-platform disk space monitoring, analysis, and cleaning toolkit with v2.0 optimization enhancements. Use when Claude needs to: (1) Analyze disk space usage and identify large files/directories consuming space, (2) Clean temporary files, caches, logs, and other junk files safely, (3) Monitor disk usage with configurable warning/critical thresholds, (4) Generate detailed reports on disk health and cleanup recommendations. Features advanced optimization: 3-5x faster scanning with os.scandir(), concurrent multi-threaded I/O, intelligent sampling for large directories, memory-adaptive processing, and cross-platform compatibility (Windows/macOS/Linux). Specializes in Windows C drive cleanup while maintaining full compatibility with Unix systems. Provides interactive CLI, automated scripts, detailed reporting modes, and comprehensive test coverage (244 tests). All operations prioritize safety with built-in protection for system files.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- jcordon5/disk-cleaner-skilltheir own version, first seen Jun 11, 2026
- xiaofenggan01/disk-cleaner-skillstheir own version, first seen Jun 2, 2026
- open-agent-power/oh-my-disk-cleanertheir own version, first seen Apr 2, 2026
- crazynomad/skillstheir own version, first seen Mar 29, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- open-agent-power/oh-my-disk-cleaner★ 40same name
- xiaofenggan01/disk-cleaner-skills★ 37same name
- crazynomad/skills★ 27same name
- jcordon5/disk-cleaner-skill★ 1same 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.
In this repository25 other files it gives its agents.
- agent-reachSkill
- ai-image-generationSkill
- birdSkill
- code-simplifierSkill
- deep-researchSkill
- developer-growth-analysisSkill
- doubao-image-generationSkill
- e2e-testing-patternsSkill
- file-organizerSkill
- find-skillsSkill
- frontend-designSkill
- fullstack-developerSkill
- hr-skillSkill
- monitor-skillSkill
- multi-agent-workflowSkill
- obsidian-cliSkill
- pm-agentSkill
- podcast-skillSkill
- postbridge-social-growthSkill
- proactive-agentSkill
- tavilySkill
- tinybirdSkill
- twitter-readerSkill
- webapp-testingSkill
- xhs-note-creatorSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. 0 are common, 10 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
10
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
Graceful degradation: when scanning protected directories
- Very specific: line 158
Important: Always run with --dry-run first to preview changes.
- Very specific: line 200
Dry Run Default: Must use --force for actual deletion
- Distinctive: line 215
When user says "My C drive is full":
- Very specific: line 274
Use --json flag with any script.
- Distinctive: line 358
If scanning seems slow:
- Distinctive: line 359
Check if path is network drive (slower than local)
- Distinctive: line 360
Verify anti-virus isn't scanning every file access
- Very specific: line 361
Use --sample flag for quick estimates on large directories
- Distinctive: line 364
If no files found:
- Distinctive: line 365
Check path exists and is accessible
- Distinctive: line 366
Verify files aren't all protected (system directories)
- Distinctive: line 367
Run with higher verbosity to see what's being scanned
- Distinctive: line 396
Always run tests after changes:
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Disk Cleaner Skill v2.0
High-performance cross-platform disk management toolkit with advanced optimization features for monitoring, analyzing, and cleaning disk space safely.
🚀 What's New in v2.0
Performance Enhancements
- 3-5x faster scanning with os.scandir() optimization
- Concurrent multi-threaded scanning for I/O-bound operations
- Intelligent sampling with QuickProfiler (estimates in 0.5-1s instead of full scan)
- Memory-adaptive processing with automatic memory monitoring
- Optimized duplicate detection with parallel hashing and caching
Reliability Improvements
- 244 comprehensive tests across all platforms
- Cross-platform compatibility verified on Windows, macOS, Linux
- Python 3.8-3.12 support with full test coverage
- Robust error handling for permission issues and edge cases
- Graceful degradation when scanning protected directories
Quick Start
Analyze Disk Space
# Analyze current drive (C:\ on Windows, / on Unix)
python skills/disk-cleaner/scripts/analyze_disk.py
# Analyze specific path
python skills/disk-cleaner/scripts/analyze_disk.py --path "D:\Projects"
# Get top 50 largest items
python skills/disk-cleaner/scripts/analyze_disk.py --top 50
# Output as JSON
python skills/disk-cleaner/scripts/analyze_disk.py --json
# Save report
python skills/disk-cleaner/scripts/analyze_disk.py --output disk_report.jsonClean Junk Files
# Dry run (default - safe simulation)
python skills/disk-cleaner/scripts/clean_disk.py --dry-run
# Actually clean files (use --force)
python skills/disk-cleaner/scripts/clean_disk.py --force
# Clean specific category
python skills/disk-cleaner/scripts/clean_disk.py --temp # Clean temp files only
python skills/disk-cleaner/scripts/clean_disk.py --cache # Clean cache only
python skills/disk-cleaner/scripts/clean_disk.py --logs # Clean logs only
python skills/disk-cleaner/scripts/clean_disk.py --recycle # Clean recycle bin only
python skills/disk-cleaner/scripts/clean_disk.py --downloads 90 # Clean downloads older than 90 daysMonitor Disk Usage
# Check current status
python skills/disk-cleaner/scripts/monitor_disk.py
# Continuous monitoring (every 60 seconds)
python skills/disk-cleaner/scripts/monitor_disk.py --watch
# Custom thresholds
python skills/disk-cleaner/scripts/monitor_disk.py --warning 70 --critical 85
# Alert mode (CI/CD friendly)
python skills/disk-cleaner/scripts/monitor_disk.py --alerts-only
# Custom monitoring interval
python skills/disk-cleaner/scripts/monitor_disk.py --watch --interval 300Performance Features
High-Speed Scanning
The scanner uses advanced optimizations for rapid directory traversal:
- os.scandir() optimization: 3-5x faster than Path.glob/iterdir()
- Bounded queue processing: Efficient concurrent scanning
- Adaptive worker threads: CPU count × 4 for I/O-bound operations
- Smart path exclusion: Skip system directories automatically
Intelligent Sampling (QuickProfiler)
For large directories, use sampling to get instant estimates:
from diskcleaner.optimization.scan import QuickProfiler
profiler = QuickProfiler(sample_time=1.0) # 1 second sampling
profile = profiler.profile(path) # Returns: estimated file count, size, depth, time
# Example output for 442K files:
# - Estimated: 450,000 files (within 2%)
# - Estimated scan time: 14 seconds
# - Actual scan time: 14 secondsMemory Management
Automatic memory monitoring prevents system overload:
from diskcleaner.optimization.memory import MemoryMonitor
monitor = MemoryMonitor(threshold_mb=1000)
if monitor.should_pause():
# Reduce concurrency
workers = monitor.get_optimal_workers(current_workers)Script Reference
analyze_disk.py
Main disk analysis tool that identifies space consumption patterns.
Key capabilities:
- High-speed scanning with os.scandir() (3-5x faster)
- Scan large directories (100K+ files) in seconds
- Cross-platform path exclusion (Windows/macOS/Linux)
- Detailed statistics and reports
Common use cases:
"Analyze my C drive and show what's taking up space"
"What are the largest directories in my home folder?"
"Show me temp files taking up space"
"Scan this 400GB directory quickly"clean_disk.py
Safe junk file removal with multiple safety mechanisms.
Safety features:
- Protected paths (never deletes system directories)
- Protected extensions (never deletes executables)
- Dry-run mode by default
- Detailed logging of all operations
- Handles empty categories gracefully
Categories cleaned:
- temp: Temporary files (%TEMP%, /tmp, etc.)
- cache: Application and browser caches
- logs: Log files (older than 30 days default)
- recycle: Recycle bin / trash
- downloads: Old download files (configurable age)
Important: Always run with --dry-run first to preview changes.
monitor_disk.py
Continuous or one-shot disk usage monitoring.
Features:
- Multi-drive monitoring (all mount points)
- Configurable warning/critical thresholds
- Continuous monitoring mode with alerts
- JSON output for automation
- Non-zero exit codes for CI/CD integration
Exit codes:
- 0: All drives OK
- 1: Warning threshold exceeded
- 2: Critical threshold exceeded
Platform-Specific Information
See temp_locations.md for:
- Complete list of temporary file locations by platform
- Browser cache locations
- Development tool caches
- Safety guidelines for each platform
Platform-specific optimizations:
- Windows: Excludes C:\Windows, C:\Program Files, etc.
- macOS: Excludes /System, /Library, /private/var/vm (VM swap)
- Linux: Excludes /proc, /sys, /dev, /run
When to read this file:
- User asks about specific platform cleanup locations
- Need to understand what gets cleaned on each OS
- Customizing cleanup for specific applications
Safety Rules
The scripts implement multiple safety layers:
- Protected Paths: System directories never touched
- Protected Extensions: Executables and system files protected
- Dry Run Default: Must use
--forcefor actual deletion - Age Filters: Logs cleaned only after 30+ days
- Error Handling: Permission errors don't stop execution
- Graceful Degradation: Handles edge cases (empty categories, missing paths)
Protected extensions:
.exe, .dll, .sys, .drv, .bat, .cmd, .ps1, .sh, .bash, .zsh,
.app, .dmg, .pkg, .deb, .rpm, .msi, .iso, .vhd, .vhdxTypical Workflows
Workflow 1: Investigate and Clean
When user says "My C drive is full":
- Analyze current state:
python skills/disk-cleaner/scripts/analyze_disk.py - Preview cleanup:
python skills/disk-cleaner/scripts/clean_disk.py --dry-run - Review report, confirm with user
- Execute cleanup:
python skills/disk-cleaner/scripts/clean_disk.py --force - Verify results:
python skills/disk-cleaner/scripts/analyze_disk.py
Workflow 2: Continuous Monitoring
For proactive disk management:
- Start monitor:
python skills/disk-cleaner/scripts/monitor_disk.py --watch --interval 300 - Set appropriate thresholds:
--warning 70 --critical 85 - Monitor alerts and take action when needed
Workflow 3: Large-Scale Analysis (NEW)
For analyzing large directories (100K+ files):
# Use intelligent sampling for quick estimates
python skills/disk-cleaner/scripts/analyze_disk.py --path "D:\Large\Project" --sample
# Full scan if needed
python skills/disk-cleaner/scripts/analyze_disk.py --path "D:\Large\Project" --full
# Performance: Can scan 442K files in ~14 secondsWorkflow 4: One-Time Deep Clean
For thorough cleanup:
# Preview all cleaning
python skills/disk-cleaner/scripts/clean_disk.py --dry-run
# If satisfied, execute
python skills/disk-cleaner/scripts/clean_disk.py --force
# Analyze results
python skills/disk-cleaner/scripts/analyze_disk.pyOutput Formats
Interactive Mode (Default)
Human-readable console output with:
- Visual progress bars
- Emoji indicators for status
- Formatted tables
JSON Mode
Machine-readable output for:
- Automation pipelines
- Log aggregation
- Further processing
Use --json flag with any script.
Report Files
Save detailed reports with --output report.json for:
- Historical tracking
- Comparison over time
- Audit trails
Advanced Usage
Python API
For integration with other tools:
from diskcleaner.core import DirectoryScanner, SmartCleanupEngine
# Scan directory
scanner = DirectoryScanner("/path/to/scan")
files = scanner.scan()
# Analyze and get recommendations
engine = SmartCleanupEngine("/path/to/scan")
report = engine.analyze()
# Clean with safety checks
results = engine.clean(
categories=["temp", "cache", "logs"],
dry_run=True # Set False to actually delete
)Performance Optimization
For maximum performance on large directories:
from diskcleaner.optimization.scan import ConcurrentScanner, QuickProfiler
# Quick profiling first
profiler = QuickProfiler(sample_time=1.0)
profile = profiler.profile(large_path)
print(f"Estimated: {profile.file_count:,} files")
print(f"Estimated time: {profile.estimated_time:.1f}s")
# Full concurrent scan if needed
if profile.file_count < 100000:
scanner = ConcurrentScanner()
result = scanner.scan(large_path)Testing
Comprehensive test suite ensures reliability:
- 244 tests covering all functionality
- Cross-platform: Windows, macOS, Linux
- All Python versions: 3.8, 3.9, 3.10, 3.11, 3.12
- Performance benchmarks: Validate optimization improvements
- Integration tests: End-to-end workflows
Run tests:
# Run all tests
pytest tests/
# Run specific test category
pytest tests/test_optimization.py
pytest tests/benchmarks/
# With coverage
pytest tests/ --cov=diskcleaner --cov-report=htmlTroubleshooting
Permission Errors
The scanner handles permission errors gracefully. Protected directories are automatically skipped on each platform:
- Windows: C:\Windows, C:\Program Files
- macOS: /System, /Library, /private/var/vm
- Linux: /proc, /sys, /dev
Performance Issues
If scanning seems slow:
- Check if path is network drive (slower than local)
- Verify anti-virus isn't scanning every file access
- Use
--sampleflag for quick estimates on large directories
Empty Results
If no files found:
- Check path exists and is accessible
- Verify files aren't all protected (system directories)
- Run with higher verbosity to see what's being scanned
Contributing
To modify or extend the toolkit:
- Optimization modules:
diskcleaner/optimization/scan.py: ConcurrentScanner, QuickProfilerhash.py: AdaptiveHasher, DuplicateFinderdelete.py: BatchDeleter, AsyncDeletermemory.py: MemoryMonitorprofiler.py: PerformanceProfiler
- Core modules:
diskcleaner/core/scanner.py: DirectoryScanner with os.scandir()smart_cleanup.py: SmartCleanupEngine- Other core components
- Platform-specific:
diskcleaner/platforms/- Windows, macOS, Linux implementations
- Tests:
tests/- Unit tests for all components
- Performance benchmarks
- Cross-platform tests
- Scripts:
scripts/- User-facing CLI tools
Always run tests after changes:
pytest tests/ -v
pre-commit run --all-filesLicense
MIT License - See LICENSE file for details.
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
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.

