nestjs-best-practices

Enforce NestJS architecture rules for modules, DI, and error handling.

Updated Oct 4, 2025
One-click install
npx skills add https://github.com/peancharoen/lcbp3 --skill nestjs-best-practices-peancharoen
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: nestjs-best-practices
Source: https://github.com/peancharoen/lcbp3/tree/main/.agents/skills/nestjs-best-practices
Command: npx skills add https://github.com/peancharoen/lcbp3 --skill nestjs-best-practices-peancharoen

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires typescript, ts-node, @types/node, and includes scripts (resource) components.

What problem does it solve?

Provides a comprehensive, machine-friendly rulebook and tooling to eliminate fragile NestJS architectures, reduce runtime crashes from bad module organization, and standardize dependency injection, error handling, and security patterns across teams.

Core Features & Use Cases

  • Guided Architecture Rules: Clear, prioritized rules for module organization, circular dependency avoidance, and single-responsibility services.
  • Dependency Injection & Scopes: Best practices for constructor injection, tokens for interfaces, and correct provider scopes to avoid state leaks.
  • Operational Patterns: Recommendations for error handling, testing, database migrations, transactions, caching, and graceful shutdown suitable for production readiness.
  • Tooling & Automation: Build scripts to compile rule files into a consolidated AGENTS.md for automated review and agent consumption.
  • Use Case: Automated code review and refactoring guidance when onboarding a NestJS backend or preparing a project for production audits.

Quick Start

Use the nestjs-best-practices skill to review a NestJS module and produce a prioritized list of fixes for module exports, DI scopes, validation, and migration issues.

Frequently Asked Questions about nestjs-best-practices

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

FAQPage Schema
How do I fix circular dependencies and bad module coupling in a NestJS project?▼

To fix circular dependencies in a NestJS project, apply rule-based architecture guidance for feature module organization and single-responsibility services to prevent fragile coupling and runtime crashes.

What is the best way to manage dependency injection scopes and tokens in NestJS?▼

Managing dependency injection scopes in NestJS requires using correct constructor injection, interface tokens, and proper provider scopes to prevent state leaks across shared modules.

How do I automate NestJS code review for production readiness?▼

Automating NestJS code review involves using build scripts that compile architecture rules into a consolidated AGENTS.md file for automated agent consumption and refactoring guidance.

Does this NestJS architecture guidance include operational patterns like error handling and caching?▼

This NestJS architecture guidance includes operational patterns for error handling, database migrations, transactions, caching, and graceful shutdown to ensure production readiness.

Can I use these NestJS best practices with a TypeScript backend codebase?▼

Yes, you can use these best practices with a TypeScript backend codebase, as the tooling requires TypeScript, ts-node, and Node types to compile rules and run build scripts.