Skip to content
cccskills
FreePublished on GitHub

fec-refactor-clean

用于安全移除前端死代码、未使用导出、陈旧组件、废弃路由、未使用依赖,或由 knip、depcheck、ts-prune、TypeScript、ESLint、人工审查发现的清理目标。不要用于会改变行为的功能重写;中文触发词包括 死代码、清理未使用、refactor clean、依赖清理、删除无用代码。

The English summary is being prepared. Showing the original description.

See how to install

Files included (2)

  • SKILL.md3.2 KB
  • references/report-template.md1.1 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

重构清理

用途

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

流程

  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. 对技术债排序:优先清理有验证保护、影响开发效率或阻塞升级的项目;低证据的大范围重写只输出建议。

前端专项检查

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

约束

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

详细参考

撰写清理报告时,加载 references/report-template.md。

预期输出

  • 清理报告保存为 reports/refactor-clean-YYYY-MM-DD-HHmmss.md。
  • 代码清理后相关验证命令通过,或明确说明阻塞原因。

结构重构边界

本工作流只负责已经证明无用/未使用的内容。如果代码仍在运行,问题属于过长函数、职责所有权、可变/派生数据、条件逻辑、API 形态或继承设计等结构重构,应分流到保持行为的结构重构,而不是以“清理”名义删除或重写。

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

用于审查或改进前端无障碍、语义结构、键盘支持、焦点管理、ARIA 标签、屏幕阅读器行为、WCAG 2.2 问题、触控无障碍或辅助技术回归;中文触发词包括 无障碍、accessibility、a11y、WCAG、屏幕阅读器。

The English summary is being prepared. Showing the original description.

bovinphang/frontend-craft22Updated Sep 26, 2026

Use when reviewing or improving frontend accessibility, semantic structure, keyboard support, focus management, ARIA labels, screen reader behavior, WCAG 2.2 issues, touch accessibility, or assistive-technology regressions; Chinese triggers include accessibility, accessibility, a11y, WCAG, screen reader.

The English summary is being prepared. Showing the original description.

bovinphang/frontend-craft22Updated Sep 26, 2026

Use when absorbing ideas, capabilities, workflows, architecture, quality systems, ecosystem extensions, or engineering practices from any reference system into the current project through original, project-native redesign rather than copying.

The English summary is being prepared. Showing the original description.

bovinphang/frontend-craft22Updated Sep 26, 2026

用于从参考系统中吸收想法、能力、工作流、架构、质量体系、生态扩展或工程实践,并通过原创的项目内重设计转化为当前项目能力,而不是复制原实现。

The English summary is being prepared. Showing the original description.

bovinphang/frontend-craft22Updated Sep 26, 2026

用于设计、实现或审查前后端 API 集成、类型化 API client、REST/tRPC/OpenAPI 客户端选型、认证刷新、API 错误映射、上传流程、SSE/WebSocket/轮询选择、CORS 相关前端行为或跨边界 loading/error 状态。不要用于纯后端服务架构或仅 TanStack Query 缓存策略;中文触发词包括 API 集成、前后端联调、typed API client、接口错误处理、SSE、WebSocket。

The English summary is being prepared. Showing the original description.

bovinphang/frontend-craft22Updated Sep 26, 2026

Use when designing, implementing, or reviewing frontend-to-backend API integration, typed API clients, REST/tRPC/OpenAPI client choices, auth refresh, API error mapping, upload flows, SSE/WebSocket/polling choices, CORS-facing frontend behavior, or cross-boundary loading/error states. Do not use for backend-only service architecture or TanStack Query cache policy alone; Chinese triggers include API integration, front-end and back-end joint debugging, typed API client, Interface error handling, SSE, WebSocket.

The English summary is being prepared. Showing the original description.

bovinphang/frontend-craft22Updated Sep 26, 2026

See all skills by bovinphang

Report a problem with this skill