What problem does it solve? Large NestJS service files accumulate technical debt: promise chains, console.log calls, raw SQL injection risks, duplicated logic, and god-classes mixing many concerns. This Skill applies a structured, phase-gated refactoring process that cleans up one service file at a time without breaking the build. ## Core Features & Use Cases - Phased refactoring with verification gates: Discovery, async/await migration, code cleanup, error handling and SQL safety, optional decomposition, and reporting — each phase ends with a build + ESLint + Prettier gate and a self-healing retry loop. - Auto-detected service decomposition: Analyzes line count, dependency injections, and concern groupings to recommend splitting a service into a facade plus sub-services, with --no-split and --force-split overrides. - SQL safety and simplification: Parameterizes unsafe raw queries, replaces inline SQL with existing stored procedures, and converts simple queries to TypeORM find() or QueryBuilder. - Use Case: Run it on a 1,500-line NestJS service full of .then() chains and interpolated SQL; it migrates to async/await, replaces console.log with NestJS Logger, parameterizes queries, extracts interfaces and constants, and produces a change report. ## Quick Start Ask Claude Code to run /refactor-service on a target service, for example: refactor the review service in my NestJS backend.