/stackwise:nestjs-expertfrom stackwise
Builds and refactors NestJS 11 APIs with DI wiring, config validation, Prisma/TypeORM integration, JWT auth with refresh flows, OpenAPI docs, BullMQ queues, and e2e tests using supertest.
Ships in stackwise. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Turns Claude into a senior NestJS backend engineer who ships NestJS 11 / Node 22 services with correct DI scoping, validated config, typed database access, and verified tests.
nest-cli.json, package.json (confirm @nestjs/core major = 11, ORM, validation lib), src/main.ts (global pipes/filters/prefix), and app.module.ts to map the module graph. Match the project's existing conventions (barrel files, DTO location, ConfigService vs registerAs tokens) before writing anything.Scope.REQUEST explicitly (see references/architecture-di.md). New cross-cutting behavior goes in guards/interceptors/filters, not in controllers.npx tsc --noEmit and npm run lint; fix all reported issues and re-run until clean before proceeding.npm test and npm run test:e2e; fix all failures and re-run until clean. Never weaken an assertion to make a test pass.npm run start:dev) and hit the new endpoint with curl, including one invalid payload to confirm the 400 shape from ValidationPipe. For queues, enqueue a job and confirm the processor log. Fix anything wrong and re-verify until the observed behavior matches the requirement.Load detailed guidance only when the task needs it:
| Topic | Reference | Load When |
|---|---|---|
| Modules, DI scopes, providers, lifecycle, execution order | references/architecture-di.md | Creating modules, DI resolution errors, request-scoped providers, guard/interceptor/filter ordering questions |
| ValidationPipe, class-validator vs Zod, ConfigModule + env validation, OpenAPI decorators | references/validation-config.md | Adding DTO validation, choosing a validation library, wiring .env config, "config is undefined at bootstrap", Swagger/OpenAPI docs |
| Prisma and TypeORM integration, transactions, migrations | references/database-prisma.md | Any DB work: schema changes, repositories, transactions, connection lifecycle, choosing Prisma vs TypeORM |
| Passport-jwt vs @nestjs/jwt, refresh-token rotation, route guarding | references/auth.md | Login/JWT endpoints, protecting routes, refresh flows, "401 on valid token" debugging |
| Unit + e2e testing, supertest, overriding providers, BullMQ jobs | references/testing.md | Writing tests, mocking providers, e2e app bootstrap parity, queue/worker implementation and testing |
Singleton by default; request scope is a measured exception. Scope.REQUEST bubbles: every consumer of a request-scoped provider becomes request-scoped and is re-instantiated per request. For "who is the current user" style needs, prefer AsyncLocalStorage (via nestjs-cls) or pass context explicitly:
@Injectable() // singleton - no scope option
export class AuditService {
constructor(private readonly cls: ClsService) {}
log(action: string) {
this.cls.get('userId'); // per-request data without per-request instantiation
}
}
Global ValidationPipe with the three flags that matter (in main.ts):
app.useGlobalPipes(new ValidationPipe({
whitelist: true, // strip unknown properties
forbidNonWhitelisted: true, // 400 on unknown properties
transform: true, // plain body -> DTO instance, enables @Type coercion
}));
Custom providers use tokens, not strings scattered inline:
export const REDIS = Symbol('REDIS');
@Module({
providers: [{ provide: REDIS, useFactory: (cfg: ConfigService) => new Redis(cfg.getOrThrow('REDIS_URL')), inject: [ConfigService] }],
exports: [REDIS],
})
export class RedisModule {}
// consumer: constructor(@Inject(REDIS) private readonly redis: Redis) {}
e2e tests must mirror production bootstrap - apply the same global pipes/filters the real main.ts applies, or e2e tests pass while production rejects:
const moduleRef = await Test.createTestingModule({ imports: [AppModule] }).compile();
app = moduleRef.createNestApplication();
applyGlobalConfig(app); // shared helper also called from main.ts
await app.init();
Scope.REQUEST for convenience. It cascades to every dependent, kills singleton caching, and breaks in passive contexts (cron, queue processors). Correction: stay singleton; use nestjs-cls/AsyncLocalStorage for per-request data, or moduleRef.resolve() with a ContextId when you truly need per-request instances.exports-ed and the consumer imports that module. "Nest can't resolve dependencies" is almost always a missing export/import, not a missing @Injectable().whitelist/transform. Default config lets unknown properties through (mass-assignment risk) and leaves @Query() params as strings. Also: class-validator decorators do nothing on interfaces or on properties without decorators - every DTO field needs one (or @Allow()).process.env directly in providers. Bypasses ConfigModule validation and load order; values are string | undefined at type level and unvalidated at runtime. Correction: validate env at bootstrap (Joi/Zod validate in ConfigModule.forRoot) and inject ConfigService with getOrThrow, or typed registerAs namespaces.@nestjs/jwt and passport-jwt are not alternatives for the same job. @nestjs/jwt signs/verifies tokens (issuing side); passport-jwt + JwtStrategy + AuthGuard('jwt') validates them on requests. A typical app uses both; implementing verification manually in a guard while also registering a strategy leads to double/contradictory validation.references/auth.md.@Body() body: any plus manual checks instead of DTOs. Kills ValidationPipe, OpenAPI generation (@nestjs/swagger CLI plugin reads DTO classes), and type safety in one move.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
NestJS, Node, TypeScript, Prisma, TypeORM, PostgreSQL, JWT, Swift
Other plugins' skills for the same job
16 skills in this plugin
/docker-expertUse when working with Dockerfile, docker-compose.yml, .dockerignore, or multi-stage builds. Build, debug, secure, and optimize Docker 27+ images and Docker Compose services./engineering-rulesUse when writing, modifying, or reviewing code in any language or framework. Applies to every code task in this repo and every code sample inside a skill: new features, bug fixes, refactors, generated snippets, tests, scripts, docs with code. Enforces the seven repo-wide rules: reusable code, maintainable structure, top-notch readability, no AI slop, dead code removal, why-only comments, no em dashes. Invoke for implementing changes, self-reviewing a diff, cleaning up generated code, writing reference examples, or reviewing a PR./fastapi-expertnpx claudepluginhub aarvion-ai/stackwise-skills --plugin stackwise