NestJS Expert
Enterprise NestJS: modular TypeScript backends.
When to use
NestJS REST or GraphQL services; DI + modular architecture; JWT/Passport auth; TypeORM or Prisma; guards, interceptors, pipes, validation; Swagger docs; unit/E2E tests.
Core workflow
- Analyze — domain modules, boundaries, data layer.
- Design — modules per bounded context; DTOs with class-validator.
- Implement — controllers (thin) → services (logic) → repositories; DI throughout.
- Cross-cutting — guards (authz), interceptors (logging/transform), pipes (validation).
- Test — Jest unit tests + Supertest E2E.
Key practices
- One module per feature; export only what other modules need.
- DTOs validated by
ValidationPipe + class-validator decorators.
- Guards for auth (JWT via Passport strategy);
@UseGuards.
- Interceptors for response shaping, logging, caching.
- TypeORM/Prisma repositories injected into services; never query in controllers.
@nestjs/swagger decorators for OpenAPI.
Constraints
MUST: thin controllers, logic in services; DI for all dependencies; global ValidationPipe + DTO validation; guards for protected routes; module boundaries respected; unit + E2E tests.
MUST NOT: business logic in controllers; direct DB access outside repositories/services; skip DTO validation; circular module dependencies; secrets in code (use ConfigModule/env).
Output
- Module + DTOs (class-validator). 2. Controller + service + repository. 3. Guards/interceptors/pipes. 4. Jest + Supertest tests. 5. Brief note on module design.
Knowledge
NestJS, dependency injection, modules/controllers/providers, DTOs, class-validator, guards/interceptors/pipes, Passport/JWT, TypeORM, Prisma, @nestjs/swagger, Jest, Supertest.
1---2name: nestjs-expert3description: "Use when building NestJS REST or GraphQL backends — modules, controllers, services, DTOs, guards, interceptors, pipes, JWT/Passport auth, TypeORM/Prisma. Invoke for .module.ts/.controller.ts/.service.ts files. Triggers: NestJS, Nest, Node.js backend, TypeScript backend, dependency injection, controller, service, module, guard, interceptor."4version: 1.0.05license: MIT6tags: [nestjs, nodejs, typescript, dependency-injection, guards, typeorm, prisma, jwt]7source: https://github.com/jeffallan/claude-skills/tree/main/skills/nestjs-expert8derived_from: awesomeclaude9metadata:10 source: https://skillmd.com/skills/aashutosh396/nestjs-expert11---1213# NestJS Expert1415Enterprise NestJS: modular TypeScript backends.1617## When to use1819NestJS REST or GraphQL services; DI + modular architecture; JWT/Passport auth; TypeORM or Prisma; guards, interceptors, pipes, validation; Swagger docs; unit/E2E tests.2021## Core workflow22231. **Analyze** — domain modules, boundaries, data layer.242. **Design** — modules per bounded context; DTOs with class-validator.253. **Implement** — controllers (thin) → services (logic) → repositories; DI throughout.264. **Cross-cutting** — guards (authz), interceptors (logging/transform), pipes (validation).275. **Test** — Jest unit tests + Supertest E2E.2829## Key practices3031- One module per feature; export only what other modules need.32- DTOs validated by `ValidationPipe` + class-validator decorators.33- Guards for auth (JWT via Passport strategy); `@UseGuards`.34- Interceptors for response shaping, logging, caching.35- TypeORM/Prisma repositories injected into services; never query in controllers.36- `@nestjs/swagger` decorators for OpenAPI.3738## Constraints3940MUST: thin controllers, logic in services; DI for all dependencies; global `ValidationPipe` + DTO validation; guards for protected routes; module boundaries respected; unit + E2E tests.41MUST NOT: business logic in controllers; direct DB access outside repositories/services; skip DTO validation; circular module dependencies; secrets in code (use ConfigModule/env).4243## Output44451. Module + DTOs (class-validator). 2. Controller + service + repository. 3. Guards/interceptors/pipes. 4. Jest + Supertest tests. 5. Brief note on module design.4647## Knowledge4849NestJS, dependency injection, modules/controllers/providers, DTOs, class-validator, guards/interceptors/pipes, Passport/JWT, TypeORM, Prisma, @nestjs/swagger, Jest, Supertest.