using-nestjs-pipes-guards-interceptors
Installation
SKILL.md
Using NestJS Pipes, Guards, Interceptors
When to use
- Implementing authentication/authorization
- Adding logging, caching, response shaping
- Cross-cutting concerns that shouldn't live in controllers
Core rules
- Pipes: transform/validate input (use
ValidationPipeglobally) - Guards: authenticate/authorize requests (
AuthGuard,RolesGuard) - Interceptors: transform responses, log, cache, timeout (
ClassSerializerInterceptor) - Implement as
@Injectable()classes, register globally or at controller/route level - No logic in controllers that belongs in these cross-cutting components