nestjs
Skill15 starsChanged 46 days agoMITView on GitHub
Expert NestJS assistance covering modular architecture, dependency injection, decorators, guards, interceptors, and Prisma/TypeORM. Use when building enterprise-grade, scalable TypeScript backends.
5 other projects use a version of this.
Adopted by
Most recently taken up by
- nimadorostkar/Claude-Skills-collectiontheir own version, first seen Oct 13, 2026
- zeeshanalimughal/claude-skillstheir own version, first seen Oct 13, 2026
- conjure-3301/skillstheir own version, first seen Aug 17, 2026
- youlaitech/youlai-skillstheir own version, first seen Jul 14, 2026
- nguyenchilong/claude-skills-fullstackstheir own version, first seen May 22, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- youlaitech/youlai-skills★ 63same name
- nimadorostkar/Claude-Skills-collection★ 37same name
- nguyenchilong/claude-skills-fullstacks★ 1same name
- conjure-3301/skills★ 0same name
- zeeshanalimughal/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository350 other files it gives its agents.
- airflowSkill
- catboostSkill
- claudeSkill
- comfyuiSkill
- cursor-aiSkill
- dalleSkill
- daskSkill
- dbtSkill
- deepseekSkill
- fastaiSkill
- geminiSkill
- github-copilotSkill
- huggingfaceSkill
- jaxSkill
- jupyterSkill
- kerasSkill
- langchainSkill
- lightgbmSkill
- llamaindexSkill
- llamaSkill
- matplotlibSkill
- midjourneySkill
- mistralSkill
- mlflowSkill
- nltkSkill
- numpySkill
- ollamaSkill
- openai-gptSkill
- opencvSkill
- pandasSkill
- perplexitySkill
- plotlySkill
- polarsSkill
- pytorchSkill
- raySkill
- scikit-learnSkill
- seabornSkill
- spacySkill
- sparkSkill
- stable-diffusionSkill
- tensorflowSkill
- vaexSkill
- weights-biasesSkill
- whisperSkill
- xgboostSkill
- api-gatewaySkill
- clean-architectureSkill
- cqrsSkill
- domain-driven-designSkill
- event-drivenSkill
- event-sourcingSkill
- graphqlSkill
- grpcSkill
- hexagonalSkill
- microservicesSkill
- modular-monolithSkill
- monolithSkill
- rest-apiSkill
- sagaSkill
- serverlessSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 147
Use custom SetMetadata decorator and global RolesGuard:
- Very specific: line 176
Use Fastify adapter (@nestjs/platform-fastify) for performance-sensitive microservices.
- Distinctive: line 181
Put business logic inside controllers.
- Very specific: line 182
Use circular dependencies between modules.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
NestJS
NestJS is a progressive Node.js framework for building scalable enterprise server-side applications using TypeScript, dependency injection, and modular architecture.
When to Use
- Enterprise Node.js Backend Microservices: Architecture inspired by Angular with modules, providers, and dependency injection.
- Domain-Driven Modular Applications: Structuring large codebases with clear domain separation and clean layering.
- Multi-Transport Microservices: Seamlessly switching between HTTP, gRPC, RabbitMQ, Kafka, and Redis transports.
- Type-Safe REST & GraphQL Backends: Combining TypeORM/Prisma, class-validator, and auto-generated Swagger documentation.
Quick Start
// cats.controller.ts
@Controller("cats")
export class CatsController {
constructor(private catsService: CatsService) {}
@Get()
async findAll(): Promise<Cat[]> {
return this.catsService.findAll();
}
}Core Concepts
Modular Architecture & Dependency Injection
Structuring modules, controllers, and injectable services:
// users.service.ts
import { Injectable, NotFoundException } from "@nestjs/common";
export interface User {
id: string;
email: string;
}
@Injectable()
export class UsersService {
private users: User[] = [{ id: "1", email: "admin@example.com" }];
async findById(id: string): Promise<User> {
const user = this.users.find((u) => u.id === id);
if (!user) {
throw new NotFoundException(`User with ID ${id} not found`);
}
return user;
}
}
// users.controller.ts
import { Controller, Get, Param } from "@nestjs/common";
@Controller("users")
export class UsersController {
constructor(private readonly usersService: UsersService) {}
@Get(":id")
async getUser(@Param("id") id: string) {
return this.usersService.findById(id);
}
}Request Validation with Pipes & Class-Validator
Validating incoming JSON payloads before controller execution:
// create-user.dto.ts
import { IsEmail, IsNotEmpty, MinLength } from "class-validator";
export class CreateUserDto {
@IsEmail({}, { message: "Invalid email address" })
email: string;
@IsNotEmpty()
@MinLength(8, { message: "Password must be at least 8 characters" })
password: string;
}
// main.ts
import { ValidationPipe } from "@nestjs/common";
import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app.module";
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.useGlobalPipes(
new ValidationPipe({
whitelist: true, // Strip unvalidated properties
forbidNonWhitelisted: true,
transform: true,
}),
);
await app.listen(3000);
}
bootstrap();Execution Guards & Role-Based Access Control (RBAC)
Protecting endpoints with custom authentication guards:
import {
Injectable,
CanActivate,
ExecutionContext,
UnauthorizedException,
} from "@nestjs/common";
import { Request } from "express";
@Injectable()
export class AuthGuard implements CanActivate {
canActivate(context: ExecutionContext): boolean {
const request = context.switchToHttp().getRequest<Request>();
const authHeader = request.headers.authorization;
if (!authHeader || !authHeader.startsWith("Bearer ")) {
throw new UnauthorizedException("Valid authorization token required");
}
// Attach verified user payload
request["user"] = { id: "usr_101", role: "admin" };
return true;
}
}Common Patterns
Role-Based Access Control (RBAC) Guard with Reflector
Problem: Duplicating role checks across individual controller route handlers.
Solution: Use custom SetMetadata decorator and global RolesGuard:
import { Injectable, CanActivate, ExecutionContext } from "@nestjs/common";
import { Reflector } from "@nestjs/core";
@Injectable()
export class RolesGuard implements CanActivate {
constructor(private reflector: Reflector) {}
canActivate(context: ExecutionContext): boolean {
const requiredRoles = this.reflector.get<string[]>(
"roles",
context.getHandler(),
);
if (!requiredRoles) return true;
const request = context.switchToHttp().getRequest();
const user = request.user;
return requiredRoles.some((role) => user?.roles?.includes(role));
}
}Best Practices
Do:
- Enable
whitelist: trueandforbidNonWhitelisted: truein globalValidationPipeto prevent mass-assignment attacks. - Split applications into discrete domain modules (
UserModule,OrderModule,AuthModule) with explicit exports. - Use Fastify adapter (
@nestjs/platform-fastify) for performance-sensitive microservices. - Handle configuration with
@nestjs/configand validate environment variables with Joi or Zod.
Don't:
- Put business logic inside controllers; keep controllers strictly focused on request handling.
- Use circular dependencies between modules; use
forwardRef()only as an absolute last resort. - Catch exceptions silently without rethrowing or logging through Nest's
Loggerservice.
Troubleshooting
| Error | Cause | Solution |
Nest can't resolve dependencies of the ... | Required service or repository not listed in module providers or imports. | Add the missing service to module providers or export it from its host module. |
Cannot find module '...' or its corresponding type declarations | Path alias in tsconfig.json not recognized by Nest CLI runner. | Verify baseUrl and paths mapping in both tsconfig.json and nest-cli.json. |
Circular dependency detected in ... | Two services directly injecting each other in constructor. | Use forwardRef(() => OtherService) in both @Inject() annotations. |
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

