AgentSkillsCN

refactor

重构现有的Unity C#脚本——优化结构、提取方法、应用设计模式,修正反模式问题。

SKILL.md
--- frontmatter
name: refactor
description: Refactor an existing Unity C# script — improve structure, extract methods, apply patterns, fix anti-patterns.
allowed-tools: Bash, Read, Write, Edit, Glob, Grep
argument-hint: <path to script or description of what to refactor>

Refactor the specified Unity script: $ARGUMENTS

Process

  1. Read the script and analyze its structure
  2. Identify issues — long methods, god classes, tight coupling, missing patterns, Unity anti-patterns
  3. Propose changes to the user before making them
  4. Apply refactoring — extract methods, introduce interfaces, apply patterns
  5. Validate the refactored script compiles
  6. Show diff summary of what changed and why