tidy-up
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTidy Up
整理清理
Reclaim space and remove leftover local clutter without wrecking active work. Parse the first token as a command when it matches the table; otherwise map clear intent. Default with no useful target is (inventory + proposed cleanup), not blind delete.
scan回收空间并清理残留的本地杂物,同时不破坏正在进行的工作。当第一个标记匹配下表中的命令时,将其解析为对应命令;否则根据明确意图映射。无明确目标时默认执行 (清点 + 提议清理方案),而非盲目删除。
scanOperating contract
操作契约
Shared by every DecisionNerd/dev-skills skill. Canonical copy: .
handbook/concepts/14-operating-contract.md- Define done first. Before using tools, write the finish line in one or two lines: the acceptance criteria (existing issue AC, BDD scenarios, tests, or contract when they exist; otherwise propose them and say where they should live) and the evidence that will prove them. Re-check it before reporting done. Never report done on work you did not verify.
- Requested scope sets the finish line. A question ("is it ready?", "why is it broken?", "what next?") ends with the answer and a line naming the exact next invoke. An outcome request ("fix", "finish", "land", "#42") continues through the chain (diagnose → fix → test → check-readiness → merge-it) until the outcome or a real blocker. Do not end a turn with "Do you want me to…?" for in-scope, in-repo work.
Next: - Stop only for real blockers. Stop and ask only when you cannot continue without the user, or before: deleting data or unmerged work, force-push or history rewrite, changing anything outside this repository (GitHub objects, deployments, live data, production or paid resources, external services), or leaving the requested scope, unless the user's request already named that exact action. Keep the harness's permission prompts for risky commands. Otherwise keep going and put status notes in the same message as the next action.
- Ask well, once. For a genuine question use the harness's structured question tool when it has one (Claude Code: ; Codex:
AskUserQuestionwhen the current mode supports it) with concrete options; otherwise plain text with numbered options. Treat the answer as settled; do not re-open earlier verdicts, plans, or answers unless asked.request_user_input - Fan out when work is parallel. Use subagents for independent reads (repo survey, evidence gathering, per-option research, per-area audits) and for independent verification (a reviewer that did not write the change). Writes stay single-owner per path set and sequential. Brief every child with goal, done-when, constraints, must-not, and return shape; verify each child's result before consolidating. Use Claude Code's tool only for orchestration across many subagents that truly needs it; it is expensive.
Workflow - Pick the model tier per child; defer to routing config. If the harness or user config already routes subagents (Claude Code or a CLAUDE.md rule; Codex
CLAUDE_CODE_SUBAGENT_MODELor a role'sagents.default_subagent_model; Cursor a custom subagent'sagents.<name>.config_filefrontmatter), follow it and do not pass a model. Otherwise: mechanical search or inventory → fast/cheap (Claude Codemodel:); implementation and evidence gathering → mid (haiku); planning, review, adversarial verification → top (sonnetoropus). In Claude Code set it with thefabletoolAgentparam or agent frontmattermodel; in Codex pass a spawn model or setmodel:in the role's config file; in Cursor setmodel(defaultmodel:) ininherit. Where the harness cannot choose, children inherit the parent model or the harness picks one (Cursor's built-in Explore/Bash/Browser subagents pick per subtask); say which in the status note..cursor/agents/*.md - Keep a checklist on long runs. For more than about five steps or work that crosses skills, keep at the repo root and tick items as they finish. Do not commit it unless the repo already tracks one.
TASKS.md - Close every run with three headings. (the one genuine question or blocker, else "none");
Blocked on me(files, commits, GitHub objects, deploys, else "nothing");Changed(evidence, verdict, andFound).Next: <exact invoke>
所有 DecisionNerd/dev-skills 技能共享此规范。官方版本:。
handbook/concepts/14-operating-contract.md- 先定义完成标准。 使用工具前,用一两行写明完成线:验收标准(若存在现有 issue 的 AC、BDD 场景、测试或契约则沿用;否则提出标准并说明应存放的位置)以及证明完成的证据。报告完成前重新核对。未经验证的工作绝不能报告为已完成。
- 请求范围决定完成线。 问题类请求(“准备好了吗?”、“为什么坏了?”、“下一步是什么?”)以答案和一行 结尾,其中写明确切的下一步调用。结果类请求(“修复”、“完成”、“上线”、“#42”)需贯穿整个流程链(诊断 → 修复 → 测试 → 就绪检查 → 合并)直到达成结果或遇到真正的阻塞。对于范围内的仓库内工作,不要以“你需要我…吗?”结束一轮回复。
Next: - 仅因真正的阻塞停止。 仅在以下情况停止并询问用户:没有用户输入就无法继续;或在执行以下操作前:删除数据或未合并的工作、强制推送或历史重写、修改本仓库外的任何内容(GitHub 对象、部署、线上数据、生产或付费资源、外部服务)、超出请求范围——除非用户的请求已明确指定该操作。保留运行框架对风险命令的权限提示。否则继续执行,并将状态说明与下一步操作放在同一条消息中。
- 一次问清楚。 对于真实问题,若运行框架提供结构化提问工具(Claude Code:;Codex:当前模式支持时用
AskUserQuestion),则使用该工具并给出具体选项;否则使用带编号选项的纯文本。将答案视为最终决定;除非用户要求,否则不要重新讨论之前的结论、计划或答案。request_user_input - 并行工作时拆分任务。 对于独立读取类工作(仓库调研、证据收集、逐选项研究、分领域审计)和独立验证类工作(未编写变更的评审者),使用子 Agent。写入操作按路径集保持单一负责人且顺序执行。向每个子 Agent 说明目标、完成条件、约束、禁止事项和返回格式;合并前验证每个子 Agent 的结果。仅在确实需要编排大量子 Agent 时使用 Claude Code 的 工具;该工具成本较高。
Workflow - 为每个子 Agent 选择模型等级;遵循路由配置。 若运行框架或用户配置已为子 Agent 配置路由(Claude Code 的 或 CLAUDE.md 规则;Codex 的
CLAUDE_CODE_SUBAGENT_MODEL或角色的agents.default_subagent_model;Cursor 自定义子 Agent 的agents.<name>.config_file前置元数据),则遵循该配置,不要传递模型参数。否则:机械搜索或清点 → 快速/低成本(Claude Codemodel:);实现和证据收集 → 中等(haiku);规划、评审、对抗性验证 → 顶级(sonnet或opus)。在 Claude Code 中通过fable工具的Agent参数或 Agent 前置元数据的model设置;在 Codex 中传递生成模型或在角色配置文件中设置model:;在 Cursor 中在model里设置.cursor/agents/*.md(默认model:)。若运行框架无法选择,子 Agent 继承父模型或由运行框架选择(Cursor 内置的 Explore/Bash/Browser 子 Agent 会按子任务选择);在状态说明中注明使用的模型。inherit - 长时间运行时保留检查清单。 对于超过约五个步骤或跨技能的工作,在仓库根目录保留 ,完成一项勾选一项。除非仓库已跟踪该文件,否则不要提交它。
TASKS.md - 每次运行结束时给出三个标题。 (一个真实问题或阻塞项,没有则为“none”);
Blocked on me(文件、提交、GitHub 对象、部署,没有则为“nothing”);Changed(证据、结论,以及Found)。Next: <确切的调用内容>
Commands
命令
| Command | What it does |
|---|---|
| Inventory clutter; estimate size; propose deletions (no deletes) |
| Remove dangling / merged / abandoned git worktrees and empty workspace dirs |
| Remove stale build outputs ( |
| Clear regenerable caches (tool/package caches in-repo; ask before global home caches) |
| Prune stale local branches (merged / gone remote); never delete unmerged without approval |
| Broader pass: workspaces + artifacts + caches + safe branch prune (still gated) |
| Same as |
| List commands |
Aliases: / / → map to the narrowest fitting command, or if unclear.
cleancleanupprunescanTarget: repo root (default cwd), monorepo package path, or explicit directory.
| 命令 | 功能 |
|---|---|
| 清点杂物;估算大小;提议删除方案(不执行删除) |
| 移除悬空/已合并/已废弃的 git worktree 以及空的工作区目录 |
| 移除过期的构建输出( |
| 清理可再生缓存(仓库内的工具/包缓存;清理全局主目录缓存前需询问) |
| 修剪过期的本地分支(已合并/远程已删除);未经批准绝不能删除未合并的分支 |
| 更全面的清理:工作区 + 构建产物 + 缓存 + 安全分支修剪(仍需审批) |
| 对当前仓库(或指定路径)执行与 |
| 列出所有命令 |
别名: / / → 映射到最匹配的窄范围命令,若不明确则映射为 。
cleancleanupprunescan目标:仓库根目录(默认当前工作目录)、monorepo 包路径或显式指定的目录。
Routing
路由规则
- No argument / vague “tidy up”: run , then ask one structured multi-select question: which buckets to apply (workspaces / artifacts / caches / branches / deep), showing estimated sizes and risk level for each. Use the harness's structured question tool when available; otherwise plain text with numbered options.
scan - First word is a command: run it; remainder is path/scope.
- Clear intent (“remove old worktrees”, “clear .next”, “prune merged branches”): map and proceed.
- User already ordered exact deletes (“delete these worktrees”, “rm -rf dist and .next”): execute that scope; list what was removed under .
Changed
- 无参数 / 模糊的“整理一下”:执行 ,然后提出一个结构化的多选问题:要应用哪些清理类别(工作区 / 构建产物 / 缓存 / 分支 / 深度清理),并显示每个类别的估算大小和风险等级。若运行框架提供结构化提问工具则使用该工具;否则使用带编号选项的纯文本。
scan - 第一个词是命令:执行该命令;剩余部分为路径/范围。
- 意图明确(“移除旧 worktree”、“清理 .next”、“修剪已合并分支”):映射到对应命令并继续。
- 用户已明确要求删除特定内容(“删除这些 worktree”、“rm -rf dist 和 .next”):执行该范围的清理;在 下列出已删除的内容。
Changed
Hard safety rules
严格安全规则
Follow references/safety.md. Summary:
- Inventory before delete — list paths + sizes + why removable.
- Never delete uncommitted changes, active worktree checkouts still in use, / secrets, or non-ignored source.
.env - Prefer project-local cleanups; global caches (, npm/pnpm/yarn global store, Docker) only when explicitly asked.
~/Library/Caches - Prefer repo scripts (,
npm run clean,make clean) over ad-hocgit worktree prune.rm -rf - No unless the user explicitly asks for that exact command after seeing what it would remove.
git clean -fdx - No force-delete of unmerged branches or worktrees with dirty status without explicit approval.
- After deletes, report what was removed and approximate space reclaimed under .
Changed - Single owner, no fan-out for deletes. Destructive commands run sequentially in the parent; no subagent fan-out for delete steps.
遵循 references/safety.md。摘要如下:
- 删除前先清点 — 列出路径 + 大小 + 可删除的原因。
- 绝不能删除 未提交的变更、仍在使用的活动 worktree 检出、/ 密钥文件,或未被忽略的源码。
.env - 优先进行项目本地清理;仅在用户明确要求时才清理全局缓存(、npm/pnpm/yarn 全局存储、Docker)。
~/Library/Caches - 优先使用仓库脚本(、
npm run clean、make clean),而非临时的git worktree prune。rm -rf - 除非用户在看到 会删除的内容后明确要求执行该命令,否则不得使用。
git clean -fdx - 未经明确批准,不得强制删除未合并的分支或有未提交变更的 worktree。
- 删除完成后,在 下报告已删除的内容和回收的大致空间。
Changed - 删除操作单一负责人,不拆分任务。 破坏性命令在父 Agent 中顺序执行;删除步骤不得使用子 Agent 拆分执行。
Default flow (scan
→ apply)
scan默认流程(scan
→ 执行)
scan- Detect stack (git, node, python, rust, docker, turbo, etc.) and ignore rules.
- Inventory candidates (see references/targets.md).
- Present a table: path | kind | size | risk | command that would clean it.
- Ask which buckets to apply (or run the named command if already chosen).
- Execute (single-owner; no subagent fan-out for delete steps); re-scan briefly.
- Close with three headings: (any high-risk item still awaiting approval),
Blocked on me(paths removed, approximate space reclaimed),Changed(what remains; Next:Found).<next invoke if applicable>
- 检测技术栈(git、node、python、rust、docker、turbo 等)和忽略规则。
- 清点待清理候选项(参见 references/targets.md)。
- 展示表格:路径 | 类型 | 大小 | 风险 | 对应的清理命令。
- 询问要应用哪些清理类别(若已选定则执行指定命令)。
- 执行(单一负责人;删除步骤不使用子 Agent 拆分);简要重新扫描。
- 以三个标题结束:(仍待审批的高风险项)、
Blocked on me(已删除的路径、回收的大致空间)、Changed(剩余内容;Next:Found)。<如适用,填写下一步调用>
Command notes
命令说明
workspaces
/ worktrees
workspacesworktreesworkspaces
/ worktrees
workspacesworktrees- ; prune with
git worktree list --porcelainfor missing dirs.git worktree prune - Remove worktrees whose branch is merged/deleted and working tree is clean — after approval.
- Drop empty leftover dirs from agent/cloud worktrees when safe.
- If a worktree is dirty or has an open PR tip, report and skip unless user forces.
- 执行 ;对缺失的目录使用
git worktree list --porcelain修剪。git worktree prune - 经批准后,删除分支已合并/已删除且工作树干净的 worktree。
- 安全情况下,删除 Agent/云 worktree 残留的空目录。
- 若 worktree 有未提交变更或对应未关闭的 PR 顶端,需报告并跳过,除非用户强制删除。
artifacts
/ build
artifactsbuildartifacts
/ build
artifactsbuild- Remove ignored build outputs that regenerate: ,
dist,build,out,site,.next,.nuxt,.output,coverage, Storybook static, etc.*.tsbuildinfo - Respect monorepos: clean packages in scope only.
- Prefer (ignored only) over deleting tracked files.
git clean -fdX -- <paths>
- 删除可重新生成的、被忽略的构建输出:、
dist、build、out、site、.next、.nuxt、.output、coverage、Storybook 静态文件等。*.tsbuildinfo - 遵循 monorepo 结构:仅清理范围内的包。
- 优先使用 (仅清理被忽略的文件),而非删除已跟踪的文件。
git clean -fdX -- <paths>
caches
cachescaches
caches- In-repo: ,
.turbo,.cache,.parcel-cache,.vite,__pycache__,.pytest_cache,.mypy_cache,.ruff_cache, native build caches when ignored..eslintcache - Package managers: local ; ask before
node_modules/.cache/ npm cache verify-delete / global Homebrew caches.pnpm store prune - Do not delete unless the user asked (
node_modulesmay propose it, not auto-run).deep
- 仓库内缓存:、
.turbo、.cache、.parcel-cache、.vite、__pycache__、.pytest_cache、.mypy_cache、.ruff_cache,以及被忽略的原生构建缓存。.eslintcache - 包管理器:本地 ;执行
node_modules/.cache/ npm 缓存验证删除 / 全局 Homebrew 缓存前需询问。pnpm store prune - 不得删除 ,除非用户要求(
node_modules命令可以提议删除,但不会自动执行)。deep
branches
branchesbranches
branches- Fetch/prune remotes when network ok: .
git fetch --prune - List merged locals and upstreams; delete only after listing.
gone - Keep: current branch, default branch, branches the user names as keepers.
- 网络正常时获取/修剪远程分支:。
git fetch --prune - 列出已合并的本地分支和远程已删除的上游分支;仅在列出后才删除。
- 保留:当前分支、默认分支、用户指定保留的分支。
deep
/ all
deepalldeep
/ all
deepallRun scan across all buckets, then apply approved buckets in order: workspaces → artifacts → caches → branches. Stop and ask if any high-risk item appears (Docker system prune, whole , unmerged branch).
node_modules对所有类别执行扫描,然后按顺序应用已批准的类别:工作区 → 构建产物 → 缓存 → 分支。若出现任何高风险项(Docker system prune、整个 、未合并分支),停止并询问用户。
node_modulesRelated skills
相关技能
- Agent thrash left junk mid-run: first, then
agents slaptidy-up - Code structure cleanup (not disk clutter):
refactor-it - Situational awareness before cleaning:
recon
- Agent 运行中途产生大量垃圾:先执行 ,再执行
agents slaptidy-up - 代码结构清理(非磁盘杂物):
refactor-it - 清理前的态势感知:
recon
Grounding
参考依据
This skill’s TTPs are grounded in current engineering baselines (DORA, GitHub Docs, Fowler/Beck, Google SRE & SWE book, OpenTelemetry, OWASP LLM / NIST AI RMF, Diátaxis — see handbook ).
sources.mdInventory before delete (safe ops hygiene). Reclaim regenerable clutter and merged branches; never confuse tidy with deleting secrets or unmerged work.
Handbook card: .
handbook/practices/tidy-up.md本技能的 TTPs 基于当前工程基线(DORA、GitHub Docs、Fowler/Beck、Google SRE 与 SWE 书籍、OpenTelemetry、OWASP LLM / NIST AI RMF、Diátaxis —— 参见手册 )。
sources.md删除前先清点(安全操作规范)。回收可再生的杂物和已合并分支;绝不能将整理与删除密钥或未合并工作混为一谈。
手册卡片:。
handbook/practices/tidy-up.md