Skip to content

@tank/windows-cleanup

1.0.0

Windows 10/11 disk space recovery for developers. Cleans temp files, Windows Update cache, WinSxS, browser caches, stale node_modules, Docker WSL2, NuGet/npm/pip/Cargo caches, hibernation file, Recycle Bin. Risk-aware PowerShell workflows. Triggers: disk cleanup, free disk space, clean up windows, disk full, clear cache, ccleaner, windows cleanup, temp files, cleanmgr, WinSxS, node_modules cleanup, docker disk, npm cache, pip cache, NuGet cache, reclaim space, hiberfil.sys.


name: "@tank/windows-cleanup" description: | Windows 10/11 disk space recovery and system cleanup for developers. Analyzes disk usage, identifies space hogs (temp files, Windows Update cache, WinSxS, browser caches, dev tool artifacts, stale node_modules, Docker WSL2 images, NuGet/Gradle/npm/pip/Cargo caches, hibernation file, Recycle Bin), and safely reclaims storage with risk-aware PowerShell workflows. Includes an analysis script that produces a prioritized report. Companion to @tank/macos-cleanup for Windows users.

Trigger phrases: "disk cleanup", "free disk space", "clean up windows", "disk full", "running out of space", "clear cache", "clean storage", "ccleaner", "windows cleanup", "temp files", "cleanmgr", "Storage Sense", "WinSxS", "Windows Update cache", "node_modules cleanup", "docker disk space", "WSL disk", "npm cache", "pip cache", "cargo clean", "NuGet cache", "reclaim space", "hiberfil.sys", "Windows.old", "Recycle Bin", "system data large", "purge caches", "clean dev tools"

Windows Disk Cleanup

Recover disk space on Windows 10/11 by cleaning temp files, caches, dev tool artifacts, stale dependencies, and other reclaimable storage. Developer-focused — knows where the real space hogs hide on a dev machine.

Core Philosophy

  1. Analyze before deleting. Always scan first with the analysis script.
  2. Risk-aware cleanup. Categorize by risk (safe/low/moderate/high). Clean safe items freely, confirm everything else.
  3. Use built-in tools when possible. cleanmgr, DISM, Storage Sense, dotnet nuget locals, npm cache clean over raw Remove-Item.
  4. PowerShell everything. All commands are PowerShell. Indicate which need elevation (Run as Administrator).
  5. Never touch user data. Documents, Desktop, Pictures, credentials, SSH keys, registry — hands off.

Quick-Start

"My disk is full, help me clean up"

StepAction
1Run .\scripts\analyze-disk.ps1 to scan all targets
2Review report — prioritize by size and risk
3Clean safe targets first (caches, temp files, logs)
4Present moderate targets for user confirmation
5Mention high-risk targets only if asked
6Show before/after disk space comparison

"Clean everything safe"

Remove-Item "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "C:\Windows\Temp\*" -Recurse -Force -ErrorAction SilentlyContinue  # Admin
Remove-Item "C:\Windows\Prefetch\*" -Force -ErrorAction SilentlyContinue       # Admin
npm cache clean --force 2>$null
pip cache purge 2>$null
dotnet nuget locals all --clear 2>$null

Cleanup Priority Order

PriorityTargetTypical SavingsRisk
1Windows.old15-30 GBModerate
2Docker WSL2 vhdx10-100 GBModerate
3Hibernation file8-64 GB (=RAM)Low
4Stale node_modules5-50 GBModerate
5Rust target dirs5-50 GBModerate
6Windows Update + WinSxS2-15 GBSafe
7NuGet/Gradle/npm caches5-25 GBSafe
8User & system temp1-15 GBSafe
9Browser caches1-5 GBSafe
10Recycle Bin0-50 GBModerate

Decision Trees

What to Clean Based on Request

User SaysAction
"Clean up my PC"Full scan, report, clean safe, confirm moderate
"Clean caches"Temp files, browser caches, dev tool caches
"Clean dev tools"npm/pip/NuGet/cargo/gradle caches only
"What's using space?"Analysis only, no cleanup
"Clean Docker"docker system prune -a + compact WSL2 vhdx
"Free up X GB"Prioritized cleanup until target reached

WinSxS Cleanup

Never manually delete from WinSxS. Use DISM only:

DISM /Online /Cleanup-Image /StartComponentCleanup  # Admin

Docker WSL2 Disk

Docker's WSL2 virtual disk doesn't auto-shrink. After docker system prune:

wsl --shutdown
Optimize-VHD -Path "$env:LOCALAPPDATA\Docker\wsl\disk\docker_data.vhdx" -Mode Full  # Admin

Safety Rules

Never touch:

  • User profile folders (Documents, Desktop, Pictures, etc.)
  • C:\Windows\Installer (breaks app repair/uninstall)
  • C:\Windows\WinSxS directly (use DISM only)
  • $env:USERPROFILE\.ssh, .gnupg, .aws, .kube (credentials)
  • C:\Windows\System32, C:\Windows\SysWOW64
  • Registry hives, .git directories, database files

See references/safety-protocols.md for full safety rules.

Reference Files

FileContents
references/cleanup-targets.mdExhaustive cleanup targets with paths, PowerShell commands, risk levels, typical sizes
references/safety-protocols.mdGolden rules, confirmation flows, never-touch paths, recovery procedures
references/space-analysis.mdDisk analysis techniques, finding large files/dirs, stale node_modules, recommended tools

Scripts

ScriptUsage
scripts/analyze-disk.ps1Scans all targets, reports sizes and risk. Flags: -Json, -DevOnly, -Quick

Command Palette

Search skills, docs, and navigate Tank