Agent skill

Nestjs Best Practices

by giuseppe-trisciuoglio in giuseppe-trisciuoglio/developer-kit

Provides comprehensive NestJS best practices including modular architecture, dependency injection scoping, exception filters, DTO validation with class-validator, and Drizzle ORM integration.

MITAuto-check: notesBackend & APIs

Install Nestjs Best Practices

skills CLI
$ npx skills add giuseppe-trisciuoglio/developer-kit --skill nestjs-best-practices -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install giuseppe-trisciuoglio/developer-kit nestjs-best-practices --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/giuseppe-trisciuoglio/developer-kit.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/developer-kit-typescript/skills/nestjs-best-practices .claude/skills/nestjs-best-practices && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
nestjs-best-practices
GitHub stars
357
Token cost
~1.8k tokens
SKILL.md length
598 words
Files
10 (incl. references, assets)
Skills in repo
115
Repo updated
First seen
Licence
MIT

At a glance

Provides comprehensive NestJS best practices including modular architecture, dependency injection scoping, exception filters, DTO validation with class-validator, and Drizzle ORM integration.

  • Works in 6 steps: Modular Architecture → Dependency Injection → Request Lifecycle → …
  • Designing NestJS modules
  • SKILL.md covers Overview, When to Use, Instructions and Best Practices, plus 3 more sections
  • Runs TypeScript scripts from its folder; calls npx

What it does

Nestjs Best Practices is an agent skill from giuseppe-trisciuoglio/developer-kit. Provides comprehensive NestJS best practices including modular architecture, dependency injection scoping, exception filters, DTO validation with class-validator, and Drizzle ORM integration. Use when designing NestJS modules, implementing providers, creating exception filters, validating DTOs, or integrating Drizzle ORM within NestJS applications.

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 12 other files, including reference files and assets (for example `assets/templates/controller-template.ts`, `assets/templates/module-template.ts` and `assets/templates/service-template.ts`).

It sits in Backend & APIs, covering Design patterns. It works with NestJS and Drizzle ORM. The repository describes itself as: Modular plugin marketplace for Claude Code and agentic CLIs, with validated, spec-driven skills, agents, commands, and workflows for Java, TypeScript, Python, PHP, AWS, and AI. The licence is MIT.

When your agent uses it

  • Designing NestJS modules
  • Implementing providers
  • Creating exception filters
  • Validating DTOs

Example prompts

  • “Use the nestjs-best-practices skill to provide comprehensive NestJS best practices including modular architecture, dependency injection scoping…”
  • “/nestjs-best-practices”

Requirements

  • Node.js
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Glob, Grep, Bash

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Modular Architecture
  2. Dependency Injection
  3. Request Lifecycle
  4. Error Handling
  5. Validation
  6. Database Patterns (Drizzle ORM)

What it can do on your machine

Read from SKILL.md and the folder at commit fe73fb3. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Glob
    • Grep
    • Bash

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (TypeScript), which the agent can run.

    Shell commands in SKILL.md call:

    • npx

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • docs.nestjs.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Nestjs Best Practices loads about 1.8k tokens when it runs, and up to ~8.2k if it reads all its reference files. Until then it costs about 93 tokens; SKILL.md has 598 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~93
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~8.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Read, Write, Edit, Glob, Grep, Bash

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from giuseppe-trisciuoglio/developer-kit at commit fe73fb3, republished under its MIT licence (© giuseppe-trisciuoglio). 598 words, ~1,832 tokens.

