agentsclimarketplace

Windows disk cleanup

Skill linad3d/drivekeeper/skills/windows-disk-cleanup

Free space on a full Windows drive without losing user data - find what is consuming the system drive, delete only regenerable caches, and relocate the rest to another drive via NTFS junctions or environment variables. Use whenever the user mentions a full or nearly full C drive, low disk space on Windows, a huge AppData folder, "C盘满了", "C盘爆红", "C盘清理", "磁盘空间不足"; wants to move any cache, AppData folder, package cache, or app data directory to another drive (NuGet, npm, pip, Playwright, Cargo, Unreal Engine DDC, Feishu/Lark, Slack, Discord, NVIDIA shader cache, Claude transcripts); asks whether a cache or app folder is safe to delete, or whether deleting it will log them out, lose chat history, or break the app; or asks what is taking up space on their system drive - even if they never say "cleanup". Also use when a Windows disk is near full and apps behave strangely, since a full volume silently corrupts SQLite databases.From its SKILL.md

Install
npx -y skills add linad3d/drivekeeper --skill windows-disk-cleanup

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • 16 days oldThe repository was created 16 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its file declares

Copied from the file, not written here

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

9.8 KB, ~2.1k tokens by cl100k_base, as published. Nobody here has run it

Windows Disk Cleanup & Relocation

Recover space on a full Windows system drive without losing a single piece of user data, and make the space stay recovered.

Deleting is the easy half; the space comes back

A cleanup that only deletes is undone in about two weeks. Measured on one workstation 13 days after a run:

  • Deleted-only locations regrew 11.25 GB on C: (%LOCALAPPDATA%\Temp 10.94 GB, NVIDIA DXCache 0.31 GB) - roughly 0.87 GB/day.
  • Relocated applications produced 5.32 GB of new data over the same period, and none of it landed on C: - including 5.76 GB of new chat-client cache.

That difference is the point of this skill. A junction is a filesystem-level redirect resolved below the application layer, so the app keeps opening the path it always used and never learns its data moved - which means its future growth follows the link automatically. So wherever something is too valuable to delete or certain to regrow, relocate it rather than just clearing it. Deleting alone means doing this again next month.

The second reason to act, and to act early: a Windows volume that runs to zero bytes does not fail loudly. It silently corrupts whatever was mid-write. In the incident this skill was built from, a full C: drive truncated Chrome's History SQLite database into an empty shell, and Chrome kept running without recording anything until it was restarted - the loss was discovered days later, and the pre-incident history was unrecoverable locally. Treat "the disk is nearly full" as an active data-loss risk, not a housekeeping chore - and never let the cleanup itself be the thing that destroys data. Everything below is built around that.

The one rule

Anything that can be regenerated by re-downloading or re-computing may be deleted. Anything a human created, received, or accumulated gets moved, never deleted - and only after a byte-level verification proves the copy is intact.

When you cannot confidently classify something, it is user data. Ask.

Workflow

1. Measure before touching anything

Run the scanner. Never guess at what is big, and never delete based on a folder name.

powershell -ExecutionPolicy Bypass -File scripts/Scan-DiskUsage.ps1 -Path C:\ -MinGB 0.3

It walks with a manual stack over .NET EnumerateFileSystemInfos and skips reparse points, which matters because directory junctions would otherwise be counted twice (or recursed infinitely) and hand you a fictional number. It also survives permission-denied subtrees instead of aborting.

Drill down where the mass actually is - typically C:\Users\<user>\AppData, C:\ProgramData, C:\Windows\Installer, and per-app data directories.

2. Classify every candidate

Read references/app-cache-atlas.md before deciding anything about a specific application. It lists, per app, which subdirectories are pure regenerable cache and which hold login state, message history, or drafts. The distinction is often inside a single folder - e.g. in Chromium-based apps Service Worker\CacheStorage is disposable but Service Worker\Database is not.

Three buckets:

BucketActionExamples
Regenerable cacheDeleteCache\Cache_Data, Code Cache, GPUCache, shader caches, installer leftovers, driver download packages
Bulky but wantedRelocate to another drivepackage caches, engine DDC, chat app data directories, agent session transcripts
User data / riskyLeave alone, or let the user move it via the app's own settingschat databases, browser profiles, project files, restore points

Anything you are unsure about goes in bucket 3.

3. Propose, then let the user choose

Present a table: item, size, what it is, what happens if it goes. Ask about anything that touches an application's own data directory. Do not silently widen scope - a user who approved "clear caches" did not approve "delete the browser profile".

