Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Nestjs?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/vectora-os-nestjs)
---
name: nestjs
description: NestJS — module boundaries, providers and DI scopes, controllers with DTO validation (ValidationPipe), guards and interceptors, exception filters, configuration module, testing module with overrides, microservice transports, avoiding circular dependencies. Use for NestJS services (NestJS, module, provider, guard, interceptor, DTO).
metadata:
category: languages-frameworks
---
# NestJS
## Purpose
Structure NestJS applications with clear modules, validated input and testable providers.
**Use when:** building or reviewing NestJS code.
**Not for:** framework choice (`decision-analyst`).
## Inputs
- Service design, code.
## Outputs
- Modules, providers, tests, review findings.
## Read first
- [Project Brain](../../../project-brain/README.md) — `npm run brain -- query "nestjs"` for prior decisions, patterns and anti-patterns.
## Steps
1. **Modules.** One module per bounded context; export only the public providers.
Done when no deep imports across modules.
2. **Input.** Global `ValidationPipe` with whitelist and forbidNonWhitelisted; DTOs per endpoint.
Done when unknown fields are rejected.
3. **Cross-cutting.** Auth in guards, logging/tracing in interceptors, errors in filters.
Done when controllers stay thin.
4. **Tests.** `Test.createTestingModule` with overridden providers; e2e with supertest.
Done when critical paths have e2e tests.
## Best practices
- Default singleton scope; request scope only when needed (performance).
- Use `forwardRef` as a smell detector, not a fix.
## Common mistakes
- Business logic in controllers.
- Circular module imports.
## Example
`BillingModule` exports `InvoiceService`; `RolesGuard` checks scope; DTO `CreateInvoiceDto` with class-validator.
## Reusable prompt
```text
Apply the NestJS skill (.agents/skills/nestjs/SKILL.md).
Context: {{task card or question; links to PRD, ADRs, code paths}}
Constraints: {{approved thresholds, deadlines, allowed files}}
Structure or review the NestJS code: module boundaries, DTO validation, guards/interceptors and tests.
Return: Modules, providers, tests, review findings..
Cite evidence (file:line, command output, source) for every claim; list open questions separately.
```