安全清理C盘 (Safe C: Drive Cleanup)
This skill should be used when the user asks to clean, free up space, or remove junk from the C: drive / Windows system disk (e.g. "清理C盘", "c盘清理", "腾空间", "大幅度清理"). It provides a read-only disk scan workflow and a SAFE Recycle-Bin (recoverable) deletion method that works even when the agent sandbox blocks direct writes to C:\Users\AppData, C:\ProgramData, C:\Windows. Use it to scan for large files/dirs and to move junk to the Recycle Bin without permanent deletion.
skillhub install @user_c1ee5550/safe-c-drive-cleanup
README 文档
3,151 字Safe C: Drive Cleanup
Clean the Windows system disk (C:) safely: scan first (read-only), then move selected junk to the Recycle Bin (recoverable) — never permanent delete. This skill is required because the agent's sandbox blocks writes to protected Windows paths, and a specific command-form workaround is needed.
When to use
- User asks to clean / free space on C: ("清理C盘", "c盘清理", "腾空间").
- User wants to remove temp files, updater caches, old backups, Windows search index, etc.
Step 1 — Read-only scan (NEVER delete during scan)
Generate a markdown report of largest directories and files. Use a Python os.walk that:
- Buckets sizes by top-level and second-level folder.
- Collects individual files >= 100 MB (sorted desc, cap ~120).
- Skips junction/symlink targets: skip when
os.path.realpath(dirpath) != dirpath. - Sets a time cap (e.g. 600 s) to avoid runaway scans.
- Writes a report; prints nothing destructive.
The scan must be read-only. Do NOT delete or move anything in this step.
Step 2 — Confirm scope with the user (safety)
C:\ is a system No-Go Zone. Before any removal:
- Present the report and a safe-candidate list (Temp, updater caches, Windows.edb, old backups, logs).
- Flag what must NOT be touched:
pagefile.sys(virtual memory),C:\Windows\WinSxS,System32,
and user data (WeChat files, WPS cloud, Documents).
- Require explicit user confirmation of which items to clean. Use
AskUserQuestion(multiSelect).
Step 3 — THE SANDBOX WORKAROUND (critical)
The Bash tool sandboxes writes to protected paths. To actually move files:
- Call Bash with
dangerouslyDisableSandbox: true. - Path quoting is the trap: git-bash strips backslashes from double-quoted
C:\Users\...,
and forward slashes /c/Users/... get mangled into c:\c\....
- ALWAYS wrap Windows paths in SINGLE quotes with literal backslashes, e.g.:
'C:\Users\Administrator\.workbuddy\binaries\python\versions\3.13.12\python.exe' 'C:\path\to\script.py'
- PowerShell
Add-Typeis blocked by policy — do NOT use PowerShell .NET for this. Use Python +
SHFileOperation instead.
Step 4 — Move to Recycle Bin (recoverable, never permanent)
Use scripts/recyclepaths.py which calls SHFileOperationW with FOFALLOWUNDO (sends to Recycle Bin). Run it via the Step 3 command form, passing target paths as args.
- Moving to Recycle Bin keeps the file on disk (in
C:\$Recycle.Bin) — recoverable. - After moving, verify with
os.path.exists(path); it should return False. - Process in small batches; if a path fails (locked file), skip and report — do NOT force.
Step 5 — Special cases
Windows.edb(search index, ~hundreds of MB): locked by the Windows Search service.
Stop it first (net stop WSearch), recycle the file, then net start WSearch to rebuild. Check status with sc query WSearch (STATE 4 = RUNNING). The service recreates a fresh (small) index after restart.
Templocked items: enumerate children and recycle each individually; skip any that
fail (code 32 = in use by a running process). These clear on reboot / when the app closes.
pagefile.sys: never touch. To shrink, use System > Advanced > Performance > Virtual Memory.
Step 6 — Verify & report
- Re-check each target with
os.path.exists(expect False). - Confirm
WSearchis RUNNING after touchingWindows.edb. - Tell the user: space is only truly reclaimed after they EMPTY the Recycle Bin. Offer to empty
it only with a second explicit confirmation (emptying is permanent).
Safety rules (non-negotiable)
- Read-only scan first; explicit per-item confirmation before removal.
- Recycle Bin only — never
rm/ permanent delete on personal/system paths. - Never touch
pagefile.sys,WinSxS,System32, or user data without explicit instruction.
同分类其他技能
查看全部 ›电子印章公安备案、全网互认,实现所有格式文件电子签章与视频确权,覆盖全国所有CA厂商自2005年以来的全量电子签章数据,无论由哪个地区、
2 141.2万 钟馗.skill钟馗.Skill——会更新漏洞库的安全审查专家。直来直去、快刀斩乱麻,三层审查(静态审计/行为模拟/供应链溯源)覆盖12类风险,输出结构
19 36.1万 a ca s ca s c ca s cParse, search, and analyze application logs across formats. Use when
0 16.3万 网安技能网络安全与SRC漏洞掘金实战技能。融合「系统学习路径」与「SRC实战掘金」双模式: ①学习模式=法律→基础→工具→靶场→攻防→就业全流程
17 10.6万 skill-vetterSecurity-first skill vetting for AI agents. Use before installing an
0 8.7万 安全校验核心和系统管理领域的安全审查能力。当用户想要使用安全校验工具,用于拦截恶意指令、审查高风险技能时使用。触发器:skill-vetter、
0 7.9万