nestjs-expert

Creates NestJS modules, controllers, services, DTOs, guards, and tests for TypeScript backends.

Updated Feb 24, 2026
One-click install
npx skills add https://github.com/marketiv-id/marketiv-web --skill nestjs-expert-marketiv-id
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nestjs-expert
Source: https://github.com/marketiv-id/marketiv-web/tree/main/00_BACKEND/.agents/skills/nestjs-expert
Command: npx skills add https://github.com/marketiv-id/marketiv-web --skill nestjs-expert-marketiv-id

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building enterprise-grade NestJS backends requires consistent architecture across modules, dependency injection, validation, authentication, and testing, which is error-prone when done manually without established patterns. ## Core Features & Use Cases - Scaffolding NestJS Building Blocks: Generates modules, controllers, services, and DTOs with proper dependency injection wiring, class-validator decorators, and Swagger documentation. - Security & Validation Patterns: Implements JWT/Passport authentication, role-based guards, global ValidationPipe configuration, and typed HTTP exception handling. - Testing & Migration Guidance: Provides unit test patterns with Test.createTestingModule, E2E tests with supertest, and a complete Express-to-NestJS migration playbook. - Use Case: When adding a new users resource to a NestJS API, invoke this Skill to produce the module, controller with Swagger decorators, service with TypeORM repository injection, validated DTOs, and service unit tests in one pass. ## Quick Start Ask the AI to create a NestJS users module with a controller, service, DTO validation, JWT guard, and unit tests.

Frequently Asked Questions about nestjs-expert

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

FAQPage Schema
How do I create a NestJS controller with DTO validation?

Define a DTO class with class-validator decorators like @IsEmail and @MinLength, then accept it via @Body() in the controller. Enable ValidationPipe globally with whitelist and transform options so validation runs automatically on every request.

How to implement JWT authentication in NestJS with Passport?

Create a JwtStrategy extending PassportStrategy that extracts the Bearer token and validates the payload, then protect routes with a JwtAuthGuard extending AuthGuard('jwt'). Register JwtModule asynchronously with ConfigService so the secret comes from environment variables.

Should I use TypeORM or Prisma with NestJS?

Both integrate with NestJS through dependency injection; TypeORM uses @InjectRepository with Repository patterns shown in this Skill, while Prisma exposes a client service. Choose based on your team's preference for decorator-based entities versus schema-first modeling.

How do I write unit tests for NestJS services?

Use Test.createTestingModule to compile a module with the service and mocked providers, such as a mock repository via getRepositoryToken. Then assert behavior with jest.fn mocks, including error cases like NotFoundException and ConflictException.

When should I migrate from Express to NestJS?

Migrate when the application needs enforced modular architecture, TypeScript dependency injection, and decorator-based validation at scale. Avoid migrating simple CRUD APIs with few endpoints, serverless functions sensitive to cold starts, or quick prototypes where framework overhead is unjustified.

Why does NestJS throw circular dependency errors between modules?

Circular dependencies occur when two modules import each other's providers directly. Restructure module imports and exports first, and use forwardRef() only as a last resort to break the cycle.