Automated Refactoring & Test Safety

•
5
•

Executes structured, autonomous code cleanup and architectural improvements while strictly maintaining test integrity.

The Refactor skill provides a rigorous, multi-stage framework for improving code quality without introducing regressions. It guides Claude through a systematic process—Prep, Main Refactoring, Final Evaluation, and Summary—that prioritizes test safety and self-documenting code. By enforcing a strict policy where test assertions remain untouched and every change is validated by a test suite, it ensures that code remains functional throughout the transformation. The skill autonomously identifies cleanup opportunities like dead code removal, method extraction, and domain-driven renaming, while maintaining a detailed REFACTORING_SUMMARY.md and creating granular, traceable commits.

Key Features

01Autonomous multi-stage refactoring process (Prep, Refactor, Evaluate, Summary)
02Strict test safety protocol that preserves assertions and logic
035 GitHub stars
04Incremental 'Refactor-Test-Commit' workflow with granular commit history
05Domain-driven code cleanup including method extraction and dead code removal
06Automatic generation of a detailed REFACTORING_SUMMARY.md audit trail

Use Cases

01Safely removing dead code and unhelpful comments while verifying against existing tests
02Standardizing naming conventions and abstraction levels across a codebase
03Simplifying complex legacy functions before implementing new features