nestjs-best-practices

Audit NestJS architecture, dependency injection, security, and performance standards.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/johnnystefan/test-saas-business --skill nestjs-best-practices-johnnystefan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nestjs-best-practices
Source: https://github.com/johnnystefan/test-saas-business/tree/main/skills/nestjs-best-practices
Command: npx skills add https://github.com/johnnystefan/test-saas-business --skill nestjs-best-practices-johnnystefan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

NestJS teams often lack a centralized, prioritized guide for architecture, dependency injection, security, performance, and testing standards across multiple services, so this document captures 40 high-impact rules that steer every change toward production readiness.

Core Features & Use Cases

  • Priority-ordered rule categories: Ten categories from critical architecture and DI guardrails down to deployment hygiene help teams triage focus areas for writing, reviewing, or refactoring NestJS services.
  • Actionable patterns: Includes directives like avoiding circular dependencies, enforcing constructor injection, centralizing exception handling, validating input, caching, and API versioning for consistent best practices.
  • Reference-ready workflow: Provides rule-specific files and a compiled AGENTS.md master document so reviewers and authors can quickly align on architecture, security, and DevOps expectations when working across gateways, auth, club, inventory, booking, and finance services.

Quick Start

Invoke the guide to evaluate NestJS modules for architecture, DI, security, and performance compliance before merging any production changes.

Frequently Asked Questions about nestjs-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What are the most critical NestJS architecture and dependency injection patterns for production readiness?

Critical NestJS production patterns include enforcing constructor injection, avoiding circular dependencies, and centralizing exception handling. These architecture and dependency injection guardrails ensure modules remain testable, maintainable, and uniformly structured across multiple microservices.

How do I audit a NestJS microservices project for security and performance best practices?

Audit NestJS microservices by validating input, implementing caching strategies, and enforcing API versioning. Reviewing code against documented rule files across API gateway, auth, and finance services ensures uniform security and performance standards before production deployment.

What is the best way to standardize testing and DevOps workflows across multiple NestJS services?

Standardize testing and DevOps workflows by compiling an AGENTS.md master document from priority-ordered rule categories. This reference-ready workflow aligns reviewers and authors on deployment hygiene and testing expectations across gateway, club, inventory, and booking services.

Does this NestJS best practices guide apply to both monolithic applications and microservices architectures?

Yes, the best practices guide applies to both monolithic and microservices NestJS architectures. It audits API gateway, admin gateway, auth, club, inventory, booking, and finance services, enforcing uniform production standards whenever NestJS code is written, reviewed, or refactored.

How to avoid circular dependencies and enforce proper dependency injection in NestJS modules?

Avoid circular dependencies in NestJS by strictly enforcing constructor injection and organizing modules by bounded context. The guide's critical architecture and dependency injection guardrails provide actionable directives to triage focus areas and maintain structured code quality.

When should I not use centralized exception handling in a NestJS API gateway?

Centralized exception handling should not be bypassed when custom error trapping is needed, as the guide mandates centralizing it to maintain uniform production standards. Deviating from documented rule files breaks the structured code quality expected across auth and finance services.