一键导入
cleanup
Detect and clean up AI-generated redundant or low-quality code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Detect and clean up AI-generated redundant or low-quality code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | cleanup |
| description | Detect and clean up AI-generated redundant or low-quality code. |
This skill detects and removes redundant, duplicated, or low-quality code that often results from AI-assisted development. Use this to keep the codebase clean and maintainable after AI-generated code has accumulated.
Scope. This skill's "remove" / "cleanup" actions refer only to deleting redundant lines or blocks of code inside source files — never to deleting files, directories, or entire file contents.
Forbidden actions. Do not execute any filesystem-deletion command while running this skill, including but not limited to:
rm, rm -rf, rmdirRemove-Item, Remove-Item -Recurse -Forcedel, del /s, rd /sfs.rm / fs.rmSync with recursive optionsProtected directories. The following are essential operational state or configuration — they must never be deleted, renamed, or moved by this skill. If any appears to contain "redundant" files, do not touch it; flag the observation in the cleanup report for human review:
.snow (OMS / snow-cli runtime state).git (version control)node_modules (dependencies).omc, .claude (orchestration state & skills).env, config, or lockfiles (package-lock.json, pnpm-lock.yaml, etc.)When in doubt about a file or directory, keep it and flag it. Deletion is reversible only via version control; assume it is not reversible.
Scan for common patterns of AI-generated redundancy:
// increment i by 1 for i++)Use codebase-search and ace-search with action: find_references to detect these patterns.
Scan for quality issues common in AI-generated code:
data, result, temp, x without clear meaningPrioritize findings by impact:
Each cleanup action must match the type of slop found. Do not run a single uniform "remove" pass. Use this mapping:
| Slop type (from Steps 1–3) | Allowed action | Scope of "remove" |
|---|---|---|
| Dead code (unused fn/var/import) | Remove dead code lines | Delete the specific unused lines/blocks only |
| Duplicate functions / boilerplate | Consolidate into one shared function | Delete the duplicates after extraction |
| Over-abstraction (pass-through wrappers) | Flatten by inlining the wrapper | Delete the wrapper layer |
| Over-commented code | Remove the redundant comments | Delete comment lines only |
| Naming issues | Rename in place | No deletion of code |
| Magic numbers | Extract named constant | Addition, not deletion |
| Missing tests / weak coverage | Add tests | Addition, not deletion |
| Structural (god files, mixed concerns) | Split / move code between files | Edit, not delete |
For each item:
filesystem-readace-searchHard rule: "Remove" in this step means deleting code lines inside a source file. It never means deleting files, directories, or running shell deletion commands (see Scope & Safety above).
After cleanup:
terminal-execute with build commandProduce a cleanup report:
# Code Cleanup Report
## Issues Found
### Critical
- [file.ts:42] Dead function `unusedHelper()` — never called
### High
- [utils.ts:15, utils.ts:89] Duplicate functions `formatDate` and `formatDateString`
### Medium
- [parser.ts:120] Magic number `86400` should be named `SECONDS_PER_DAY`
## Cleanup Actions Taken
- [x] Removed `unusedHelper()` from file.ts
- [x] Consolidated `formatDate` and `formatDateString` into single `formatDate()`
- [x] Extracted `SECONDS_PER_DAY = 86400` as constant
## Verification
- Build: ✅ Passed
- Tests: ✅ All 42 tests passed
- Diagnostics: ✅ No new warnings
rm, Remove-Item, del, rd /s, fs.rm recursive, etc.). This skill operates by editing source code, not by deleting files or directories. See Scope & Safety..snow, .git, node_modules, .omc, .claude, config/lockfiles). If you suspect one contains slop, flag it in the report — do not delete.Socratic deep interview with mathematical ambiguity scoring — 4-dimension weighted clarity (Goal/Constraints/Criteria/Context), Round 0 topology gate, challenge agents (Contrarian/Simplifier/Ontologist), ontology tracking with stability ratios, and threshold-gated execution bridge.
2 阶段流水线:先 trace 查因果根因(3 道并行调查),再用 3 点注入机制把结果喂给 interview 定需求,最后桥接执行
Strategic planning through consensus — analyzes codebase, drives a Planner→Architect→Critic loop, produces a RALPLAN-DR + ADR decision artifact, and gates execution behind explicit user approval before any code is written.
Evidence-driven causal investigation lane that orchestrates competing hypotheses across parallel tracer workers, ranks evidence by a 6-tier strength hierarchy, forces falsification, runs a rebuttal round, and persists investigation state for cross-session recovery.
截图驱动的视觉 QA 判定器——把当前截图与参考图对比,返回严格 JSON 裁决,驱动下一轮编辑直到通过 90 分阈值
持久化 markdown 知识库,跨会话累积项目知识(ingest/query/lint/add/delete + 交叉引用 + 自动捕获)