What does this skill do?

The Patrones NestJS Pro Skill provides a robust and scalable NestJS architecture framework for production-ready TypeScript backends. It standardizes the organization of domain modules, lightweight controllers, strict DTO validation with class-validator, authorization guards, global exception filters, and environment configuration validated at startup. With it, Claude generates modular, secure, and production-ready code following NestJS best practices.

Modular Project Structure
Organize the code into domain-specific modules under src/modules/ and cross-cutting code under src/common/.
Validation and Security
Configure the global `ValidationPipe` with a whitelist and `forbidNonWhitelisted`, and implement guards for authorization.
Filters and Interceptors
Centralize error handling with global exception filters and serialize responses with interceptors.
Environment Settings
Validate environment variables at startup using ConfigModule with strict validation schemes.

Usage examples

📦 Generate domain module
Create a NestJS product module with a controller, service, input DTOs, and module, following the skill's modular structure.
🛡️ Configure global validation
Configure ValidationPipe with `whitelist` and `forbidNonWhitelisted` in `main.ts` to validate all routes.
🔀 Create an exception filter
Creates a global exception handler that catches HttpException and returns a JSON object containing the path and error.
⚙️ Validate environment variables
Configure ConfigModule with a validation schema for DATABASE_URL, PORT, and JWT_SECRET at startup.

Features

Domain-Based Modular Architecture Separate domain modules into src/modules/ and cross-cutting code into src/common/ for maximum scalability.
Lightweight controllers and injectable services It keeps controllers focused on HTTP parsing and delegates all business logic to services.
Strict Validation of DTOs Use `class-validator` with a whitelist and `forbidNonWhitelisted` to reject undeclared fields.
Security with guards and filters Implement authorization guards and global exception filters for centralized error handling.
Configuration validated at startup Validate environment variables using ConfigModule and schemas before starting the application.

Frequently asked questions

The skill generates code and architectural patterns. You'll need a NestJS project to apply them to, but Claude can help you create one from scratch.
The skill specifies which packages to use (class-validator, class-transformer, @nestjs/config) and how to configure them, but you must install them in your project using npm or yarn.
The patterns follow current best practices for NestJS v10+. If you're using an earlier version, most of the concepts still apply.
Yes. The proposed structure is a guideline. You can adjust the organization of modules and folders while adhering to the principles of separation of responsibilities.
NestJS Pro Patterns — Production-Ready NestJS Architecture with Claude AI

¿Prefieres escuchar el contenido? Genera la narración de audio con un clic.