Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
kadajett avatar

Nestjs Best Practices

  • 23.3k installs
  • 232 repo stars
  • Updated July 23, 2026
  • kadajett/agent-nestjs-skills

NestJS Best Practices is an agent skill for building and optimizing Node.js backend applications using the NestJS framework with established architectural patterns.

About

NestJS Best Practices is an agent skill providing structured guidance for building backend applications with the NestJS framework. It covers architecture, dependency injection, error handling, security, performance, testing, database patterns, API design, microservices, and DevOps. Developers use it when building scalable Node.js backend services or when refactoring applications to follow established NestJS patterns.

  • 10 structured sections covering NestJS architecture and patterns
  • Supported by 6 agentic platforms including Claude Code and Cursor
  • Rule-based format with clear incorrect/correct examples

Nestjs Best Practices by the numbers

  • 23,268 all-time installs (skills.sh)
  • +812 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #46 of 4,386 Backend & APIs skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

nestjs-best-practices capabilities & compatibility

Capabilities
architecture design · error handling · security patterns · performance optimization · testing · database design · api design · microservices
From the docs

What nestjs-best-practices says it does

A structured repository for creating and maintaining NestJS Best Practices optimized for agents and LLMs.
README.md
npx skills add https://github.com/kadajett/agent-nestjs-skills --skill nestjs-best-practices

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs23.3k
repo stars232
Security audit3 / 3 scanners passed
Last updatedJuly 23, 2026
Repositorykadajett/agent-nestjs-skills

What are NestJS production architecture best practices?

Build scalable backend applications following NestJS architectural best practices

Who is it for?

TypeScript backend developers writing or reviewing NestJS APIs who want enforced module, DI, security, and performance patterns.

Skip if: Teams on Express-only stacks or front-end React projects without a NestJS server layer.

When should I use this skill?

User writes, reviews, or refactors NestJS modules, controllers, services, guards, or interceptors.

What you get

Refactored NestJS modules, DI-correct services and controllers, and code aligned to 40 prioritized rules.

  • refactored NestJS source files
  • architecture-compliant module structure

By the numbers

  • 10 sections covering architecture, DI, error handling, security, performance, testing, database, API design, microservic

Files

SKILL.mdMarkdownGitHub ↗

NestJS Best Practices

Comprehensive best practices guide for NestJS applications. Contains 40 rules across 10 categories, prioritized by impact to guide automated refactoring and code generation.

When to Apply

Reference these guidelines when:

  • Writing new NestJS modules, controllers, or services
  • Implementing authentication and authorization
  • Reviewing code for architecture and security issues
  • Refactoring existing NestJS codebases
  • Optimizing performance or database queries
  • Building microservices architectures

Rule Categories by Priority

PriorityCategoryImpactPrefix
1ArchitectureCRITICALarch-
2Dependency InjectionCRITICALdi-
3Error HandlingHIGHerror-
4SecurityHIGHsecurity-
5PerformanceHIGHperf-
6TestingMEDIUM-HIGHtest-
7Database & ORMMEDIUM-HIGHdb-
8API DesignMEDIUMapi-
9MicroservicesMEDIUMmicro-
10DevOps & DeploymentLOW-MEDIUMdevops-

Quick Reference

1. Architecture (CRITICAL)

  • arch-avoid-circular-deps - Avoid circular module dependencies
  • arch-feature-modules - Organize by feature, not technical layer
  • arch-module-sharing - Proper module exports/imports, avoid duplicate providers
  • arch-single-responsibility - Focused services over "god services"
  • arch-use-repository-pattern - Abstract database logic for testability
  • arch-use-events - Event-driven architecture for decoupling

2. Dependency Injection (CRITICAL)

  • di-avoid-service-locator - Avoid service locator anti-pattern
  • di-interface-segregation - Interface Segregation Principle (ISP)
  • di-liskov-substitution - Liskov Substitution Principle (LSP)
  • di-prefer-constructor-injection - Constructor over property injection
  • di-scope-awareness - Understand singleton/request/transient scopes
  • di-use-interfaces-tokens - Use injection tokens for interfaces

3. Error Handling (HIGH)

  • error-use-exception-filters - Centralized exception handling
  • error-throw-http-exceptions - Use NestJS HTTP exceptions
  • error-handle-async-errors - Handle async errors properly

4. Security (HIGH)

  • security-auth-jwt - Secure JWT authentication
  • security-validate-all-input - Validate with class-validator
  • security-use-guards - Authentication and authorization guards
  • security-sanitize-output - Prevent XSS attacks
  • security-rate-limiting - Implement rate limiting

5. Performance (HIGH)

  • perf-async-hooks - Proper async lifecycle hooks
  • perf-use-caching - Implement caching strategies
  • perf-optimize-database - Optimize database queries
  • perf-lazy-loading - Lazy load modules for faster startup

6. Testing (MEDIUM-HIGH)

  • test-use-testing-module - Use NestJS testing utilities
  • test-e2e-supertest - E2E testing with Supertest
  • test-mock-external-services - Mock external dependencies

7. Database & ORM (MEDIUM-HIGH)

  • db-use-transactions - Transaction management
  • db-avoid-n-plus-one - Avoid N+1 query problems
  • db-use-migrations - Use migrations for schema changes

8. API Design (MEDIUM)

  • api-use-dto-serialization - DTO and response serialization
  • api-use-interceptors - Cross-cutting concerns
  • api-versioning - API versioning strategies
  • api-use-pipes - Input transformation with pipes

9. Microservices (MEDIUM)

  • micro-use-patterns - Message and event patterns
  • micro-use-health-checks - Health checks for orchestration
  • micro-use-queues - Background job processing

10. DevOps & Deployment (LOW-MEDIUM)

  • devops-use-config-module - Environment configuration
  • devops-use-logging - Structured logging
  • devops-graceful-shutdown - Zero-downtime deployments

How to Use

Read individual rule files for detailed explanations and code examples:

rules/arch-avoid-circular-deps.md
rules/security-validate-all-input.md
rules/_sections.md

Each rule file contains:

  • Brief explanation of why it matters
  • Incorrect code example with explanation
  • Correct code example with explanation
  • Additional context and references

Full Compiled Document

For the complete guide with all rules expanded: AGENTS.md

Related skills

How it compares

Pick nestjs-best-practices over generic TypeScript lint skills when you need Nest-specific DI, module boundaries, guards, and interceptor patterns.

FAQ

How many rules does nestjs-best-practices include?

nestjs-best-practices contains 40 rules organized into 10 categories, prioritized by impact. The agent applies them when writing, reviewing, or refactoring NestJS modules, controllers, services, and security code.

When should I use nestjs-best-practices?

Use nestjs-best-practices when creating new NestJS modules, implementing authentication, or refactoring code for proper dependency injection, layering, security, and performance. It targets production-ready TypeScript APIs.

Is Nestjs Best Practices safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Backend & APIsbackenddevops

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.