ddd-tactical-patterns

Guide Domain-Driven Design tactical patterns for aggregate design and domain logic.

2|Updated Mar 15, 2025
One-click install
npx skills add https://github.com/dandudzi/dotfiles --skill ddd-tactical-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ddd-tactical-patterns
Source: https://github.com/dandudzi/dotfiles/tree/main/dot_claude/skills/ddd-tactical-patterns
Command: npx skills add https://github.com/dandudzi/dotfiles --skill ddd-tactical-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide and implementation patterns for Domain-Driven Design's tactical design elements, enabling developers to build more robust, maintainable, and domain-aligned software.

Core Features & Use Cases

  • Aggregate Design: Learn to design aggregates with invariants first, ensuring business rules are strictly enforced.
  • Value Objects: Implement immutable value objects for better type safety and data integrity.
  • Domain Events: Understand how to model and emit domain events for asynchronous communication and auditing.
  • Repository Pattern: Apply the repository pattern for clean data access abstraction.
  • Domain Services: Structure complex domain logic that spans multiple aggregates.
  • Use Case: When building an e-commerce platform, use these patterns to model the Order aggregate, ensuring that an order cannot be confirmed if it has no items or if its status is already CONFIRMED.

Quick Start

Implement an aggregate root for an order, ensuring it enforces invariants like 'Order must have at least one item' and 'Cannot add items to a confirmed order'.

Frequently Asked Questions about ddd-tactical-patterns

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

FAQPage Schema
How do I design a domain-driven design aggregate that enforces business invariants?

Design a domain-driven design aggregate by defining the aggregate root to strictly enforce invariants, ensuring business rules like required order items or status transitions are validated before state changes occur.

When should I use immutable value objects in domain-driven design?

Use immutable value objects in domain-driven design to guarantee type safety and data integrity for domain attributes, ensuring that once created, the object's state cannot be altered.

What is the best way to model domain events for asynchronous communication?

The best way to model domain events is to emit them directly from within your aggregates during state transitions, capturing business facts for asynchronous communication and auditing across bounded contexts.

Do I need object-oriented programming principles to implement tactical DDD patterns?

Yes, implementing tactical DDD patterns requires adherence to object-oriented principles and domain modeling best practices to properly encapsulate business logic within bounded contexts.

Where should complex domain logic that spans multiple aggregates be structured?

Complex domain logic spanning multiple aggregates should be structured within a domain service, keeping the logic outside of individual aggregate roots while maintaining domain alignment.

How to apply the repository pattern for clean data access in domain modeling?

Apply the repository pattern to provide a clean data access abstraction, allowing your domain layer to persist and retrieve aggregates without coupling to underlying infrastructure or database details.