AgentSkillsCN

safe-refactor

采用结构化重构方案,辅以防护措施、检查点与回归测试控制。当您需要在不引发行为回归的前提下重新组织或简化代码时使用。

SKILL.md
--- frontmatter
name: safe-refactor
description: Structured refactor execution with guardrails, checkpoints, and regression control. Use when code should be reorganized or simplified without behavior regressions.
metadata: {"keygate":{"requires":{"bins":["git"]}}}

Refactor in small reversible steps.

  1. Define behavior-preserving target and affected boundaries.
  2. Create small edits per step and keep call sites compilable.
  3. Run focused checks after each step.
  4. Keep rollback options explicit (git diff checkpoints).
  5. End with verification summary: what changed, what stayed invariant, and what was validated.