dead-code-cleanup
它能做什么
这项技能帮助你的 AI 找出无用代码,并建议可以删除的内容。适合希望减少杂乱代码、代码包体积或技术债务的开发者。
适用场景
- ✓当你要求删除未使用的代码,或缩减项目规模的时候。
- ✓当你想找出无法到达的文件、未使用的导出或遗留的包的时候。
- ✓当你在规划清理工作,需要一份按可信度排序的清单的时候。
技能链接
https://github.com/repowise-dev/repowise/blob/main/plugins/claude-code/skills/dead-code-cleanup/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请找出这个项目中可以安全删除的无用代码,并告诉我每一项为何看起来未被使用。”
每周 5 个新技能,1 分钟读完。
工作原理
技能向 Repowise 请求按可信度排序的无用代码结果。只有标记为安全的项目才建议删除,可信度较低的项目则列为需要排查的对象,并且在删除任何内容之前请你确认。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Dead Code Cleanup with Repowise
Repowise detects dead code through graph analysis — no LLM needed, works even with a template-rendered wiki.
When the user asks about dead/unused code
Call get_dead_code() to get findings sorted by confidence tier. Useful parameters:
safe_only=true— only findings confirmed safe to delete (confidence >= 0.7)kind="unreachable_file"— files with no importerskind="unused_export"— public symbols nobody useskind="zombie_package"— monorepo packages with no consumersdirectory="src/old/"— limit to a specific directorytier="high"— only high-confidence findings (>= 0.8)min_confidence=0.7— raise the floor (default is 0.5) for a release-ready cleanupgroup_by="directory"orgroup_by="owner"— roll up to see where the dead code concentrates and who owns the most of it
How to present findings
- Only suggest deletion for findings with
safe_to_delete: true - For lower-confidence findings, present them as "candidates to investigate" not "things to delete"
- Dynamically-loaded code (plugins, handlers, adapters) may appear as dead code but isn't — Repowise filters common patterns but edge cases exist
Before deleting anything
- Confirm with the user. Present the file/symbol name, confidence score, and why Repowise thinks it's dead.
- Call
get_risk(targets=["path/to/file"])to double-check dependents. - Recently-modified "dead" code is more likely a false positive — flag this if the finding has recent git activity.
Safe deletion order
- Unreachable files first (whole file removal, cleanest)
- Unused internal symbols next
- Unused exports last (highest false-positive risk due to potential dynamic imports)
常见问题
它会自行删除代码吗?
不会。技能会先请你确认每一次删除。
它对插件或动态代码的判断可能有误吗?
可能。动态加载的代码看起来可能未被使用,因此技能会提醒存在这类特殊情况。
删除之前它会检查什么?
在建议移除之前,它会先用风险检查确认该文件的依赖关系。
详情
作者的原始描述
Use when the user asks about cleanup, removing unused code, refactoring, reducing bundle size, or identifying dead code in a Repowise-indexed codebase (.repowise/ directory exists). Also activates when discussing technical debt, code hygiene, or repository maintenance.
repo: repowise-dev/repowise
热度
- GitHub 星标
- 8.1k
- 排名
- #12568
- 许可证
- AGPL-3.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
architectural-decisions
8.1k帮你的智能体在修改架构之前,借助已记录的决定和历史,弄清代码为何是这样构建的。
change-review
8.1k帮你的智能体在合并前审查拉取请求或一组改动,显示风险、受影响的文件以及还应做哪些修改。
code-health
8.1k帮你的智能体逐个文件评估代码健康度,找出风险最高的文件,并决定接下来重构哪些,所用分析来自 Repowise。
codebase-exploration
8.1k帮你的智能体通过回答代码如何运作、谁调用了什么以及东西在哪里构建,快速了解一个陌生项目。