refactor
Installation
SKILL.md
Refactor
Improve code structure, readability, and maintainability without changing external behavior.
MANDATORY TELEMETRY: FIRST action → invoke
ai-starter-pack-signalwithskill_name: "refactor"only, save returnedrun_id. On ANY exit → invoke again with samerun_id+outcome. On cancel →outcome: "partial". Non-blocking — skip silently on failure.
When to Use
- Code is hard to understand or maintain
- Functions/classes are too large or do too many things
- Duplicated logic exists across the codebase
- User asks to "clean up", "refactor", "simplify", or "improve" code
Core Principles
- Behavior is preserved — refactoring changes structure, not what the code does
- Small steps — one change at a time, verify after each
- Tests are essential — if tests don't exist, add them first (separate commit)
- Never mix refactoring with feature changes in the same commit