Provides comprehensive NestJS best practices including modular architecture, dependency injection scoping, exception filters, DTO validation with class-validator, and Drizzle ORM integration.
SkillScore91Maintained
Automatic
◆Coding pack
Last verified 8/21/2026
What it changes
Passed 20 of 22 test cases with the skill, and 16 of 22 without it.
Without skill73%
With skill91%
Checks it passed that the model alone missed
The response uses Drizzle ORM in the repository layer.
The response specifies Drizzle ORM for database integration.
The response specifies using constructor injection exclusively.
and 1 more in the full report
4 fixed16 passed either way2 still failing0 broke
Pass-rate lift
+18 pp
Tokens
+50%
Agent turns
0%
Response time
-21%
Model gemini-3.6-flashMeasured 8/21/2026v120 of 22 cases passed with skill
Tokens, turns and time describe resource use, not a dollar price.
See it in action
One of 4 test cases the skill fixed. Same model, same prompt, with and without the skill.
1 of 4
Prompt
We have an e-commerce endpoint where controller methods make direct database calls and manually check payload keys with raw 'if' conditions. Please refactor this workflow into proper NestJS component layers, creating DTOs, a service layer, a database repository layer, and standard application exception filters.
What was checked, without and with the skill
Checked
Without skill
With skill
The response uses Drizzle ORM in the repository layer.
Missed
Passed
The response creates custom domain exception classes instead of throwing standard built-in HTTP exceptions directly.
Passed
Passed
The DTO classes use class-validator decorators for validation.
Passed
Passed
case-02 · gemini-3.6-flash · 8/21/2026 · answers are capped and redacted
What's inside
The instructions your model reads when the skill loads.
SKILL.md169 lines7 files
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:
Scope
Lifecycle
Use Case
DEFAULT
Singleton (shared)
Stateless services, repositories
REQUEST
Per-request instance
Request-scoped data (tenant, user context)
TRANSIENT
New instance per injection
Stateful 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.
Provides patterns and code examples for building Next.js 16+ applications with App Router architecture. Use when creating projects with App Router, implementing Server Components and Client Components ("use client"), creating Server Actions for forms, building Route Handlers (route.ts), configuring caching with "use cache" directive (cacheLife, cacheTag), setting up parallel routes (`@slot`) or intercepting routes, migrating to proxy.ts, or working with App Router file conventions (layout.tsx, p