Skip to content
Back to skills

Nestjs Patterns

ASecurity

Use when building NestJS APIs with modules, validation, guards, config, and testing. Triggers on \"nestjs-patterns\", \"nestjs patterns\", \"patterns\".

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 19, 2026
developmenttypescripttestingapidatabasebackend

Works with

  • api

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned September 19, 2026

npx -y skills add majinmagros/magros.ai-skills --skill nestjs-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Nestjs Patterns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Nestjs Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majinmagros-nestjs-patterns/badge)](https://www.skillsdirectory.com/skills/majinmagros-nestjs-patterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: nestjs-patterns
description: "Use when building NestJS APIs with modules, validation, guards, config, and testing. Triggers on \"nestjs-patterns\", \"nestjs patterns\", \"patterns\"."
metadata:
  origin: ECC
---

# NestJS Development Patterns

Modular TypeScript backends: thin controllers, validated DTOs, guarded routes. Detalhes em `references/`.

## When to Activate

- Building NestJS APIs or services
- Structuring modules, controllers, and providers
- Adding DTO validation, guards, interceptors, or exception filters
- Configuring environment-aware settings and database integrations
- Testing NestJS units or HTTP endpoints

## Core Principles

1. **Thin controllers** — parse input, call service, return response DTO
2. **Validate globally** — one ValidationPipe with whitelist + forbidNonWhitelisted
3. **Guards coarse, services fine** — roles in guards, ownership in services
4. **One error envelope** — central filter; never leak hashes/tokens
5. **Env fails at boot** — typed config; transactions owned by services

## Example

```ts
@Post()
create(@Body() dto: CreateUserDto) {
  return this.usersService.create(dto);
}
```

## References

- `references/structure-bootstrap.md` — feature-module layout, global ValidationPipe bootstrap
- `references/modules-controllers.md` — module/controller/service split, class-validator DTOs
- `references/auth-errors-config.md` — guards, exception filter, env validation, transactions
- `references/testing-production.md` — TestingModule patterns, logging, health, jobs, rate limits

## Checklist

- [ ] Global pipe: whitelist + forbidNonWhitelisted + transform
- [ ] No business logic in controllers; no ORM entities in responses
- [ ] Guards + service-level authorization both present
- [ ] Single error envelope; env validated at boot
- [ ] Tests reuse production pipes/filters

Files in this skill

  • SKILL.md1.8 KB
  • references/auth-errors-config.md1.7 KB
  • references/modules-controllers.md1.3 KB
  • references/structure-bootstrap.md1.6 KB
  • references/testing-production.md967 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.