Nestjs
Reference skill for NestJS — the progressive, TypeScript-first Node.js framework.
npx -y skills add iamursky/nestjs-skill --skill nestjsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Build server-side applications with NestJS (Nest) — the progressive, TypeScript-first Node.js framework. Use when working with `@nestjs/*` packages, the `nest` CLI (`nest new`, `nest g`), or any NestJS building block: controllers & routing (`@Controller`, `@Get`/`@Post`), providers & dependency injection (`@Injectable`, custom providers, injection scopes), modules (`@Module`, dynamic/shared/global modules), and the request pipeline — middleware, guards (`@UseGuards`), interceptors, pipes & validation (`ValidationPipe`, class-validator), exception filters, and custom decorators. Covers configuration (`@nestjs/config`), databases (TypeORM, Sequelize, Mongoose, Prisma, MikroORM), techniques (caching, queues/BullMQ, scheduling, events, logging, serialization, versioning, file upload, SSE), security (Passport/JWT auth, RBAC/CASL authorization, helmet, CORS, CSRF, rate limiting/throttler), GraphQL (code-first & schema-first, Apollo, federation), WebSockets (gateways), microservices (TCP/Redis/Kafka/NATS/MQTT/RabbitMQ/gRPC transporters), OpenAPI/Swagger, testing (`@nestjs/testing`), and deployment. Targets NestJS v11.
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
14.4 KB, ~3.2k tokens by cl100k_base, as published. Nobody here has run it
NestJS — progressive Node.js framework
NestJS is a framework for building efficient, scalable server-side Node.js applications.
It is TypeScript-first (works with plain JS too), heavily modular, and built around
dependency injection. Under the hood it runs on a pluggable HTTP platform — Express
(default, @nestjs/platform-express) or Fastify (@nestjs/platform-fastify) — and the
same building blocks also power GraphQL, WebSocket, and microservice apps. Its
architecture is heavily inspired by Angular: decorators + DI + modules.
This skill is a faithful offline copy of the official NestJS documentation. The narrative below
is the map; open the matching file under references/ for exact APIs, options, and full
detail. Start navigation at references/CONTENTS.md. Targets
NestJS v11; the live docs are at https://docs.nestjs.com.
Mental model — three building blocks
- Modules organize the app. Every app has a root
AppModule; features get their own module. A@Module({ imports, controllers, providers, exports })declares what it owns and what it shares. →references/modules.md. - Providers hold logic and are wired by dependency injection. Mark a class
@Injectable(), list it in a module'sproviders, and inject it via the constructor. Most "services", repositories, factories, and helpers are providers. →references/components.md(providers) andreferences/fundamentals/dependency-injection.md(custom providers). - Controllers handle incoming requests and return responses. Decorators map routes to
handler methods. →
references/controllers.md.
import { Controller, Get } from '@nestjs/common';
import { CatsService } from './cats.service';
@Controller('cats')
export class CatsController {
constructor(private readonly catsService: CatsService) {} // DI by type
@Get()
findAll() {
return this.catsService.findAll();
}
}
import { Module } from '@nestjs/common';
@Module({
controllers: [CatsController],
providers: [CatsService], // available for DI within this module
exports: [CatsService], // share with modules that import this one
})
export class CatsModule {}
Setup & the entry point
$ npm i -g @nestjs/cli # the Nest CLI
$ nest new project-name # scaffold (asks package manager; --strict for strict TS)
$ nest g resource cats # generate a CRUD module+controller+service+DTOs
main.ts bootstraps the app with NestFactory:
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
await app.listen(process.env.PORT ?? 3000);
}
bootstrap();
→ references/first-steps.md. For a non-HTTP app (CLI/cron/worker),
use NestFactory.createApplicationContext → references/application-context.md.
The CLI itself: references/cli/overview.md (monorepo
workspaces, libraries).
The request pipeline (canonical order)
This is the single most important thing to get right. A request flows through cross-cutting components in a fixed order; globals run, then controller-bound, then route-bound (filters are the exception — they resolve route → controller → global):
- Middleware — global, then module-bound (Express-style; runs before guards). →
references/middlewares.md - Guards — authorization/authentication "can this proceed?" →
references/guards.md - Interceptors (pre) — wrap the handler; can transform/observe. →
references/interceptors.md - Pipes — validate & transform inputs (params/body/query). →
references/pipes.md - Route handler — your controller method calls providers.
- Interceptors (post) — map/observe the response (RxJS, last-in-first-out).
- Exception filters — only on an uncaught error; format the response. →
references/exception-filters.md
Bind any of them at three levels: global (app.useGlobalX() or an APP_* provider token),
controller (decorator on the class), or route (decorator on the method). Read the exact
ordering rules — especially for pipes & interceptors — in references/faq/request-lifecycle.md.
Build your own request-shaped logic with custom decorators
and the execution context (ExecutionContext,
Reflector for reading metadata set by @SetMetadata).
Dependency injection & fundamentals
DI is resolved by type (the constructor param's class) or by token (@Inject(TOKEN)).
A provider is visible only within its module unless exports-ed and the consumer's module
imports it.
- Custom providers —
useClass/useValue/useFactory(withinject) /useExisting, and non-class tokens. →references/fundamentals/dependency-injection.md - Async providers —
useFactoryreturning a Promise (e.g. wait for a DB connection). →references/fundamentals/async-components.md - Dynamic modules —
Module.forRoot()/forFeature()configurable modules. →references/fundamentals/dynamic-modules.md - Injection scopes —
DEFAULT(singleton),REQUEST,TRANSIENT. Request scope has a perf cost and bubbles up. →references/fundamentals/provider-scopes.md - Circular dependency — break with
forwardRef(). →references/fundamentals/circular-dependency.md - Module reference — resolve providers imperatively with
ModuleRef. →references/fundamentals/module-reference.md - Lifecycle hooks —
OnModuleInit,OnApplicationBootstrap,OnModuleDestroy,OnApplicationShutdown(enable shutdown hooks for the last). →references/fundamentals/lifecycle-events.md - Also: lazy-loading modules, discovery service, platform agnosticism.
Validation, configuration & databases
- Validation — the global
ValidationPipe+class-validator/class-transformerdecorators on DTOs (whitelist,transform,forbidNonWhitelisted). →references/techniques/validation.md - Configuration —
@nestjs/configConfigModule.forRoot()+ConfigService,.env, validation schema, namespaced config. →references/techniques/configuration.md - SQL (TypeORM / Sequelize) —
@nestjs/typeorm,forRoot/forFeature, repositories, entities. →references/techniques/sql.md· recipes: TypeORM, Sequelize, Prisma, MikroORM. - MongoDB (Mongoose) —
@nestjs/mongoose, schemas, models. →references/techniques/mongo.md
More techniques
Caching · Queues / BullMQ ·
Task scheduling / cron · Events ·
Logger · Serialization (ClassSerializerInterceptor) ·
Versioning · File upload ·
Streaming files · Server-Sent Events ·
Cookies · Sessions ·
Compression · HTTP module (HttpService/axios) ·
MVC · Performance (Fastify).
Security
Authentication (Passport strategies, JWT, @nestjs/passport/@nestjs/jwt; full Passport recipe: references/recipes/passport.md) ·
Authorization (RBAC, claims, CASL) ·
Rate limiting (@nestjs/throttler) ·
Helmet · CORS · CSRF ·
Encryption & hashing. Auth is typically a guard;
authorization combines a guard with metadata read via Reflector.
GraphQL, WebSockets & microservices
- GraphQL —
@nestjs/graphqlwith the Apollo (or Mercurius) driver; code-first (decorators + generated SDL) or schema-first. Resolvers, mutations, subscriptions, federation. →references/graphql/quick-start.mdand the rest ofreferences/graphql/. - WebSockets —
@WebSocketGateway()gateways (socket.io or ws), with the same guards/pipes/interceptors/filters model. →references/websockets/gateways.md. - Microservices —
@nestjs/microservices; choose a transporter (TCP, Redis, NATS, MQTT, RabbitMQ, Kafka, gRPC) and use@MessagePattern(request-response) vs@EventPattern(event). →references/microservices/basics.mdand the per-transport pages.
OpenAPI, testing & deployment
- OpenAPI / Swagger —
@nestjs/swaggerSwaggerModule,@ApiProperty()etc., and the CLI plugin that auto-infers schemas. →references/openapi/introduction.md. - Testing —
@nestjs/testingTest.createTestingModule(...),.overrideProvider(...), unit + e2e (supertest). →references/fundamentals/unit-testing.md· Automock/Suites. - Deployment →
references/deployment.md; serverless →references/faq/serverless.md; Devtools graph →references/devtools/overview.md.
Recipes
Task-oriented guides: references/recipes/ — CRUD generator, REPL, CQRS,
SWC builder, hot reload, health checks (Terminus), Sentry, serve-static, router module,
nest-commander, async local storage, Compodoc, and more. Browse references/CONTENTS.md.
Gotchas
- "Nest can't resolve dependencies of X" — the dependency isn't a
providerin the current module, or its owning module doesn'texportsit and isn'timports-ed. Check the module graph first. →references/faq/errors.md - Decorators need TS config —
experimentalDecorators+emitDecoratorMetadata, andreflect-metadataimported once. DI by type relies on emitted metadata. - Global pipes/guards/etc. set via
app.useGlobalX()can't inject — to use DI in a global, register it as anAPP_PIPE/APP_GUARD/APP_INTERCEPTOR/APP_FILTERprovider instead. ValidationPipedoes nothing useful without DTOs decorated withclass-validator, and needstransform: trueto instantiate DTO classes / coerce types. Usewhitelistto strip unknown props.- Circular
imports/providers — useforwardRef()on both sides; prefer restructuring. - Request-scoped providers make the whole injection chain request-scoped — measurable overhead; keep them shallow.
- Pipe & interceptor binding order is not simply top-to-bottom — parameter pipes resolve
last-param-to-first; read
references/faq/request-lifecycle.md. - Keep
@nestjs/*versions aligned (core/common/platform and the ecosystem packages move together across majors). This bundle targets v11.
Provenance
references/ is converted from the official nestjs/docs.nestjs.com
content/ source (the same Markdown that powers https://docs.nestjs.com) by
tools/build_references.py — the TS/JS @@switch snippets are reduced to their canonical
TypeScript form, promo banners are dropped, and links are absolutized to the live site.
Every page keeps a > Source: link to its upstream file on GitHub. Redistributed under the
upstream MIT license (Kamil Myśliwiec) — see references/LICENSE.
Gives 0 of the 12 instructions most project setup skills give in ~3.2k tokens
Counted across 999 of the 1,637 authors here whose files we hold, read 2026-08-06
- ask one question at a timein 29 of 999, across 28 files
- detect the package manager from lockfilesin 28 of 999, across 9 files
- present findings to the userin 25 of 999, across 4 files
- explore current repo statein 24 of 999, across 3 files
- update the agent skills block in place if it existsin 24 of 999, across 3 files
- install husky lint-staged and prettierin 23 of 999, across 4 files
- create the lintstagedrc filein 22 of 999, across 3 files
- commit all changed filesin 22 of 999, across 3 files
- run lint-staged to verify it worksin 22 of 999, across 3 files
- initialize huskyin 21 of 999, across 2 files
- create the husky pre-commit filein 21 of 999, across 2 files
- create a prettierrc file if missingin 21 of 999, across 2 files
Said here and by no other author read
- open matching reference files for exact APIs
- use the nest cli to scaffold projects and resources
- organize application features into modules
- wire application logic via dependency injection
- handle incoming requests using controllers
- order request pipeline components correctly
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.