abp-ddd

Implements domain-driven design patterns for entities, repositories, and domain services in ABP projects.

Updated Jul 21, 2026
One-click install
npx skills add https://github.com/afonsoft/gamehub --skill abp-ddd-afonsoft
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: abp-ddd
Source: https://github.com/afonsoft/gamehub/tree/main/.claude/skills/abp-ddd
Command: npx skills add https://github.com/afonsoft/gamehub --skill abp-ddd-afonsoft

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Designing the domain layer in ABP-based .NET applications often leads to anemic entities, misplaced repositories, and leaked business logic. This Skill provides concrete patterns and anti-patterns for building a rich domain model that enforces invariants and keeps business rules inside the domain layer. ## Core Features & Use Cases - Rich Domain Modeling: Create entities and aggregate roots with private setters, behavior methods, and invariant enforcement instead of anemic data containers. - Repository & Domain Service Guidance: Apply the one-repository-per-aggregate-root rule and implement domain services (Manager classes) for logic spanning multiple aggregates. - Domain Events & Specifications: Publish local and distributed events from aggregates and encapsulate reusable query conditions with the Specification pattern. - Use Case: When adding an Order aggregate to an ABP application, use this Skill to structure the entity, its OrderLine child entities, an IOrderRepository interface, an OrderManager domain service, and OrderCompleted events correctly. ## Quick Start Ask the AI to create an ABP aggregate root with child entities, a repository interface, and a domain service following DDD best practices.

Frequently Asked Questions about abp-ddd

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

FAQPage Schema
How do I create an aggregate root in ABP framework?▼

Inherit from AggregateRoot<TKey>, use private setters with behavior methods, and enforce invariants in the primary constructor. Accept the id as a parameter generated externally via IGuidGenerator, and include a protected parameterless constructor for ORM compatibility.

When should I create a custom repository in ABP?▼

Create a custom repository only when you need query methods beyond simple CRUD, since the generic IRepository<T, TKey> covers basic operations. Define the interface in the Domain layer and the implementation in the data layer, and only for aggregate roots.

Can I create a repository for child entities in ABP DDD?▼

No, only aggregate roots should have repositories. Child entities must be accessed and modified through their aggregate root so business rules are enforced; creating child repositories bypasses invariants and breaks data consistency.

What is the difference between local and distributed domain events in ABP?▼

Local events via AddLocalEvent are handled within the same transaction and can access the full entity. Distributed events via AddDistributedEvent are handled asynchronously across modules or services and use ETOs (Event Transfer Objects) containing only serializable data.

Why should entities avoid public setters in domain-driven design?▼

Public setters create anemic entities where validation logic leaks into services. Rich domain models use private setters with methods like SetCount that enforce invariants, keeping business rules inside the entity where they belong.