nestjs-best-practices

NestJS conventions for dynamic modules, custom exceptions, Mongoose data access, and feature-module structure. Use when writing or refactoring NestJS code to match this style.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "nestjs-best-practices" with this command: npx skills add nutnut123qq/agent-nestjs-skills/nutnut123qq-agent-nestjs-skills-nestjs-best-practices

NestJS Best Practices

Conventions for NestJS applications using configurable dynamic modules, custom domain exceptions, Mongoose, and feature-based module organization.

When to Apply

  • Writing new NestJS modules, services, or controllers
  • Refactoring existing NestJS code to follow these patterns
  • Implementing authentication, validation, or data access
  • Organizing code by feature (not by technical layer)

Rule Categories

Architecture

  • arch-dynamic-modules — Use ConfigurableModuleBuilder, *-module-definition.ts, and static register() for dynamic modules. See rules/arch-dynamic-modules.md.
  • arch-feature-modules — Organize by feature under src/modules/<feature>/ with *.module.ts, *.module-definition.ts, and index.ts. See rules/arch-feature-modules.md.

Error Handling

Database & Data Access

  • db-mongoose-data-access — Inject Mongoose Connection via custom decorator (e.g. @InjectPrimaryMongoose()), use connection.model(Schema.name). See rules/db-mongoose-data-access.md.

Dependency Injection

API & Validation

  • api-dto-validation — Define DTOs with class-validator decorators (@IsEmail(), @IsString(), etc.) for input validation. See rules/api-dto-validation.md.

Security

  • security-guards — Use Throttler, JWT, and TOTP guards; configure ThrottlerModule with Redis storage where needed. See rules/security-guards.md.

How to Use

Read individual rule files under rules/ for incorrect vs correct examples and detailed guidance.

For the full compiled document with all rules in one file: AGENTS.md (generated by scripts/build-agents.ts).

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

nestjs-best-practices

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

nestjs-best-practices

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

nestjs-best-practices

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

nestjs-best-practices

No summary provided by upstream source.

Repository SourceNeeds Review