Refactoring assessment and patterns. Use after tests pass (GREEN phase) to assess improvement opportunities.
The 'refactoring' skill is designed to help developers assess and improve the structure of their code after the tests pass in the GREEN phase of Test-Driven Development (TDD). Refactoring is a critical step to ensure that code is not only functional but also maintainable, efficient, and clean. This skill focuses on identifying opportunities to simplify, organize, and improve the code without altering its behavior or introducing new features, thus reducing technical debt over time. It is especially useful for ensuring code remains scalable and easy to understand as projects grow and evolve.
Refactoring should always be performed after passing the GREEN phase and when it adds value to the code. It should not be done prematurely or without a clear benefit.
Refactoring should improve the code's structure without changing its behavior. It is appropriate when there are opportunities to improve readability or eliminate unnecessary complexity, but not if the code is already clean and functional.
Refactoring should only be performed when there is a failing test that drives the change. If the refactoring is speculative or not driven by a test, it should be avoided.
Yes, the recommended workflow involves committing working code before starting refactoring, making improvements, and committing the refactored code separately from feature commits to maintain clarity in version history.
Quick Setup:
.claude/skills/Repository
citypaul/.dotfiles