orzcls/win-disk-cleaner

win-disk-cleaner

Windows C: drive disk cleanup using free/open-source tools and PowerShell scripts.

View source

How to use

  1. Copy the installation command and review the source package before installing it in your own agent environment.
  2. Check the source document for required tools, credentials and supported hosts.
  3. Describe your input and desired deliverable; review the output against the source material.
npx skills add https://github.com/orzcls/win-disk-cleaner --skill win-disk-cleaner

Before you start

  • Installation does not include a model subscription, API allowance or permission to access your files.
  • Repository stars and installation counts describe activity, not an independent quality or security test.
Original skill document

Rendered from the source repository. Headings, examples, code, tables, links, and referenced images are preserved.

Windows Disk Cleaner

Free, universal C: drive cleanup — no paid software needed.

Workflow

1. Assess the situation

Ask user for context if not provided:

  • Windows version (10/11)
  • Current free space and total drive size
  • Any scan results (screenshots from WinDirStat, TreeSize, etc.)
  • Whether they are a developer (affects which dev caches to target)
  • Whether they use hibernation/sleep mode

2. Generate the cleanup script

Read and deliver scripts/disk_cleaner.ps1 to the user. The script:

  • Requires admin privileges (#Requires -RunAsAdministrator)
  • Has -DryRun mode for safe preview
  • Has skip flags: -SkipHibernation, -SkipWinSxS, -SkipRestorePoints
  • Covers 10 modules: temp, recycle bin, WU cache, browsers, system logs, app caches, dev caches, hibernation, WinSxS, restore points
  • Includes bonus Windows Disk Cleanup utility invocation

Encoding requirement: Save as UTF-8 with BOM for Chinese Windows compatibility. Use Python:

python
import codecs
with codecs.open('disk_cleaner.ps1', 'w', encoding='utf-8-sig') as f:
    f.write(content)

3. Customize for user's environment

Adapt the script based on user context:

  • Non-developers: Remove module 7 (dev caches) or comment it out
  • Laptop users who need sleep: Add -SkipHibernation to recommended command
  • Users with specific large files: Add targeted cleanup commands (e.g., Android SDK, USMT.ppkg, Docker images)
  • Chinese software users: Ensure QQ/WeChat/DingTalk/Baidu paths are included

4. Recommend free tools

For details, read references/free_tools.md. Key recommendations:

  • BleachBit — open-source CCleaner replacement
  • WizTree — fastest disk analyzer (reads NTFS MFT)
  • Everything — instant file search (size:>500mb trick)
  • dupeGuru — open-source duplicate finder

5. Long-term maintenance advice

Provide these tips:

  • Enable Storage Sense (Settings > System > Storage)
  • Move default install path to D: drive
  • Redirect Downloads/Desktop/Documents to D: drive
  • Use mklink /D for symlink migration of installed apps
  • Schedule monthly BleachBit/script runs

Common large file targets

File/FolderTypical SizeSafe to Remove?
hiberfil.sysRAM sizeYes if not using hibernate
pagefile.sys1-16 GBReduce if RAM >= 16GB
WinSxS5-20 GBDISM cleanup only (never delete manually)
Windows.old10-30 GBYes after confirming new OS works
C:\Recovery\ USMT.ppkg1-3 GBYes after factory setup
Android SDK images2-10 GBYes if not developing
Docker WSL vhdx5-50 GBCompact with wsl --shutdown + diskpart
npm/pip/yarn cache0.5-5 GBYes (re-downloads on demand)
JetBrains caches1-5 GBYes (rebuilds automatically)
Shader caches (NVIDIA/Intel/AMD)0.2-2 GBYes (rebuilds on next launch)

Resources

  • scripts/disk_cleaner.ps1 — Main PowerShell cleanup script (10 modules, DryRun support)
  • references/free_tools.md — Curated list of free/open-source disk tools with usage tips

Related by task