Never touch, unless the user explicitly and specifically asks:

  • Browser profiles and history (Chrome\User Data, Edge\User Data, Firefox profiles)
  • Chat application message stores (WeChat, WeCom, QQ, Telegram, Slack)
  • Volume Shadow Copies / System Restore points
  • C:\Windows\WinSxS (never delete by hand; only DISM /StartComponentCleanup)
  • Anything under a user's Documents / Desktop / project directories

4. Delete the safe set

powershell -ExecutionPolicy Bypass -File scripts/Invoke-SafeClean.ps1 -WhatIf

Invoke-SafeClean.ps1 is dry-run by default. It only removes paths matching an explicit allowlist of cache patterns, reports the size of each, and degrades to best-effort per-file deletion when a directory is partially locked rather than failing the whole batch. Review the dry-run output with the user, then re-run with -Execute.

Close the owning application first. Rename-Item on the target directory is a cheap, side-effect-free lock probe: if the rename succeeds nothing holds a handle and the delete or move will succeed; if it fails, a process still has the directory open and you should stop rather than force it.

5. Relocate what should not be deleted

Read references/relocation-methods.md to choose the mechanism. In order of preference:

  1. The application's own setting - always best; the app knows about it. (WeChat/WeCom storage location, JianYing draft directory, Steam library folders.)
  2. An environment variable the toolchain respects - NUGET_PACKAGES, PLAYWRIGHT_BROWSERS_PATH, PIP_CACHE_DIR, UE-LocalDataCachePath.
  3. An NTFS directory junction - for the majority of apps, which offer no setting at all. Applications treat a junction as a real directory; no app-level support needed.

Use the script, which enforces the safety sequence:

powershell -ExecutionPolicy Bypass -File scripts/Move-AppData.ps1 `
  -Source "$env:APPDATA\SomeApp" -Destination "D:\AppData\SomeApp"

The four steps are not optional and not reorderable:

  1. robocopy /E /COPY:DAT /DCOPY:DAT the source to the destination.
  2. Verify - independently recompute total bytes and file count on both sides and require an exact match. Do not trust robocopy's summary; recount.
  3. Only then delete the source.
  4. mklink /J the original path to the new location.

If step 2 does not match, stop and report. Never delete a source you have not proven was copied. This ordering is what makes the operation safe to interrupt: at every moment before step 3, the original data is still fully present.

Rules that keep this from going wrong:

  • Junctions work within the same machine, NTFS to NTFS. Do not point one at a network share, a removable drive that may be absent at boot, or a non-NTFS volume.
  • Never junction a directory the OS needs before the target volume mounts.
  • Environment variables set with setx / [Environment]::SetEnvironmentVariable(...,'User') only reach newly started processes. Tell the user to restart their IDE/terminal.

6. Verify, and restart the app

powershell -ExecutionPolicy Bypass -File scripts/Test-Migration.ps1

Confirms free space, that each junction resolves to its intended target, and that environment variables are set. Then start the relocated application and confirm new writes are landing on the destination drive - a junction that silently failed looks identical to one that worked until you check.

Report honestly: free space before/after, what was deleted, what was moved where, and anything that could not be completed.

Platform pitfalls

Read references/windows-pitfalls.md before writing any PowerShell for this task. The short version, all of which cost real debugging time:

  • Write helper .ps1 files in pure ASCII. Windows PowerShell 5.1 reads a UTF-8 file without BOM as ANSI. Non-ASCII characters in comments corrupt the byte stream and can swallow adjacent statements - variables silently become $null and the script half-runs without ever erroring.
  • robocopy exit codes are not booleans. Anything below 8 is success (0 = nothing to copy, 1 = files copied). Testing $? or $LASTEXITCODE -ne 0 will report a perfectly good copy as a failure.
  • Do not parse localized tool output. On non-English Windows, robocopy and DISM emit localized (and frequently mojibake'd) text. Compute sizes yourself.
  • Elevation is required for C:\ProgramData, C:\Windows\Temp, and mklink.

Reference files

  • references/app-cache-atlas.md - per-application: what is safe to delete, what must stay, where the data lives. Read before touching any named app.
  • references/relocation-methods.md - choosing between app setting / environment variable / junction, with a per-app table.
  • references/windows-pitfalls.md - PowerShell, encoding, robocopy, locking, and permission gotchas.
  • references/case-study.md - a fully worked run that recovered 43.7 GB, with the actual numbers and what each decision was.

What ships with it: 10 files

72.8 KB alongside SKILL.md, 4 of them executable

evals/

scripts/

Keep looking

Skills are one crate of 326,790. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.