← 返回 Skills 市场
bovinphang

Refactor Clean

作者 Bovin Phang · GitHub ↗ · v2.5.0 · MIT-0
cross-platform ✓ 安全检测通过
41
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install fec-refactor-clean
功能描述
Use when safely removing dead frontend code, unused exports, stale components, obsolete routes, unused dependencies, or cleanup targets found by tools such a...
使用说明 (SKILL.md)

重构清理

Purpose

在验证保护下识别并清理无用前端代码,减少技术债,同时避免误删动态引用、路由入口、配置文件和运行时约定。

Procedure

  1. 先建立基线:运行或确认当前 lint、type-check、test、build 的状态。
  2. 收集候选项:
    • 优先使用仓库已有工具,如 knip、depcheck、ts-prune、eslint、TypeScript。
    • 没有工具时,用 rg 检查引用、导出、路由、注册点和文档入口。
  3. 按风险分类:
    • SAFE:测试夹具、未引用工具函数、明确未导出的私有组件。
    • CAUTION:共享组件、feature 入口、样式文件、Storybook stories。
    • DANGER:路由、配置、package scripts、运行时模板、动态 import、插件元数据。
    • UPGRADE:过期依赖、重复依赖、未使用依赖和安全告警先进入依赖升级或依赖清理评估,不与死代码删除混做。
  4. 只自动处理 SAFE 项;CAUTION 和 DANGER 需输出建议和证据,不直接删除。
  5. 每批清理后运行受影响验证命令。
  6. 若验证失败,停止扩大清理范围,先定位该批次。
  7. 清理结束后做行为等价复核:公开 API、路由、命令、模板、metadata、文档示例和报告输出仍可被引用。
  8. 对技术债排序:优先清理有验证保护、影响开发效率或阻塞升级的项目;低证据的大范围重写只输出建议。

Frontend-Specific Checks

  • 检查 JSX/模板字符串、路由配置、barrel export、Storybook、测试、文档示例和动态组件注册。
  • 样式文件需检查 className、CSS Modules、Tailwind safelist、全局选择器和主题变量。
  • 依赖清理需检查构建插件、运行时模板、CLI scripts、monorepo 子包和 peer dependency。

Constraints

  • 不改变用户可见行为。
  • 不删除无法证明无引用的公开 API、路由、模板或配置。
  • 不用“一次大删除”替代可验证的小批次清理。
  • 不把格式化、重命名或架构重写混入死代码清理。
  • 不用“看起来没人用”作为证据;必须有搜索、工具输出、类型错误消失或测试保护。
  • 不把依赖大版本升级伪装成清理;升级风险、release notes 和 lockfile 变更应分流到依赖升级工作流。

Expected Output

  • 清理报告保存为 reports/refactor-clean-YYYY-MM-DD-HHmmss.md
  • 报告包含候选项、风险分类、已清理项、跳过原因、运行命令和剩余风险。
  • 代码清理后相关验证命令通过,或明确说明阻塞原因。
安全使用建议
Installers should understand that this skill can guide an agent to edit or remove project files during cleanup. Use it in a version-controlled workspace and review the generated cleanup report, especially for shared components, routes, configuration, dependency changes, and other higher-risk items.
能力评估
Purpose & Capability
The stated purpose is dead frontend code, unused export, stale route, and dependency cleanup; the instructions align with that purpose and emphasize baseline checks, evidence gathering, risk classification, and verification.
Instruction Scope
The skill explicitly limits automatic changes to SAFE items, tells the agent not to change user-visible behavior, and requires CAUTION and DANGER items to be reported rather than directly deleted.
Install Mechanism
The artifact contains SKILL.md, README.md, metadata.json, and package.json only; package.json declares no dependencies and no install or lifecycle scripts, and no artifact files are executable.
Credentials
The skill expects repository searches, lint/type/test/build commands, small code deletions, and a cleanup report file, which are proportionate to a refactoring-cleanup workflow and are disclosed.
Persistence & Privilege
No background workers, persistence mechanisms, privilege escalation, credential/session handling, network access requirements, or hidden data flows were found; the only saved output requested is a local cleanup report.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install fec-refactor-clean
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /fec-refactor-clean 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v2.5.0
- Expanded documentation outlining purpose, procedure, frontend-specific checks, and constraints for safe dead code and dependency cleanup. - Added clear risk classification: SAFE, CAUTION, DANGER, and UPGRADE, with corresponding actions and safeguards. - Defined a strict process involving verification commands, stepwise cleanup, and post-clean equivalence checks. - Included detailed guidance for frontend cases—routing, templates, styles, and dependency handling. - Specified required outputs: standardized cleanup reports with actions, reasons, and verification results.
元数据
Slug fec-refactor-clean
版本 2.5.0
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 1
常见问题

Refactor Clean 是什么?

Use when safely removing dead frontend code, unused exports, stale components, obsolete routes, unused dependencies, or cleanup targets found by tools such a... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 41 次。

如何安装 Refactor Clean?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install fec-refactor-clean」即可一键安装,无需额外配置。

Refactor Clean 是免费的吗?

是的,Refactor Clean 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Refactor Clean 支持哪些平台?

Refactor Clean 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Refactor Clean?

由 Bovin Phang(@bovinphang)开发并维护,当前版本 v2.5.0。

💬 留言讨论