NestJS Architect

Generate and refactor NestJS code following DDD and Clean Architecture.

Updated Apr 5, 2023
One-click install
npx skills add https://github.com/edneyreis999/zord-project --skill nestjs-architect
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: NestJS Architect
Source: https://github.com/edneyreis999/zord-project/tree/main/claude-skills/nestjs-architect
Command: npx skills add https://github.com/edneyreis999/zord-project --skill nestjs-architect

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the complexity of implementing Domain-Driven Design (DDD) and Clean Architecture in NestJS projects. It ensures strict separation of concerns, promotes testability, and prevents common anti-patterns, leading to maintainable and scalable applications.

Core Features & Use Cases

  • Architectural Enforcement: Guides the creation of aggregates, entities, value objects, and use cases following DDD principles, strictly separating domain from infrastructure.
  • NestJS Integration Best Practices: Configures NestJS modules, providers, controllers, DTOs, and presenters idiomatically while respecting architectural boundaries.
  • Anti-Pattern Detection & Correction: Identifies and corrects common architectural pitfalls like framework dependencies in the domain layer or mutable value objects.
  • Use Case: When starting a new NestJS module, activate this Skill to automatically generate the entire core/ and nest-modules/ structure, including domain entities, repository interfaces, application use cases, and NestJS controllers, all pre-configured with best practices and testing patterns.

Quick Start

Use the "NestJS Architect" skill to create a new Order aggregate following DDD patterns, including its repository interface and a CreateOrder use case.

Frequently Asked Questions about NestJS Architect

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a NestJS application with Domain-Driven Design and Clean Architecture?

Domain-Driven Design with Clean Architecture in NestJS separates domain logic from infrastructure by organizing code into distinct layers: domain entities and value objects, application use cases, and NestJS-specific modules and controllers. This Skill guides you through creating aggregates, repositories with domain interfaces, and anti-pattern-free structures that keep your codebase maintainable and testable as it scales.

Can I use DDD patterns with NestJS modules and providers?

Yes. DDD patterns integrate idiomatically with NestJS by mapping domain concepts to NestJS constructs: repositories become providers implementing domain interfaces, use cases become service classes, and aggregates map to NestJS module boundaries. This Skill ensures your modules, controllers, and DTOs respect architectural boundaries while leveraging NestJS's dependency injection and decorator patterns.

What are common anti-patterns when building NestJS applications with DDD?

Common anti-patterns include placing framework dependencies in the domain layer, mutating value objects, mixing infrastructure concerns with business logic, and failing to enforce repository interfaces. This Skill detects and corrects these pitfalls, ensuring your domain remains framework-agnostic, your use cases stay isolated, and your repositories strictly implement domain contracts.

How do I generate a complete DDD module structure in NestJS?

Activate this Skill to automatically scaffold a full module including domain entities, value objects, aggregates, repository interfaces, application use cases, NestJS controllers, DTOs, presenters, and test files. The generated structure follows DDD and Clean Architecture principles with pre-configured patterns for separation of concerns and testability.

Do I need to refactor an existing NestJS codebase to use DDD and Clean Architecture?

Refactoring is optional but beneficial for maintainability. This Skill supports both greenfield projects and refactoring existing codebases by guiding extraction of domain logic into aggregates and entities, defining repository interfaces, isolating use cases, and gradually aligning infrastructure with architectural boundaries without breaking existing functionality.

How does this approach improve testability in NestJS projects?

DDD and Clean Architecture isolate business logic from framework and infrastructure dependencies, making domain entities, value objects, and use cases testable without NestJS bootstrapping. This Skill provides test scaffolding patterns that let you verify domain rules independently, then test NestJS integration separately with clear boundaries.