mcpField
N
nestjs

nestjs

github.com/ulpi-ioDevelopment5129 installsUpdated 10w ago
Repository

About nestjs

nestjs is a skill for routing NestJS development tasks through project-specific references and module-based conventions. It is intended for developers and coding agents, with guidance spanning validation, dependency injection, implementation, and verification.

Key features

  1. 01Routes tasks to relevant NestJS references
  2. 02Checks stack decisions before implementation
  3. 03Enforces modular architecture and dependency injection
  4. 04Guides validation, testing, and verification

Use cases

  1. 01Adding or editing a NestJS module
  2. 02Implementing endpoints with DTO validation
  3. 03Working with authentication, queues, or databases

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/ulpi-io/skills --skill nestjs

After installing, type/nestjsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
auth.md
config.md
controllers.md
cqrs.md
docker.md
error-handling.md
health.md
interceptors.md
logging.md
microservices.md
middleware.md
modules.md
openapi.md
pipes.md
prisma.md
project-structure.md
providers.md
queues.md
scheduling.md
stack.md
testing.md
typeorm.md
validation.md
websockets.md

Details

From the project README
This skill is a routing shell over the NestJS reference set.

Non-negotiable rules:

  1. Read references/stack.md first to understand the project's NestJS version, ORM, and locked decisions.
  2. Then load only the references needed for the actual task.
  3. One module per domain — controllers, services, DTOs, and entities live together in their module directory.
  4. Controllers are thin — validate (DTO + pipe), delegate (service), return. No business logic.
  5. All input validated via DTOs — class-validator decorators on every DTO, ValidationPipe globally.
  6. Dependency injection everywhere — never new Service(). Inject via constructor, provide via module.
  7. No circular dependencies — use forwardRef() only as a last resort, prefer restructuring.
  8. Keep the heavy NestJS guidance in references/, not inline here.

nestjs

Inputs

  • $request: The NestJS module, endpoint, subsystem, or feature being worked on

Goal

Route NestJS work through the project's module-based architecture so implementation follows the established patterns for dependency injection, validation, data access, and request lifecycle.

Step 0: Read the stack contract

Always start with:

  • references/stack.md

That establishes: NestJS version, ORM (TypeORM/Prisma/Drizzle), package manager, auth strategy, queue system, and locked dependency choices.

Success criteria: The project's NestJS architecture and locked decisions are explicit before implementation starts.

Step 1: Load only the relevant references

Use the routing table to pick reference files. Do not bulk-load the full reference tree.

TaskRead
NestJS version, ORM, key deps, CLI, project layoutreferences/stack.md
Folder conventions, module organization, barrel exportsreferences/project-structure.md
Creating or editing a modulereferences/modules.md
Controllers, route decorators, request lifecyclereferences/controllers.md
Services, providers, dependency injectionreferences/providers.md
DTOs, class-validator, ValidationPipe, transformationreferences/validation.md
TypeORM entities, repositories, migrationsreferences/typeorm.md
Prisma integration with NestJSreferences/prisma.md
Guards, authentication, authorization, JWT, Passportreferences/auth.md
Interceptors, logging, caching, response mappingreferences/interceptors.md
Pipes, custom validation, parameter transformationreferences/pipes.md
Exception filters, custom exceptions, error responsesreferences/error-handling.md
BullMQ queues, processors, flowsreferences/queues.md
WebSocket gateways, events, roomsreferences/websockets.md
Microservices, transports, message patternsreferences/microservices.md
OpenAPI/Swagger decorators, schema generationreferences/openapi.md
Unit tests, e2e tests, testing module, mockingreferences/testing.md
Configuration, ConfigModule, env validationreferences/config.md
Middleware, lifecycle hooks, shutdownreferences/middleware.md
Logging with pino or built-in loggerreferences/logging.md
Health checks, Terminusreferences/health.md
CQRS, events, sagasreferences/cqrs.md
Scheduling, cron jobs, intervalsreferences/scheduling.md
Docker, deployment, production setupreferences/docker.md

Multiple tasks? Read multiple files. The references are self-contained.

Success criteria: Only the task-relevant NestJS conventions are in play.

Step 2: Implement with the core NestJS guardrails

Keep these rules active:

  • every module declares its controllers, providers, imports, and exports explicitly
  • controllers validate via DTOs + ValidationPipe, delegate to services, return typed responses
  • services contain business logic, injected via constructor — never instantiated with new
  • entities/models are separate from DTOs — never return a raw entity from a controller
  • guards handle auth/authz, interceptors handle cross-cutting concerns, pipes handle transformation
  • all external input has a DTO with class-validator decorators
  • database mutations wrapped in transactions where atomicity matters
  • use @nestjs/config with Zod or Joi validation for env vars

Success criteria: The change fits the project's NestJS module architecture instead of bypassing the framework.

Step 3: Verify the affected surface

Use the narrowest relevant verification:

  • unit tests (jest --testPathPattern=<module>)
  • e2e tests (jest --config test/jest-e2e.json)
  • type checking (tsc --noEmit)
  • linting (eslint .)
  • OpenAPI spec regeneration if decorators changed

Success criteria: The changed NestJS surface still builds, type-checks, and passes tests.

Guardrails

  • Do not inline the whole NestJS handbook in SKILL.md.
  • Do not skip references/stack.md.
  • Do not put business logic in controllers — delegate to services.
  • Do not return raw entities — use DTOs or serialization interceptors.
  • Do not bypass dependency injection — never new Service().
  • Do not create circular module dependencies without exhausting alternatives first.
  • Do not use @nestjs/common barrel imports for types — import from specific subpaths when possible.
  • Do not add disable-model-invocation; this is a normal domain skill.

When To Load References

  • references/stack.md Always.

  • then only the task-relevant files under references/

Output Contract

Report:

  1. which NestJS references were loaded
  2. the module and architecture pattern chosen
  3. the change made
  4. the verification run

Comments

Markdown supported