Analyze, compare, preview, and safely clean Windows disk space. Use when a user asks to inspect a full C drive, find large files, compare disk growth, remove temporary files or caches, clean Windows update leftovers, migrate growing application data, or schedule low-risk maintenance. This unified skill routes the request through four bundled community backends and keeps deletion separate from read-only analysis.
--- name: qingli-skill description: Analyze, compare, preview, and safely clean Windows disk space. Use when a user asks to inspect a full C drive, find large files, compare disk growth, remove temporary files or caches, clean Windows update leftovers, migrate growing application data, or schedule low-risk maintenance. This unified skill routes the request through four bundled community backends and keeps deletion separate from read-only analysis. --- # 清理Skill Use this skill as a unified router for four bundled Windows disk-space projects. The default operation is read-only analysis or dry-run preview. Never run several destructive cleaners against the same drive in one pass because their targets overlap. ## Operating modes - `scan`: inspect the drive and report what consumes space. No deletion. - `preview`: run each backend's safe preview or dry-run mode and compare overlap. No deletion. - `clean`: execute only the user-selected cleanup level through the most suitable backend, then verify free space. - `migrate`: move a user-controlled, high-growth directory to another drive with a rollback path or junction. - `schedule`: schedule only low-risk maintenance after the user gives a recurrence and threshold. When the user says only "clean my C drive", map it to `scan` followed by `preview`. If the user explicitly asks to delete or clean, show the categories and estimated space first, then execute only the selected categories. Protect documents, desktop files, photos, videos, music, downloads, chat databases, backups, restore points, `pagefile.sys`, `swapfile.sys`, `C:\Windows\WinSxS`, `C:\Windows\Installer`, drivers, security databases, and the current agent runtime by default. ## Backend selection 1. **Audit and migration:** `providers/vhaozheng` (`windows-disk-cleanup`). Use for top directories, largest files, saved baselines, growth comparison, and migration suggestions. It is the preferred backend when the real problem is a directory that keeps growing. 2. **Risk-classified Windows cleanup:** `providers/scauyjj` (`windows-disk-cleaner`). Use as the primary cleanup backend. It has L0-L4 levels, reusable JSON plans, allowlists, application-specific patterns, dry-run support, and verification. 3. **Module-based PowerShell cleanup:** `providers/orzcls` (`win-disk-cleaner`). Use for an explicit preview of temp files, recycle bin, update cache, browser/app/developer caches, hibernation, WinSxS, and restore-point modules. Always pass skip flags for hibernation, WinSxS, and restore points during comparison unless the user specifically selects them. 4. **Cross-platform Python analysis:** `providers/gccszs` (`disk-cleaner`). Use for bounded sampling, progressive scans, duplicate detection, growth analysis, monitoring, and a second opinion. Run its quick sample before a full scan on a large drive. ## Required workflow ### 1. Preflight Check Windows version, current free space, target drives, administrator status, and whether the user needs hibernation, sleep, restore points, chat history, Docker, WSL, or developer caches. Do not force-stop applications or change permissions. Before running a Python backend, validate the interpreter itself rather than trusting command resolution. Run the resolved executable with `--version` and require a successful exit plus a `Python` version string. If `python` resolves to a WindowsApps placeholder or returns no usable output, try `py -3` or locate an installed runtime such as a Conda or standalone Python installation, then pass that explicit executable to the backend. Capture stderr as well as stdout; an empty result, non-zero exit, or invalid JSON means the backend did not run and must not be reported as a successful cleanup. ### 2. Scan or preview Run the following from this skill directory. Replace `C:` only when the user names another drive. ```powershell $skillRoot = 'C:\Users\lsb\.codex\skills\qingli-skill' # Backend 1: audit scan powershell -ExecutionPolicy Bypass -File "$skillRoot\providers\vhaozheng\scripts\scan_disk_usage.ps1" -Drive C # Backend 2: fast scan and reusable cleanup plan powershell -ExecutionPolicy Bypass -File "$skillRoot\providers\scauyjj\scripts\scan_space.ps1" -Drives C: -Mode Fast # Backend 3: module preview, excluding the highest-risk modules powershell -ExecutionPolicy Bypass -File "$skillRoot\providers\orzcls\scripts\disk_cleaner.ps1" -DryRun -SkipHibernation -SkipWinSxS -SkipRestorePoints # Backend 4: bounded Python sample and analysis & $python "$skillRoot\providers\gccszs\scripts\analyze_disk.py" --sample --path C: --json & $python "$skillRoot\providers\gccszs\scripts\analyze_disk.py" --path C: --file-limit 10000 --time-limit 30 --json & $python "$skillRoot\providers\gccszs\scripts\clean_disk.py" --dry-run ``` If a backend needs administrator rights, report that it was skipped and continue with the other read-only backends. Do not turn an elevation failure into permission changes. ### 3. Normalize results Deduplicate paths and group results into: disposable cache/temp data; safe only after closing an application; review-first app data; user files to move or archive; Windows-managed paths to leave alone. Report the top three categories, estimated recoverable space, and conflicts between backends. Do not claim that a scan result is deleted space. ### 4. Execute one selected cleanup path Prefer the `scauyjj` plan for normal Windows cleanup: ```powershell powershell -ExecutionPolicy Bypass -File "$skillRoot\providers\scauyjj\scripts\clean_space.ps1" -PlanPath '<plan path from scan>' -DryRun ``` Remove `-DryRun` only after the user has selected the categories and the plan is current. For application data migration, use the migration backend only after checking the destination drive, closing the application, copying and verifying the data, creating the junction, and recording restore instructions. ### 5. Verify Recheck free space, confirm the intended directories changed, record skipped or protected items, and report errors. For Python backends, require non-empty valid JSON and inspect its reported counts before accepting the run. Never report success from an exit code alone if the free-space measurement did not change or the path remains present. ## Safety rules - Never manually delete `C:\Windows\WinSxS`, `C:\Windows\Installer`, `Program Files`, drivers, security software data, `pagefile.sys`, or `swapfile.sys`. - Use Windows-native cleanup or DISM for Windows-managed component storage. - Treat `Windows.old`, hibernation, restore points, package-manager caches, Docker/WSL images, browser profiles, and chat/application data as review-first or explicit-confirmation targets. - Do not delete Downloads, Desktop, Documents, Photos, Videos, Music, backups, or chat databases as part of an automatic cleanup. - Do not run the four destructive backends sequentially. Use all four for analysis/preview, then one selected executor for cleanup. - Preserve the source manifest in `references/source-manifest.md` when updating bundled providers. ## Bundled resources - `providers/vhaozheng`: audit, baseline comparison, destination suggestions, junction migration. - `providers/scauyjj`: Windows risk classification, cleanup plans, application patterns, migration, and scheduling. - `providers/orzcls`: modular PowerShell dry-run cleaner and free-tool references. - `providers/gccszs`: Python analysis, progressive scanning, duplicate detection, monitoring, and dry-run cleanup. - `references/source-manifest.md`: GitHub URLs, commit pins, and integration notes.
本地磁盘重要资料备份库。用于把一台电脑上有价值的内容按 P0/P1/P2 分类、只读复制到异地/异盘备份根、生成索引清单与完整性校验,并明确“备份优先于清理”的安全边界。触发词:备份电脑、打包资料、迁移文件、整理磁盘、防止丢失、做个备份、把重要文件拷到别的盘。
--- name: disk-backup-vault description: 本地磁盘重要资料备份库。用于把一台电脑上有价值的内容按 P0/P1/P2 分类、只读复制到异地/异盘备份根、生成索引清单与完整性校验,并明确“备份优先于清理”的安全边界。触发词:备份电脑、打包资料、迁移文件、整理磁盘、防止丢失、做个备份、把重要文件拷到别的盘。 agent_created: true --- # disk-backup-vault|本地资料备份库 把“有价值但怕丢”的本地资料,按价值分级、只读复制到备份根(另一块盘/网盘/移动硬盘),并产出可还原的索引。本 Skill **只复制、不删除**;清理动作必须发生在备份完成且确认冗余之后。 ## 何时使用 - 用户说“把电脑有用的东西备份一下”“打包重要资料”“防止电脑东西被删” - 换电脑、重装系统、磁盘快满、担心误删前,先做备份 - 想建立定期备份习惯,把备份变成可复用流程 ## 核心原则(硬边界) 1. **只读复制**:所有操作是 copy/robocopy,绝不 `rm`、绝不移动源文件。 2. **备份优先于清理**:任何“删掉腾空间”只能在对应目录已备份且用户确认冗余后发生。先删后补是禁止的。 3. **分级不分家**:P0/P1/P2 都进入同一备份根的不同子目录,互不覆盖。 4. **索引即资产**:没有 `00_INDEX.md` 的备份库视为未完成。 5. **不备份可再生物**:缓存、临时文件、包管理器仓库、conda/anaconda 环境、WSL 发行版(除非用户明确要)不纳入,避免备份库膨胀。 6. **排除运行中的系统目录**:WSL、正在运行的程序数据、页面文件等不强制备份;若用户坚持,单独确认再处理。 ## 备份分级 | 级别 | 定义 | 典型内容 | |---|---|---| | **P0 系统核心** | 丢了无法重建、决定“你是谁”的资产 | 工作记忆 `.workbuddy/memory`、用户级 Skill、知识卡、项目契约 AGENTS.md、长期配置 | | **P1 文档项目** | 高重建成本、日常依赖 | 笔记库(Obsidian 等)、项目文档、会话历史、桌面文件、代码仓库 | | **P2 媒体素材** | 体积大、可重新生成但耗时 | 图片素材库、视频素材、AI 生成资产、设计源文件 | ## 标准流程 1. **预检**:确认源盘、目标盘、可用空间、是否管理员。目标盘空间应远大于待备份量。 2. **建结构**:在备份根建 `P0_系统核心/`、`P1_文档项目/`、`P2_媒体素材/` 和 `00_INDEX.md`。 3. **分类复制**: - P0 用普通 `cp -r`(量小、需完整)。 - P1/P2 用 `robocopy <src> <dst> /E /R:0 /W:1 /XJ /MT:16`,长路径更稳;用 `/XD` 排除已知垃圾(如 `.tmp`、`xwechat_files`、`BaiduNetdiskTmp`)。 - 锁定文件跳过即可,不中断整体任务。 4. **生成索引**:写 `00_INDEX.md`,逐类记录来源路径、大小、文件数、排除项、还原方法、备份时间。 5. **完整性校验**:对比源/备文件数与总大小;对 P0 关键文件抽样比对。 6. **可选归档**:若需上传网盘,把 P0/P1 打成 zip(用 `python -m zipfile`);P2 媒体按需单独处理。 7. **安全收尾**:明确告知用户“已复制、未删除”;如需清理某目录,单独确认。 ## 排除清单(默认不备份) - `AppData` 下的缓存:`npm-cache`、`pip/cache`、`ms-playwright`、各应用 `Cache` - `Local\Temp` 全部 - `anaconda3`、`miniconda`、Python 虚拟环境 - `.gradle/caches`、`.nuget/packages`、`.cargo/registry`、`.rustup` - `Local\wsl`、`docker-desktop` 数据(运行中使用) - 系统目录 `C:\Windows`、`Program Files`、`pagefile.sys`、`swapfile.sys` - 聊天软件的庞大数据(如 `xwechat_files`)默认排除,注明“可客户端重登同步” ## 与清理类 Skill 的边界 - 本 Skill 不删除、不调用磁盘清理器。 - 若用户想“备份完再清理腾空间”,先完成本 Skill 全流程并确认备份库可读,再单独推进清理,清理前每个目录逐一确认。 - 清理类能力见 `qingli-skill`,但必须在本 Skill 之后使用。 ## 索引模板 见 `references/backup-index-template.md`;分类细则见 `references/backup-classification.md`;安全规则见 `references/safety-rules.md`。