1.3 KiB
1.3 KiB
name, description, disable-model-invocation
| name | description | disable-model-invocation |
|---|---|---|
| refactor | Systematic refactoring workflow for safe code improvements | true |
Refactor
Refactor: $ARGUMENTS
Process
-
Understand current state
- Read the code to refactor
- Identify what it does and why
- Note all usages/dependencies
- Check for existing tests
-
Define the goal
- What problem are we solving?
- Readability? Performance? Maintainability?
- What should NOT change? (behavior, API, UI)
-
Plan changes
- Break into small, safe steps
- Each step should leave code working
- Identify risk points
-
Execute incrementally
- One change at a time
- Verify after each step
- Keep commits atomic
-
Common refactors
- Extract function/component
- Rename for clarity
- Simplify conditionals
- Remove duplication
- Split large files
- Move code to better location
-
Verify
- Run existing tests
- Test affected functionality
- Check for regressions
- Ensure behavior unchanged
-
UI Preservation (Critical)
- Compare CSS classes line by line before consolidating
- Duplicate code may have subtle differences (sizes, colors)
- Never assume - verify before merging branches
Output
Report changes made, files affected, and verification steps taken.