ddd-clean-architecture

Implement DDD and clean architecture layers in ASP.NET Core Web APIs.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/bowlneba/neba-management --skill ddd-clean-architecture
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ddd-clean-architecture
Source: https://github.com/bowlneba/neba-management/tree/main/.claude/skills/ddd-clean-architecture
Command: npx skills add https://github.com/bowlneba/neba-management --skill ddd-clean-architecture

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill addresses the challenges of building complex, maintainable, and scalable backend services by guiding the implementation of industry-standard architectural patterns. It helps avoid tangled codebases, inconsistent domain logic, and difficult-to-evolve systems, ensuring your backend is structured for long-term success.

Core Features & Use Cases

  • Strategic Domain Modeling: Guides the identification of Ubiquitous Language, Bounded Contexts, and the Core Domain to ensure a deep understanding of business logic.
  • Clean Architecture Layers: Structures your ASP.NET Core Web API into distinct layers (Domain, Application, Infrastructure, Presentation) with clear dependency rules, promoting separation of concerns.
  • Tactical DDD Patterns: Implements patterns like Entities, Value Objects, Aggregates, Domain Events, and the Repository Pattern to encapsulate business rules and manage complexity effectively.
  • Use Case: When starting a new microservice or refactoring a critical backend component, use this Skill to ensure the implementation adheres to best practices for maintainability, testability, and scalability from day one.

Quick Start

Implement a new feature in the 'Order Management' bounded context, ensuring it follows DDD principles and clean architecture for an ASP.NET Core Web API.

Frequently Asked Questions about ddd-clean-architecture

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

FAQPage Schema
How do I structure an ASP.NET Core Web API using domain-driven design and clean architecture?

Domain-driven design with clean architecture organizes your ASP.NET Core Web API into four layers—Domain, Application, Infrastructure, and Presentation—each with clear responsibilities. The Domain layer encapsulates business logic through Entities, Value Objects, and Aggregates; the Application layer orchestrates use cases via Commands and Queries; Infrastructure handles persistence and external services; Presentation exposes Controllers or Minimal APIs. This separation enforces dependency inversion and keeps your codebase maintainable as complexity grows.

What are Bounded Contexts and why do they matter in backend API design?

Bounded Contexts are distinct areas of your business domain where specific terminology and rules apply consistently. In ASP.NET Core backend development, they help you partition large systems into manageable microservices or modules, each with its own domain model and persistence strategy. Using Bounded Contexts prevents ambiguity, reduces coupling, and ensures your API evolves without cross-domain contamination.

How do I implement Domain Events, Entities, and Value Objects in ASP.NET Core?

Domain Events represent state changes important to your business and are raised by Aggregates when actions occur. Entities are mutable domain objects with unique identity; Value Objects are immutable and defined by their attributes. Implement them in your Domain layer, keep them persistence-ignorant, and wire events through your Application layer to trigger side effects like notifications or state updates, using patterns like the Repository Pattern for data access.

Can I use clean architecture with ASP.NET Core's Entity Framework Core?

Yes. Entity Framework Core maps your Domain Aggregates to the database while maintaining persistence ignorance in your Domain layer through Repository and Unit of Work patterns. Place EF Core DbContext and mappings in the Infrastructure layer, expose data access through interfaces defined in the Application layer, and keep your business logic free of EF-specific dependencies. This allows you to swap persistence implementations without affecting domain rules.

When should I refactor an existing ASP.NET Core API to use clean architecture and DDD?

Refactor when your codebase shows tangled business logic, difficult-to-test controllers, or inconsistent domain patterns across endpoints. Clean architecture and DDD payoff most when building microservices, managing multiple Bounded Contexts, or maintaining complex feature-driven backends where long-term evolution matters. For simple CRUD APIs with minimal business logic, the overhead may not justify the investment.

What SOLID principles and patterns enforce clean architecture in ASP.NET Core?

Dependency Inversion (inject abstractions, not concrete classes), Single Responsibility (each class has one reason to change), and Open/Closed (extend via interfaces, not modification) are core. Clean architecture enforces these through layering, the Repository Pattern for data abstraction, Specifications for query logic, FluentValidation for cross-cutting concerns, and the ErrorOr result pattern for consistent error handling across your API.