What problem does it solve? Codebases accumulate technical debt through duplicated code, long methods, complex conditionals, and poor structure, making them hard to maintain and extend. This Skill systematically identifies code smells and applies safe, incremental refactoring techniques while keeping tests green. ## Core Features & Use Cases - Code Smell Detection: Uses grep-based pattern matching to find long methods, magic numbers, message chains, deep nesting, and duplicated code across JavaScript and TypeScript files. - Six Refactoring Categories: Covers composing methods, moving features between objects, organizing data, simplifying conditionals, simplifying method calls, and generalization with concrete before/after examples. - Safe Incremental Process: Enforces a test-first workflow where each small refactoring is validated by running tests, linting, and type checks before proceeding. - Use Case: When reviewing a legacy module with 50-line functions and nested conditionals, invoke this Skill to get a prioritized refactoring plan with specific techniques like Extract Method and Guard Clauses, applied one step at a time. ## Quick Start Ask the agent to analyze a specific file or module for code smells and suggest safe refactorings, for example: review src/orders.js for code smells and refactor the longest methods while keeping all tests passing.