NestJS patterns for DI scopes, validation pipes, the request lifecycle, serialization, CORS and CSRF, and 12 upgrades. Load before any edit in a NestJS app, however small, and for NestJS questions.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Nestjs Patterns?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ku5ic-nestjs-patterns)
---
name: nestjs-patterns
description: NestJS patterns for DI scopes, validation pipes, the request lifecycle, serialization, CORS and CSRF, and 12 upgrades. Load before any edit in a NestJS app, however small, and for NestJS questions.
---
# NestJS patterns
Default assumption: NestJS 12.6, per the NestJS releases on GitHub.
A row applies when the `@nestjs/core` version in the project's `package.json` and lockfile is at least its version, and a satellite package's row when that package is. 12 is `latest` on npm and 11 is `legacy`. 12 runs on Node 20.19 or 22.12 and later, not 21. TypeScript itself is typescript-patterns, and Express is express-patterns.
## Reference files
Loading this skill isn't enough. Before your next edit, read the file of every row that matches it. The rules live in those files, and this one only points at them.
| Before | Read |
| -------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| Writing NestJS code, or raising the version of `@nestjs/*` or Node | [reference/upgrades.md](reference/upgrades.md) |
| Writing, changing, or reviewing NestJS code or its security setup | [reference/anti-patterns.md](reference/anti-patterns.md) |
| Writing a provider, a module, a pipe, a guard, a filter, middleware, config, or a test | [reference/practices.md](reference/practices.md) |
| Configuring or running oxlint, ESLint, or the TypeScript compiler on a NestJS app | [reference/tooling.md](reference/tooling.md) |