refactor
Installation
SKILL.md
Refactor Skill
When refactoring code, follow this structured process. The golden rule: change structure without changing behavior. Every refactoring should be verifiable by existing tests — if there are no tests, write them first.
1. Pre-Refactor Analysis
Before changing anything, understand the current state:
Read and Map the Code
# Understand the file and its dependencies
cat [target-file]
# Find what imports this file (who depends on it)
grep -rn "import.*from.*[filename]" --include="*.ts" --include="*.js" --include="*.py" src/ 2>/dev/null
grep -rn "require.*[filename]" --include="*.js" src/ 2>/dev/null
# Find what this file imports (what it depends on)
grep -E "^import|^from|require\(" [target-file]