AgentSkillsCN

refactor-assist

规划安全的重构与代码清理方案。当被要求“重构代码”“进行代码清理”“简化代码”或“降低技术债务”时使用。

SKILL.md
--- frontmatter
name: refactor-assist
description: Plan safe refactors and code cleanups. Use when asked to "refactor", "clean up", "simplify", or "reduce technical debt".

Refactor Assist

Goals

  • Improve structure without changing behavior.
  • Keep steps small and reversible.
  • Preserve compatibility and test coverage.

Workflow

  1. Identify intent: what should stay the same and what can change.
  2. Map dependencies: callers, data contracts, and side effects.
  3. Propose a stepwise plan with checkpoints.
  4. List safety nets: tests to add or run before/after.
  5. Highlight high-risk areas and rollback strategy.

Output Format

  • Intent: short statement of non-goals and constraints.
  • Plan: numbered steps with expected outcome.
  • Risks: bullets with mitigations.
  • Tests: minimal set to confirm no behavior change.