disk-cleanup
Skill0 starsChanged 32 days agoMITView on GitHub
Auditing and recovering disk space on a developer Windows machine: scans known cache and temp locations with a fast read-only dir /s script, identifies safe-to-clean locations (uv, pip, npm, Windows Update, TEMP), relocates tool caches to a dedicated drive using environment variables and config files, and sets up a monthly maintenance script. Use when your C drive is filling up, you want to find what is using disk space, clean up Python or Node caches, move caches to another drive, set UV_CACHE_DIR or pip cache-dir, audit disk usage, or set up a CacheStore folder structure.
- Installs packages
20 other projects use a version of this.
Adopted by
Most recently taken up by
- addisonk/skillstheir own version, first seen Nov 8, 2026
- DaraBoth/skilljmskilltheir own version, first seen Nov 8, 2026
- huihuisang/ajigu-skillstheir own version, first seen Nov 1, 2026
- pabloleonalcaide/development-skillstheir own version, first seen Nov 1, 2026
- TsinHzl/claude-code-configtheir own version, first seen Nov 1, 2026
- MakiDevelop/claude-skillstheir own version, first seen Nov 1, 2026
Used with
Projects with it also use tdd.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
GoogleSkilltdd
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
Also in 4 projects that use this
Other versions20 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 20
- glebis/claude-skills★ 410same name
- mtarcure/claude-vibe-squad★ 220same name
- MakiDevelop/claude-skills★ 3same name
- vndee/engineering-skills★ 3same name
- DaraBoth/skilljmskill★ 2same name
- TsinHzl/claude-code-config★ 2same name
- addisonk/skills★ 1same name
- CharlesLadera/claude-custom-skills★ 1same name
- foogunlana/skills★ 1same name
- galonge/free-claude-skills★ 1same name
10 more not listed
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 repository68 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- accessibilitySkill
- api-designSkill
- api-versioningSkill
- authSkill
- background-jobsSkill
- cachingSkill
- capacity-planningSkill
- changelogSkill
- chaos-engineeringSkill
- ci-cdSkill
- circuit-breakerSkill
- claude-best-practicesSkill
- code-commentsSkill
- code-hygieneSkill
- code-reviewSkill
- code-structureSkill
- commit-styleSkill
- concurrency-and-lockingSkill
- database-transactionsSkill
- data-consistencySkill
- debug-infra-startupSkill
- debug-sessionSkill
- demo-video-creatorSkill
- demo-video-script-creatorSkill
- dependency-injectionSkill
- dependency-updateSkill
- distributed-tracingSkill
- dockerSkill
- env-configSkill
- env-setupSkill
- error-handlingSkill
- event-driven-architectureSkill
- feature-flagsSkill
- file-storageSkill
- graceful-shutdownSkill
- idempotencySkill
- input-validationSkill
- jars-engineering-blogsmithSkill
- jars-workshop-builderSkill
- licensingSkill
- loggingSkill
- memory-and-allocationsSkill
- migrate-dbSkill
- monitoringSkill
- multi-tenancySkill
- notificationsSkill
- openapiSkill
- paginationSkill
- perf-profileSkill
- pr-descriptionSkill
- query-optimizationSkill
- rate-limitingSkill
- refactorSkill
- releaseSkill
- runbook-writerSkill
- searchSkill
- secrets-auditSkill
- simplifySkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 5 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 13 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 30
Use cmd /c dir /s instead of Get-ChildItem -Recurse.
- Very specific: line 112
Create a CacheStore root:
- Very specific: line 180
After setting UV_CACHE_DIR via System Properties or SetEnvironmentVariable, a running terminal still shows the old value.
- Distinctive: line 183
When Windows launches a process, it hands it a snapshot copy of the environment at launch time.
- Distinctive: line 238
Add to Windows Task Scheduler to run on the 1st of each month automatically.
- Distinctive: line 242
Always scan before cleaning.
- Distinctive: line 243
Never present a plan and execute in the same step — show findings, get approval, then run.
- Distinctive: line 249
After setting an env var, open a new terminal to pick it up — running processes hold a snapshot of the environment from their launch time.
“Common” is measured: kept by at least 6 in 10 of the 13 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-cleanup
Audit first. Clean only what you understand. Never delete without reading the plan.
1. Check drive status
$drive = Get-PSDrive C
$used = [math]::Round($drive.Used / 1GB, 2)
$free = [math]::Round($drive.Free / 1GB, 2)
$total = [math]::Round(($drive.Used + $drive.Free) / 1GB, 2)
Write-Host "Total : $total GB"
Write-Host "Used : $used GB"
Write-Host "Free : $free GB"
Write-Host "Used% : $([math]::Round($used/$total*100,1))%"Above 85% used = danger zone. Windows page file, system restore, and temp writes all need headroom.
2. Scan all known cache locations — read-only
Use cmd /c dir /s instead of Get-ChildItem -Recurse. It is 10–50× faster because
it runs natively in the cmd process without PowerShell object overhead.
# READ-ONLY — does not modify or delete anything
function Get-SizeMB($path) {
if (-not (Test-Path $path)) { return $null }
$lines = & cmd /c "dir /s /a `"$path`" 2>nul"
$summary = $lines | Select-String "File\(s\)" | Select-Object -Last 1
if ($summary -match "([\d,]+)\s+bytes") {
$bytes = [long]($matches[1] -replace ',', '')
return [math]::Round($bytes / 1MB, 1)
}
return 0
}
$locations = [ordered]@{
"User TEMP" = $env:TEMP
"Windows Temp" = "C:\Windows\Temp"
"Windows Prefetch" = "C:\Windows\Prefetch"
"Windows Update Download Cache" = "C:\Windows\SoftwareDistribution\Download"
"User Downloads" = "$env:USERPROFILE\Downloads"
"uv cache" = "$env:LOCALAPPDATA\uv\cache"
"pip cache" = "$env:LOCALAPPDATA\pip\cache"
"npm cache" = "$env:APPDATA\npm-cache"
"pnpm store" = "$env:LOCALAPPDATA\pnpm\store"
"yarn cache" = "$env:LOCALAPPDATA\Yarn\cache"
"VS Code extensions" = "$env:USERPROFILE\.vscode\extensions"
"Docker (LocalAppData)" = "$env:LOCALAPPDATA\Docker"
"JetBrains cache" = "$env:LOCALAPPDATA\JetBrains"
"Chrome cache" = "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Cache"
"Windows Error Reporting" = "C:\ProgramData\Microsoft\Windows\WER\ReportArchive"
"Recycle Bin" = "C:\`$Recycle.Bin"
}
Write-Host ("{0,-45} {1,10} Path" -f "Location", "Size")
Write-Host ("-" * 90)
foreach ($key in $locations.Keys) {
$path = $locations[$key]
$mb = Get-SizeMB $path
$disp = if ($null -eq $mb) { "(not found)" } elseif ($mb -eq 0) { "0 MB" } else { "$mb MB" }
Write-Host ("{0,-45} {1,10} {2}" -f $key, $disp, $path)
}Note on locale: dir uses the system digit separator (, on US/UK, . on some
European locales). Change -replace ',' to -replace '\.' if on a European locale.
3. Safe-to-clean locations
These are always safe — nothing breaks, everything regenerates automatically:
| Location | Clear command | Regenerates when |
uv cache | uv cache clean | Next uv sync or uv pip install |
pip cache | pip cache purge | Next pip install |
npm cache | npm cache clean --force | Next npm install |
yarn cache | yarn cache clean | Next yarn install |
| User TEMP | Remove-Item "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue | Continuously |
| Windows Prefetch | Delete contents | After first app launches (1–2 days) |
Stop Windows Update service before clearing its cache:
Stop-Service wuauserv -Force ; Stop-Service bits -Force
Remove-Item "C:\Windows\SoftwareDistribution\Download\*" -Recurse -Force -ErrorAction SilentlyContinue
Start-Service bits ; Start-Service wuauservNever delete manually:
C:\Windows\WinSxS— usedism /online /cleanup-image /startcomponentcleanupC:\pagefile.sys— virtual memory, removing causes blue screenC:\hiberfil.sys— hibernate file, usepowercfg /h offto remove safelyAppData\Roamingbulk delete — loses app settings and auth tokenspnpm storedirectly — usepnpm store pruneonly
4. Relocate caches to a dedicated drive
The permanent fix: move all tool caches off C onto a dedicated folder on another drive.
Create a CacheStore root:
D:\CacheStore\ (or E:\CacheStore\, whatever your secondary drive is)
uv\
pip\
npm\
huggingface\ ← AI models
ollama\ ← Local LLMs
docker\
gradle\Relocate uv cache:
# Clear old cache first — no point moving 10 GB of stale data
uv cache clean
# Set permanently at user level
[System.Environment]::SetEnvironmentVariable("UV_CACHE_DIR", "D:\CacheStore\uv", "User")
# Apply in current session too
$env:UV_CACHE_DIR = "D:\CacheStore\uv"
# Verify
uv cache dir # should print D:\CacheStore\uvRelocate pip cache:
pip cache purge
pip config set global.cache-dir "D:\CacheStore\pip"
pip cache dir # should print D:\CacheStore\pipRelocate npm cache:
npm cache clean --force
npm config set cache "D:\CacheStore\npm"
npm config get cache # verifyFuture tools — the standard pattern:
# 1. Create the folder
New-Item -ItemType Directory -Path "D:\CacheStore\<toolname>" -Force
# 2. Set env var (user scope)
[System.Environment]::SetEnvironmentVariable("<TOOL_CACHE_VAR>", "D:\CacheStore\<toolname>", "User")
# 3. Apply in current session
$env:<TOOL_CACHE_VAR> = "D:\CacheStore\<toolname>"
# 4. Verify — check tool docs for the verification commandCommon env vars for future caches:
HF_HOME → D:\CacheStore\huggingface (HuggingFace models)
OLLAMA_MODELS → D:\CacheStore\ollama (Ollama local LLMs)
GRADLE_USER_HOME → D:\CacheStore\gradle (Gradle builds)
CARGO_HOME → D:\CacheStore\cargo (Rust packages)5. Why env vars don't show immediately in a running terminal
After setting UV_CACHE_DIR via System Properties or SetEnvironmentVariable, a
running terminal still shows the old value. This is expected — not a bug.
When Windows launches a process, it hands it a snapshot copy of the environment at launch time. The process holds its own private copy. Changing the registry (which is what System Properties does) does not push into already-running processes.
Registry (source of truth) ← updated immediately
Running terminal ← still has the old snapshot (won't update)
New terminal opened after ← gets the new value ✅Fix: close the terminal and open a new one. Or apply in the current session manually:
$env:UV_CACHE_DIR = "D:\CacheStore\uv" # current session only6. Verify everything is pointing correctly
Write-Host "=== Cache locations ==="
Write-Host "uv : $(uv cache dir)"
Write-Host "pip : $(pip cache dir)"
Write-Host "npm : $(npm config get cache)"
Write-Host ""
Write-Host "=== UV_CACHE_DIR env var ==="
Write-Host "Session : $env:UV_CACHE_DIR"
Write-Host "User : $([System.Environment]::GetEnvironmentVariable('UV_CACHE_DIR','User'))"
Write-Host "System : $([System.Environment]::GetEnvironmentVariable('UV_CACHE_DIR','Machine'))"
Write-Host ""
$drive = Get-PSDrive C
Write-Host "C drive free: $([math]::Round($drive.Free/1GB,2)) GB"7. Monthly maintenance script
# maintenance.ps1 — run once a month
Write-Host "=== Cache Maintenance ==="
Write-Host "Date: $(Get-Date -Format 'yyyy-MM-dd')`n"
$before = [math]::Round((Get-PSDrive C).Free / 1GB, 2)
Write-Host "C drive free before: $before GB"
uv cache clean
pip cache purge
Remove-Item "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue
$after = [math]::Round((Get-PSDrive C).Free / 1GB, 2)
Write-Host "C drive free after : $after GB"
Write-Host "Freed : $([math]::Round($after - $before, 2)) GB"Add to Windows Task Scheduler to run on the 1st of each month automatically.
Rules
- Always scan before cleaning. Run the read-only script first, review, then act.
- Never present a plan and execute in the same step — show findings, get approval, then run.
pnpm storemust be cleaned withpnpm store pruneonly — it uses hard links, manual deletion breaks installed packages.- Relocating a cache does not move existing files — clear first, then set the new path.
- User-scope env vars are sufficient for personal dev tools. System-scope is for machine-wide tooling only.
- After setting an env var, open a new terminal to pick it up — running processes hold a snapshot of the environment from their launch time.
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.

