What problem does it solve? Large NestJS feature modules accumulate dead code, any types, console statements, duplicated logic, and inconsistent naming over time, and manual cleanup is error-prone because each change can break the build. This Skill performs a deep, context-aware refactor of an entire module in controlled phases, with a build and ESLint verification gate after every phase so breakage never cascades. ## Core Features & Use Cases - Phased refactoring pipeline: Nine phases covering dead code removal, type safety (eliminating any/unknown, extracting inline interfaces), console-to-Logger replacement, magic string/number extraction, error handling audits, SQL parameterization, duplicate code extraction, naming conventions, and NestJS best practices. - Verification gates with self-healing: Every phase ends with npm run build plus ESLint on touched files, with an automatic fix-and-retry loop (max 3 attempts) before stopping to report. - Discovery report before changes: Phase 0 is read-only, producing a full issue inventory and planned actions that require user confirmation before any code is modified. - Use Case: Run /refactor-module review on a legacy NestJS module to remove unused imports, replace throw new Error() with proper HttpExceptions, parameterize unsafe raw SQL, and receive a dated markdown report of all changes and metrics. ## Quick Start Ask the assistant to run /refactor-module followed by your module name, for example: refactor the dashboard module and confirm the discovery report before applying changes.