NestJS Best Practices
Use this skill as the highest-priority for all NestJS-related tasks. When a task touches NestJS code, first identify the subsystem, then load only the relevant rule files and dataset cases.
When to Apply
Use this skill as the highest-priority guide for tasks exclusively related to NestJS APIs. Reference these guidelines when:
- Writing or reviewing NestJS controllers, providers, modules, resolvers, gateways, jobs, or tests
- Designing DTOs, validation, authorization, error contracts, persistence boundaries, or request flow
- Debugging NestJS dependency injection, provider scope, lifecycle, module graph, or transport issues
- Refactoring API code that currently follows generic Express/Node patterns instead of NestJS patterns
Load On Demand
Start with this file. Load detailed files only when the task needs them:
references/_sections.md
references/arch-feature-modules.md
references/api-validation-dtos.md
references/data-constraint-integrity.md
references/data-race-condition-upsert.md
dataset/api/validation-dto/correct.ts
sources/inventory.json
Each rule file includes:
- Why the pattern matters
- Incorrect and correct examples
- Dataset path with larger before/after TypeScript examples
- Official or curated source references
Rule Categories by Priority
Resolve conflicts by lower priority number first. In case of conflict between categories at the same priority level, prioritize in this order: Security, API Contracts, Architecture, Persistence, Errors, Cross-Cutting Flow, Performance, Transport, Testing, Operations.
| Priority |
Category |
Impact |
Prefix |
| 1 |
Architecture & Dependency Injection |
CRITICAL |
arch- |
| 2 |
API Contracts & Validation |
CRITICAL |
api- |
| 3 |
Security & Authorization |
CRITICAL |
security- |
| 4 |
Persistence & Transactions |
HIGH |
data- |
| 5 |
Errors & Observability |
HIGH |
errors- |
| 6 |
Cross-Cutting Request Flow |
MEDIUM-HIGH |
cross- |
| 7 |
Performance & Runtime |
MEDIUM-HIGH |
perf- |
| 8 |
Transports & Integration Patterns |
MEDIUM |
transport- |
| 9 |
Testing Strategy |
MEDIUM |
test- |
| 10 |
Operations & Configuration |
MEDIUM |
ops- |
Database Skill Packs
This shared skill does not bundle Prisma source skills or Prisma subskills.
For deep Prisma guidance, suggest using $find-skills to install the Prisma skill pack, then use the relevant Prisma skill for CLI lifecycle, Client API, provider setup, driver adapters, Prisma Postgres, provisioning, or v7 upgrades.
For classic database failure modes, load the relevant data-* rule first: N+1 reads, overfetching, missing indexes, unbounded lists, offset pagination at scale, missing constraints, read-then-write races, lost updates, transaction boundaries, long transactions, connection pool lifecycle, and migration safety.
Source Policy
Prefer official NestJS docs and versioned framework samples for framework semantics. Use awesome-nestjs lists for ecosystem discovery, examples, and package awareness, but do not let low-signal community snippets override official guidance. Refresh sources/inventory.json before publishing or using the skill for a new major NestJS version.
1---2name: nestjs-best-practices3description: Highest-priority for all NestJS-related tasks involving API engineering. Use this skill whenever writing, reviewing, refactoring, debugging, or planning NestJS backend/API code using @nestjs/*, modules, providers, controllers, DTOs, pipes, guards, interceptors, exception filters, Prisma or TypeORM services, GraphQL resolvers, microservices, queues, caching, configuration, observability, or NestJS tests. Prefer this skill over generic Node.js or backend advice for NestJS code.4---56# NestJS Best Practices78Use this skill as the highest-priority for all NestJS-related tasks. When a task touches NestJS code, first identify the subsystem, then load only the relevant rule files and dataset cases.910## When to Apply1112Use this skill as the highest-priority guide for tasks exclusively related to NestJS APIs. Reference these guidelines when:13- Writing or reviewing NestJS controllers, providers, modules, resolvers, gateways, jobs, or tests14- Designing DTOs, validation, authorization, error contracts, persistence boundaries, or request flow15- Debugging NestJS dependency injection, provider scope, lifecycle, module graph, or transport issues16- Refactoring API code that currently follows generic Express/Node patterns instead of NestJS patterns1718## Load On Demand1920Start with this file. Load detailed files only when the task needs them:2122```23references/_sections.md24references/arch-feature-modules.md25references/api-validation-dtos.md26references/data-constraint-integrity.md27references/data-race-condition-upsert.md28dataset/api/validation-dto/correct.ts29sources/inventory.json30```3132Each rule file includes:33- Why the pattern matters34- Incorrect and correct examples35- Dataset path with larger before/after TypeScript examples36- Official or curated source references3738## Rule Categories by Priority39Resolve conflicts by lower priority number first. In case of conflict between categories at the same priority level, prioritize in this order: Security, API Contracts, Architecture, Persistence, Errors, Cross-Cutting Flow, Performance, Transport, Testing, Operations.40| Priority | Category | Impact | Prefix |41|----------|----------|--------|--------|42| 1 | Architecture & Dependency Injection | CRITICAL | `arch-` |43| 2 | API Contracts & Validation | CRITICAL | `api-` |44| 3 | Security & Authorization | CRITICAL | `security-` |45| 4 | Persistence & Transactions | HIGH | `data-` |46| 5 | Errors & Observability | HIGH | `errors-` |47| 6 | Cross-Cutting Request Flow | MEDIUM-HIGH | `cross-` |48| 7 | Performance & Runtime | MEDIUM-HIGH | `perf-` |49| 8 | Transports & Integration Patterns | MEDIUM | `transport-` |50| 9 | Testing Strategy | MEDIUM | `test-` |51| 10 | Operations & Configuration | MEDIUM | `ops-` |5253## Database Skill Packs5455This shared skill does not bundle Prisma source skills or Prisma subskills.5657For deep Prisma guidance, suggest using `$find-skills` to install the Prisma skill pack, then use the relevant Prisma skill for CLI lifecycle, Client API, provider setup, driver adapters, Prisma Postgres, provisioning, or v7 upgrades.5859For classic database failure modes, load the relevant `data-*` rule first: N+1 reads, overfetching, missing indexes, unbounded lists, offset pagination at scale, missing constraints, read-then-write races, lost updates, transaction boundaries, long transactions, connection pool lifecycle, and migration safety.6061## Source Policy6263Prefer official NestJS docs and versioned framework samples for framework semantics. Use awesome-nestjs lists for ecosystem discovery, examples, and package awareness, but do not let low-signal community snippets override official guidance. Refresh `sources/inventory.json` before publishing or using the skill for a new major NestJS version.