What problem does it solve? Legacy codebases accumulate code smells like long methods, deeply nested conditionals, and magic numbers that slow down development and increase bug risk. This Skill provides concrete refactoring patterns and a safe process for cleaning up code without altering its behavior. ## Core Features & Use Cases - Code Smell Detection: Identifies common problems such as long methods, arrow code, primitive obsession, and feature envy with before-and-after TypeScript examples. - Refactoring Techniques: Covers extract method, replace conditional with polymorphism, introduce parameter object, and replace magic numbers with constants. - Safe Refactoring Process: Enforces a test-first workflow with small incremental changes, frequent commits, and a completion checklist. - Use Case: When preparing to add a feature to a tangled legacy module, use this Skill to restructure the code first so the new change becomes straightforward and regression-safe. ## Quick Start Refactor the getDiscount function in my order module to remove deeply nested conditionals using guard clauses.