← ClaudeAtlas

hexagonal-nestjs-patternslisted

NestJS/TypeScript backend with hexagonal architecture, SOLID, and KISS. Project structure, ports as abstract classes (inbound/outbound split), Zod entity/DTO validation, injection tokens, exception filters, Swagger via zod-openapi. Use when implementing or refactoring a NestJS backend following hexagonal architecture.
SoluDevTech/ai-driven · ★ 3 · AI & Automation · score 57
Install: claude install-skill SoluDevTech/ai-driven
# NestJS Hexagonal Architecture Patterns Build a NestJS/TypeScript backend following hexagonal architecture, SOLID, and KISS. ## Use this skill when - Implementing or refactoring a NestJS backend with hexagonal architecture - Scaffolding the 3-layer project structure (domain / application / infrastructure) - Defining ports as abstract classes and wiring injection tokens - Using Zod for entity + DTO validation with NestJS pipes - Mapping domain exceptions to HTTP exceptions ## Do not use this skill when - The task is async/concurrency/RxJS → use `async-nestjs-patterns` - The task is Python/FastAPI → use `hexagonal-python-patterns` - The task is performance profiling → use `performance-audit` ## 🛡️ Edge cases (mandatory handling) Every use case, controller, service, and adapter MUST handle edge cases defensively, not just the happy path. During implementation, cover: - **Null / undefined inputs** — validate at the port boundary via Zod; throw the correct domain exception, never let `null` / `undefined` propagate silently into business logic - **Empty / boundary values** — empty array, empty string, `0`, negative numbers, `new Date(0)`, single-element collections; handle explicitly - **Off-by-one boundaries** — pagination first/last page, offset equals total count, zero results - **Invalid / malformed input** — Zod schema validation covers structure, but add domain-level `.refine()` / `.superRefine()` for business rules (invalid state transition, value out of business range