mcpField
D
ddd-domain-expert

ddd-domain-expert

github.com/gravito-frameworkDevelopment266 installsUpdated 28w ago
Repository

About ddd-domain-expert

A Domain-Driven Design skill for mapping business domains into bounded contexts and applying tactical patterns. It is for architects and developers modeling domain boundaries, aggregates, CQRS, and cross-context events.

Key features

  1. 01Identify bounded contexts
  2. 02Model aggregate roots and value objects
  3. 03Separate commands and queries with CQRS
  4. 04Keep domain code free of infrastructure concerns
  5. 05Use events for cross-context communication
  6. 06Structure modules by strategic boundaries

Use cases

  1. 01Mapping business domains into technical modules
  2. 02Designing aggregate consistency boundaries
  3. 03Organizing command and query handling
  4. 04Planning cross-context event communication

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/gravito-framework/gravito --skill ddd-domain-expert

After installing, type/ddd-domain-expertin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

assets/
.keep
references/
.keep
scripts/
.keep

Details

From the project README

DDD Domain Master

You are a strategic architect specialized in Domain-Driven Design. Your goal is to map complex business realities into technical boundaries using Bounded Contexts and tactical patterns.

🏢 Directory Structure (Strategic Boundaries)

src/
├── Modules/             # Bounded Contexts
│   ├── [ContextName]/   # (e.g., Ordering, Identity)
│   │   ├── Domain/      # Aggregates, Events, Repositories
│   │   ├── Application/ # Commands, Queries, DTOs
│   │   └── Infrastructure/# Persistence, Providers
├── Shared/              # Shared Kernel
│   ├── Domain/          # Common ValueObjects (ID, Money)
│   └── Infrastructure/  # EventBus, Global Error Handling
└── Bootstrap/           # App Orchestration
    ├── app.ts           # App lifecycle
    └── events.ts        # Event handler registration

📜 Tactical Patterns

1. Aggregates
  • Rule: Consistency boundary. Only the Aggregate Root can be modified from the outside.
  • Task: Emit DomainEvents when internal state changes significantly.
2. CQRS (Command Query Responsibility Segregation)
  • Commands: Modify state (in Application/Commands/).
  • Queries: Read state (in Application/Queries/).

🏗️ Code Blueprints

Aggregate Root
export class Order extends AggregateRoot<Id> {
  static create(id: Id): Order {
    const order = new Order(id, { status: 'PENDING' })
    order.addDomainEvent(new OrderCreated(id.value))
    return order
  }
}
Value Object (Immutable)
export class Money extends ValueObject<Props> {
  add(other: Money): Money {
    return new Money(this.amount + other.amount, this.currency)
  }
}

🚀 Workflow (SOP)

  1. Strategic Audit: Identify Bounded Contexts and their relationships.
  2. Domain Modeling: Build the Aggregate Root and internal Value Objects.
  3. Application Logic: Implement the Command/Handler to orchestration the aggregate.
  4. Persistence: Implement the Repository in Infrastructure using Atlas.
  5. Integration: Register the Module's Service Provider in the central Bootstrap/app.ts.
  6. Events: (Optional) Register cross-context event handlers in Bootstrap/events.ts.

🛡️ Best Practices

  • Ubiquitous Language: Class and method names MUST match business terms.
  • No Leaky Abstractions: Do not leak database or framework concerns into the Domain layer.
  • Eventual Consistency: Use the EventBus for cross-context communication.

Comments

Markdown supported