refactor:nestjs

Refactor NestJS applications into modular, SOLID-compliant architectures.

9|1|Updated Jan 12, 2026
One-click install
npx skills add https://github.com/SnakeO/claude-debug-and-refactor-skills-plugin --skill refactor-nestjs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor:nestjs
Source: https://github.com/SnakeO/claude-debug-and-refactor-skills-plugin/tree/main/plugins/debug-and-refactor/skills/refactor-nestjs
Command: npx skills add https://github.com/SnakeO/claude-debug-and-refactor-skills-plugin --skill refactor-nestjs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams transform tangled NestJS/TypeScript codebases into modular, maintainable, SOLID-compliant architectures by eliminating circular dependencies, god objects, and fat controllers. It guides applying NestJS patterns like modules, providers, decorators, guards, interceptors, pipes, DTOs with class-validator, exception filters, CQRS, repository patterns, and event-driven architecture to improve code quality and scalability.

Core Features & Use Cases

  • Module organization and encapsulation: separates features into cohesive modules with clear boundaries.
  • SRP-driven refactoring: splits large services into focused ones (e.g., AuthService, ProfileService).
  • Pattern enforcement: ensures proper use of guards, interceptors, pipes, DTOs, error handling, and CQRS.
  • Use Case: You have a monolithic NestJS app with a bloated User service; use this Skill to extract responsibilities into discrete modules and services, clean DTOs, and implement guards and interceptors for cross-cutting concerns.

Quick Start

Run a linted, rule-based refactor plan by applying the NestJS refactor guidelines to your codebase. Begin with identifying god services, then extract responsibilities into focused services and modules, update controllers to delegate to services, and implement DTOs, guards, interceptors, and CQRS as needed.

Frequently Asked Questions about refactor:nestjs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix circular dependencies in a NestJS application?

Fix circular dependencies in a NestJS application by refactoring monolithic codebases to enforce clear module boundaries. This process eliminates god objects and fat controllers by extracting responsibilities into cohesive, discrete modules with focused services and proper dependency injection.

How do I refactor a bloated NestJS service to follow SOLID design principles?

Refactor a bloated NestJS service by applying Single Responsibility Principle-driven extraction to split large services into focused ones, ensuring clean architecture and improved maintainability across your TypeScript codebase.

What's the best way to implement CQRS patterns in an existing NestJS codebase?

Implement CQRS patterns in an existing NestJS codebase during architectural refactoring to separate read and write operations. This enforces consistent design patterns alongside guards, interceptors, and pipes, improving overall scalability and maintainability.

Can I use guards and interceptors to clean up fat controllers in NestJS?

Yes, you can use guards and interceptors to clean up fat controllers in NestJS. Refactoring delegates cross-cutting concerns to these components alongside pipes and DTOs, allowing controllers to focus purely on routing and service delegation.

Does refactoring a NestJS app require DTO validation with class-validator?

Refactoring a NestJS app enforces DTO validation with class-validator to ensure data integrity. Proper DTOs separate validation logic from services alongside pipes and exception filters, contributing to a SOLID-compliant and maintainable architecture.