Download SKILL.mdSave it as .claude/skills/nestjs-best-practices/SKILL.md (or your agent's skills folder). This skill also uses 9 other files; get the full folder from GitHub.
name
nestjs-best-practices
description
Provides comprehensive NestJS best practices including modular architecture, dependency injection scoping, exception filters, DTO validation with class-validator, and Drizzle ORM integration. Use when designing NestJS modules, implementing providers, creating exception filters, validating DTOs, or integrating Drizzle ORM within NestJS applications.
allowed-tools
Read, Write, Edit, Glob, Grep, Bash

NestJS Best Practices

Overview

Grounded in the Official NestJS Documentation, this skill enforces modular architecture, dependency injection scoping, exception filters, DTO validation with class-validator, and Drizzle ORM integration patterns.

When to Use

  • Designing/refactoring NestJS modules or dependency injection
  • Creating exception filters, validating DTOs, or integrating Drizzle ORM
  • Reviewing code for anti-patterns or onboarding to a NestJS codebase

Instructions

1. Modular Architecture

Follow strict module encapsulation. Each domain feature should be its own @Module():

  • Export only what other modules need — keep internal providers private
  • Use forwardRef() only as a last resort for circular dependencies; prefer restructuring
  • Group related controllers, services, and repositories within the same module
  • Use a SharedModule for cross-cutting concerns (logging, configuration, caching)

See references/arch-module-boundaries.md for enforcement rules.

2. Dependency Injection

Choose the correct provider scope based on use case:

ScopeLifecycleUse Case
DEFAULTSingleton (shared)Stateless services, repositories
REQUESTPer-request instanceRequest-scoped data (tenant, user context)
TRANSIENTNew instance per injectionStateful utilities, per-consumer caches
  • Default to DEFAULT scope — only use REQUEST or TRANSIENT when justified
  • Use constructor injection exclusively — avoid property injection
  • Register custom providers with useClass, useValue, useFactory, or useExisting

See references/di-provider-scoping.md for enforcement rules.

3. Request Lifecycle

Understand and respect the NestJS request processing pipeline:

Middleware → Guards → Interceptors (before) → Pipes → Route Handler → Interceptors (after) → Exception Filters
  • Middleware: Cross-cutting concerns (logging, CORS, body parsing)
  • Guards: Authorization and authentication checks (return true/false)
  • Interceptors: Transform response data, add caching, measure timing
  • Pipes: Validate and transform input parameters
  • Exception Filters: Catch and format error responses
4. Error Handling

Standardize error responses across the application:

  • Extend HttpException for HTTP-specific errors
  • Create domain-specific exception classes (e.g., OrderNotFoundException)
  • Implement a global ExceptionFilter for consistent error formatting
  • Use the Result pattern for expected business logic failures
  • Never silently swallow exceptions

See references/error-exception-filters.md for enforcement rules.

5. Validation

Enforce input validation at the API boundary:

  • Enable ValidationPipe globally with transform: true and whitelist: true
  • Decorate all DTO properties with class-validator decorators
  • Use class-transformer for type coercion (@Type(), @Transform())
  • Create separate DTOs for Create, Update, and Response operations
  • Never trust raw user input — validate everything

See references/api-validation-dto.md for enforcement rules.

Show full SKILL.md (263 more words)Show less
6. Database Patterns (Drizzle ORM)

Integrate Drizzle ORM following NestJS provider conventions:

  • Wrap the Drizzle client in an injectable provider
  • Use the Repository pattern for data access encapsulation
  • Define schemas in dedicated schema files per domain module
  • Use transactions for multi-step operations
  • Keep database logic out of controllers

See references/db-drizzle-patterns.md for enforcement rules.

Best Practices

AreaDoDon't
ModulesOne module per domain featureDump everything in AppModule
DI ScopingDefault to singleton scopeUse REQUEST scope without justification
Error HandlingCustom exception filters + domain errorsBare try/catch with console.log
ValidationGlobal ValidationPipe + DTO decoratorsManual if checks in controllers
DatabaseRepository pattern with injected clientDirect DB queries in controllers
TestingUnit test services, e2e test controllersSkip tests or test implementation details
Configuration@nestjs/config with typed schemasHardcode values or use process.env

Examples

Example: New Domain Module with Validation

When building a "Product" feature, follow this workflow:

1. Create the module with proper encapsulation:

typescript
// product/product.module.ts
@Module({
  imports: [DatabaseModule],
  controllers: [ProductController],
  providers: [ProductService, ProductRepository],
  exports: [ProductService], // Only export what others need
})
export class ProductModule {}

2. Create validated DTOs:

typescript
// product/dto/create-product.dto.ts
import { IsString, IsNumber, IsPositive, MaxLength } from 'class-validator';

export class CreateProductDto {
  @IsString() @MaxLength(255) readonly name: string;
  @IsNumber() @IsPositive() readonly price: number;
}

3. Service with error handling:

typescript
@Injectable()
export class ProductService {
  constructor(private readonly productRepository: ProductRepository) {}

  async findById(id: string): Promise<Product> {
    const product = await this.productRepository.findById(id);
    if (!product) throw new ProductNotFoundException(id);
    return product;
  }
}

4. Verify module registration:

bash
# Check module is imported in AppModule
grep -r "ProductModule" src/app.module.ts

# Run e2e to confirm exports work
npx jest --testPathPattern="product"

Constraints and Warnings

  1. Do not mix scopes without justification — REQUEST-scoped providers cascade to all dependents
  2. Never access database directly from controllers — always go through service and repository layers
  3. Avoid forwardRef() — restructure modules to eliminate circular dependencies
  4. Do not skip ValidationPipe — always validate at the API boundary with DTOs
  5. Never hardcode secrets — use @nestjs/config with environment variables
  6. Keep modules focused — one domain feature per module, avoid "god modules"

References

  • references/architecture.md — Deep-dive into NestJS architectural patterns
  • references/ — Individual enforcement rules with correct/incorrect examples
  • assets/templates/ — Starter templates for common NestJS components

© giuseppe-trisciuoglio, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 9 other files (references, assets) in plugins/developer-kit-typescript/skills/nestjs-best-practices of giuseppe-trisciuoglio/developer-kit.

  • SKILL.md
  • assets/templates/controller-template.ts
  • assets/templates/module-template.ts
  • assets/templates/service-template.ts
  • references/api-validation-dto.md
  • references/arch-module-boundaries.md
  • references/architecture.md
  • references/db-drizzle-patterns.md
  • references/di-provider-scoping.md
  • references/error-exception-filters.md

Open the folder on GitHubat commit fe73fb3

Compare with similar skills

Nestjs Best Practices next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Nestjs Best Practices compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Nestjs Best Practices this skillgiuseppe-trisciuoglio/developer-kit357—~1.8kAutomated safety check: NotesMIT
Nestjs Best Practicesrolling-scopes/rsschool-app10k6 repos~1.2kAutomated safety check: PassMIT
Backendredis/RedisInsight8.9k—~1.6kAutomated safety check: PassCustom licence
Nestjs Expertdavila7/claude-code-templates33k7 repos~5.3kAutomated safety check: NotesMIT
ImplementAI-Unified-Process/marketplace142—~4.7kAutomated safety check: WarnApache-2.0
Node Backend Development Guidelinesdiet103/claude-code-infrastructure-showcase10k2 repos~2kAutomated safety check: PassMIT

Similar skills

  • Nestjs Best Practices

    rolling-scopes/rsschool-app

    NestJS best practices and architecture patterns for building production-ready applications.

    10k GitHub starsUsed in 6 repos~1.2k tokens
    Backend & APIsAuto-check passed
  • Backend

    redis/RedisInsight

    Official

    NestJS backend development patterns for the RedisInsight API: module structure, services, controllers, DTOs, dependency injection, and error handling.

    8.9k GitHub stars~1.6k tokensUpdated 6 days ago
    Backend & APIsAuto-check passed
  • Nestjs Expert

    davila7/claude-code-templates

    Nest.js framework expert specializing in module architecture, dependency injection, middleware, guards, interceptors, testing with Jest/Supertest, TypeORM/Mongoose integration, and Passport.js…

    33k GitHub starsUsed in 7 repos~5.3k tokens
    Testing & QAAuto-check: notes
  • Implement

    AI-Unified-Process/marketplace

    Implements use cases across a NestJS backend with Drizzle ORM over PostgreSQL and a Next.js App Router frontend wired to that API.

    142 GitHub stars~4.7k tokensUpdated 6 days ago
    DatabasesAuto-check: warnings
  • Node Backend Development Guidelines

    diet103/claude-code-infrastructure-showcase

    Sets layered architecture and coding rules for Node.js, Express and TypeScript microservices, covering routes, controllers, services, repositories, Prisma, Sentry and Zod.

    10k GitHub starsUsed in 2 repos~2k tokens
    Backend & APIsAuto-check passed
  • Contributor guide for step three of adding a syncable entity to the Twenty server: write the validator, the migration action builder and the orchestrator wiring.

    58k GitHub stars~3.3k tokensUpdated today
    Backend & APIsAuto-check passed

More from giuseppe-trisciuoglio/developer-kit

All 115 skills in this repo
  • Nestjs Drizzle Crud Generator

    giuseppe-trisciuoglio/developer-kit

    Generates complete CRUD modules for NestJS applications with Drizzle ORM.

    357 GitHub stars~1.3k tokensUpdated 1 mo ago
    Auto-check: notes
  • Spring Boot Actuator

    giuseppe-trisciuoglio/developer-kit

    Provides patterns to configure Spring Boot Actuator for production-grade monitoring, health probes, secured management endpoints, and Micrometer metrics across JVM services.

    357 GitHub stars~2.2k tokensUpdated 1 mo ago
    Auto-check: notes
  • Spring Boot Crud Patterns

    giuseppe-trisciuoglio/developer-kit

    Provides and generates complete CRUD workflows for Spring Boot 3 services.

    357 GitHub stars~2.5k tokensUpdated 1 mo ago
    Auto-check: notes
  • Spring Boot Security JWT

    giuseppe-trisciuoglio/developer-kit

    Provides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based…

    357 GitHub stars~3.9k tokensUpdated 1 mo ago
    Auto-check: notes
  • AWS CLI Beast

    giuseppe-trisciuoglio/developer-kit

    Provides advanced AWS CLI patterns for managing EC2, Lambda, S3, DynamoDB, RDS, VPC, IAM, and CloudWatch.

    357 GitHub stars~1.7k tokensUpdated 1 mo ago
    Auto-check: notes
  • PR Review Comments

    giuseppe-trisciuoglio/developer-kit

    Posts review findings from a JSON file as inline comments on a GitHub Pull Request, attaching each comment to its file and line.

    357 GitHub stars~1k tokensUpdated 1 mo ago
    Auto-check: notes

Categories

Questions about Nestjs Best Practices

What does Nestjs Best Practices do?

Provides comprehensive NestJS best practices including modular architecture, dependency injection scoping, exception filters, DTO validation with class-validator, and Drizzle ORM integration. Nestjs Best Practices is an agent skill from giuseppe-trisciuoglio/developer-kit. Provides comprehensive NestJS best practices including modular architecture, dependency injection scoping, exception filters, DTO validation with class-validator, and Drizzle ORM integration.

When should I use Nestjs Best Practices?

Nestjs Best Practices fits situations like: designing NestJS modules; implementing providers; creating exception filters; validating DTOs.

How do I install Nestjs Best Practices in Claude Code?

Run `npx skills add giuseppe-trisciuoglio/developer-kit --skill nestjs-best-practices -a claude-code`. Or copy the skill folder (plugins/developer-kit-typescript/skills/nestjs-best-practices in giuseppe-trisciuoglio/developer-kit) into .claude/skills/nestjs-best-practices in your project. Claude Code loads it when a task matches its description.

How do I install Nestjs Best Practices in Codex?

Run `npx skills add giuseppe-trisciuoglio/developer-kit --skill nestjs-best-practices -a codex`. Or copy the skill folder (plugins/developer-kit-typescript/skills/nestjs-best-practices in giuseppe-trisciuoglio/developer-kit) into .agents/skills/nestjs-best-practices in your project. Codex loads it when a task matches its description.

Can I use Nestjs Best Practices in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add giuseppe-trisciuoglio/developer-kit --skill nestjs-best-practices -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/nestjs-best-practices, .gemini/skills/nestjs-best-practices, .github/skills/nestjs-best-practices and .opencode/skills/nestjs-best-practices in your project.

What does Nestjs Best Practices need to run?

Going by SKILL.md and its folder, Nestjs Best Practices needs TypeScript for the scripts in its folder and the command-line tools its instructions call (npx). Our summary lists: Node.js. Its frontmatter pre-approves these tools: Read, Write, Edit, Glob, Grep, Bash.

Does Nestjs Best Practices access the network?

SKILL.md names 1 domain. As links in the text: docs.nestjs.com. This is read from the text; nothing was executed.

Is Nestjs Best Practices safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Nestjs Best Practices use?

Nestjs Best Practices is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Nestjs Best Practices use?

About 1.8k tokens (SKILL.md is roughly 7.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 6.3k tokens, read only when the agent opens those files.

What are the alternatives to Nestjs Best Practices?

Skills that share tags, products or a category with Nestjs Best Practices: Nestjs Best Practices (rolling-scopes/rsschool-app, 10k stars), Backend (redis/RedisInsight, 8.9k stars), Nestjs Expert (davila7/claude-code-templates, 33k stars) and Implement (AI-Unified-Process/marketplace, 142 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Nestjs Best Practices?

giuseppe-trisciuoglio (a GitHub user) maintains it in giuseppe-trisciuoglio/developer-kit, which has 357 GitHub stars. The repository holds 115 skills in this directory. The repository was last updated on September 10, 2026.

Source: giuseppe-trisciuoglio/developer-kit on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.