Skip to content
AI & Agents
Command

/refactor-clean

通过测试验证安全地识别和移除死代码:

BOOST
From plugin
ai-max
33610 skills9 agents10 commands
Install
$ npx -y skills add zhukunpenglinyutong/ai-max --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/refactor-clean

Context preview

What this command does when you run it.

通过测试验证安全地识别和移除死代码:

Command definition

refactor-clean.md

重构清理

通过测试验证安全地识别和移除死代码:

1. 运行死代码分析工具:

  • knip:查找未使用的导出和文件
  • depcheck:查找未使用的依赖项
  • ts-prune:查找未使用的 TypeScript 导出

2. 在 .reports/dead-code-analysis.md 中生成综合报告

3. 按严重程度分类发现的问题:

  • 安全:测试文件、未使用的工具函数
  • 谨慎:API 路由、组件
  • 危险:配置文件、主入口点

4. 仅提议安全的删除操作

5. 每次删除前:

  • 运行完整测试套件
  • 验证测试通过
  • 应用更改
  • 重新运行测试
  • 如果测试失败则回滚

6. 显示已清理项目的摘要

永远不要在没有先运行测试的情况下删除代码!

Ships withai-max

这是基于 everything-claude-code 进行二次开发,提供npm一键安装方式,协议沿用MIT Claude Code 增强配置,开箱即用。 本仓库包含生产级 agents(代理)、skills(技能)、hooks(钩子)、commands(命令)、rules(规则)和 MCP 配置,帮助你快速提升 Claude Code 的使用体验。

Get the whole plugin

Other commands on ai-max.

tdd
Command

tdd

强制执行测试驱动开发工作流程。先搭建接口,先生成测试,然后实现最小代码使其通过。确保 80% 以上的覆盖率。