mcpField
N
nestjs-best-practices

nestjs-best-practices

github.com/xirothedevDevelopment288 installsUpdated 24w ago
Repository

About nestjs-best-practices

A prioritized practice guide for developers building and maintaining NestJS APIs. It covers architecture, validation, security, persistence, and request flow, with relevant rules and examples loaded as needed.

Key features

  1. 01Covers modules, controllers, and providers
  2. 02Loads rules and TypeScript examples on demand
  3. 03Prioritizes practice categories by impact
  4. 04Guidance for security, validation, and persistence
  5. 05Favors official and versioned sources

Use cases

  1. 01Design NestJS modules and dependency injection
  2. 02Plan DTOs, validation, and authorization
  3. 03Investigate transaction boundaries and write races
  4. 04Review API error handling and request flow

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/xirothedev/skills --skill nestjs-best-practices

After installing, type/nestjs-best-practicesin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

AGENTS.md
agents/
openai.yaml
dataset/api/validation-dto/
correct.ts
incorrect.ts
notes.md
dataset/arch/feature-module/
correct.ts
incorrect.ts
notes.md
dataset/cross/interceptor-boundary/
correct.ts
incorrect.ts
notes.md
dataset/data/connection-pool-lifecycle/
correct.ts
incorrect.ts
notes.md
dataset/data/constraint-integrity/
correct.ts
incorrect.ts
notes.md
dataset/data/long-transaction-locks/
correct.ts
incorrect.ts
notes.md
dataset/data/migration-safety/
correct.ts
incorrect.ts
notes.md
dataset/data/missing-index/
correct.ts
incorrect.ts
notes.md
dataset/data/n-plus-one/
correct.ts
incorrect.ts
notes.md
dataset/data/offset-pagination/
correct.ts

Details

From the project README

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.

PriorityCategoryImpactPrefix
1Architecture & Dependency InjectionCRITICALarch-
2API Contracts & ValidationCRITICALapi-
3Security & AuthorizationCRITICALsecurity-
4Persistence & TransactionsHIGHdata-
5Errors & ObservabilityHIGHerrors-
6Cross-Cutting Request FlowMEDIUM-HIGHcross-
7Performance & RuntimeMEDIUM-HIGHperf-
8Transports & Integration PatternsMEDIUMtransport-
9Testing StrategyMEDIUMtest-
10Operations & ConfigurationMEDIUMops-

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.

Comments

Markdown supported