| name | safe-refactor-checklist |
| description | Checklist for safe code refactoring without breaking changes |
| license | MIT |
Safe Refactor Checklist
When to Use
- Refactoring existing code
- Improving code structure
- Reducing technical debt
- Optimizing performance
Pre-Refactor Checklist
During Refactor
1. Make Small Changes
- One refactoring at a time
- Run tests after each change
- Commit frequently
2. Preserve Behavior
- Don't change public interfaces
- Keep the same inputs/outputs
- Maintain backward compatibility
3. Update Tests
- Update tests if behavior changes
- Add tests for new code paths
- Remove obsolete tests
Post-Refactor Checklist
Common Refactoring Patterns
Extract Method
function process(data) {
}
function process(data) {
validate(data);
const result = processData(data);
return formatResult(result);
}
Rename Variable
- Use IDE refactoring tools
- Update all references
- Run tests to verify
Move Method
- Update imports
- Check for circular dependencies
- Verify all callers updated