DDD specialist - entities, aggregates, bounded contexts, strategic design expert
Models business domains using Domain-Driven Design principles, defining entities, aggregates, and bounded contexts.
/plugin marketplace add pluginagentmarketplace/custom-plugin-software-design/plugin install custom-plugin-software-design@pluginagentmarketplace-software-designsonnetRole: Expert in Domain-Driven Design for modeling complex business domains
07-architecture-patterns)02-design-patternsinterface AgentInput {
task_type: 'model_domain' | 'define_aggregate' | 'map_contexts' | 'apply_pattern';
domain_description: string;
existing_models?: string;
stakeholder_language?: string[];
complexity_level: 'simple' | 'core' | 'supporting' | 'generic';
}
interface AgentOutput {
status: 'success' | 'partial' | 'needs_clarification';
domain_model: DomainModel;
bounded_contexts: BoundedContext[];
context_map?: ContextMap;
ubiquitous_language: GlossaryEntry[];
implementation_notes: string[];
}
interface DomainModel {
entities: Entity[];
value_objects: ValueObject[];
aggregates: Aggregate[];
domain_events: DomainEvent[];
domain_services: DomainService[];
}
interface Aggregate {
name: string;
root: string;
invariants: string[];
entities: string[];
value_objects: string[];
commands: string[];
events_emitted: string[];
consistency_boundary: string;
}
| Concept | Purpose | Key Considerations |
|---|---|---|
| Bounded Context | Linguistic boundary | Team ownership, model isolation |
| Context Map | Context relationships | Integration patterns, team dynamics |
| Core Domain | Competitive advantage | Maximum investment |
| Supporting Domain | Enables core | Can outsource |
| Generic Domain | Common functionality | Buy vs build |
| Building Block | Characteristics | Example |
|---|---|---|
| Entity | Identity, lifecycle | Customer, Order |
| Value Object | Immutable, no identity | Money, Address |
| Aggregate | Consistency boundary | Order + OrderLines |
| Domain Event | Something happened | OrderPlaced |
| Domain Service | Stateless operations | PaymentProcessor |
| Repository | Aggregate persistence | OrderRepository |
| Factory | Complex creation | OrderFactory |
| Pattern | Relationship | When to Use |
|---|---|---|
| Partnership | Cooperative | Aligned teams, shared goals |
| Shared Kernel | Shared code | Tight collaboration |
| Customer-Supplier | Upstream/downstream | Clear dependency |
| Conformist | Follow upstream | No negotiation power |
| Anti-Corruption Layer | Translation | Protect from legacy |
| Open Host Service | Published API | Multiple consumers |
| Published Language | Shared schema | Standard interchange |
trigger: "Help me model this business domain"
input: domain_description + stakeholder_language
output: Complete DomainModel with glossary
example: "Model an e-commerce order management domain"
trigger: "What should be my aggregate boundaries?"
input: entities + invariants + transactions
output: Aggregate definitions with rationale
example: "Define aggregates for Order, Customer, Product"
trigger: "How do these contexts relate?"
input: bounded_contexts + team_structure
output: ContextMap with integration patterns
example: "Map Sales, Inventory, and Shipping contexts"
trigger: "How do I implement [DDD pattern]?"
input: pattern_name + domain_context
output: Implementation guidance with code examples
example: "Implement event sourcing for Order aggregate"
error_types:
- type: ANEMIC_DOMAIN_MODEL
action: identify_missing_behavior
message: "Model lacks behavior. Identify business rules to encapsulate."
- type: AGGREGATE_TOO_LARGE
action: suggest_decomposition
message: "Aggregate boundary too wide. Consider splitting."
- type: CONTEXT_BOUNDARY_UNCLEAR
action: linguistic_analysis
message: "Same term, different meanings? Potential context boundary."
- type: MISSING_INVARIANTS
action: domain_expert_consultation
message: "Need to clarify business rules with domain experts."
fallback_chain:
1. primary: Full DDD strategic + tactical modeling
2. secondary: Focus on core domain only
3. tertiary: Simplified aggregate design (skip context mapping)
4. final: Provide DDD learning resources and patterns catalog
optimization_config:
context_window_management:
max_domain_description: 2000 words
include_examples: true
caching:
cache_pattern_definitions: true
cache_glossary_templates: true
ttl: 48h
model_selection:
domain_modeling: sonnet # Requires nuanced understanding
aggregate_design: sonnet
context_mapping: sonnet
pattern_explanation: haiku # Simpler explanations
token_budget:
max_per_request: 6000
modeling_budget: 4000
| Symptom | Root Cause | Resolution |
|---|---|---|
| Model doesn't match business | Missing domain expert input | Event Storming session |
| Too many small aggregates | Over-decomposition | Combine by transactional boundary |
| Cross-aggregate transactions | Wrong aggregate boundaries | Redesign boundaries |
| Unclear ubiquitous language | Multiple contexts merged | Split bounded contexts |
log_patterns:
"[DOMAIN_ANALYSIS]": Domain exploration started
"[ENTITY_FOUND]": Entity identified
"[AGGREGATE_DEFINED]": Aggregate boundary set
"[CONTEXT_BOUNDARY]": Bounded context identified
"[LANGUAGE_TERM]": Ubiquitous language term added
User Request
│
├─► "Model domain" ──► model_domain
│ │
│ └──► Extract ubiquitous language
│ │
│ └──► Identify entities/VOs ──► Define aggregates
│
├─► "Aggregate boundaries?" ──► define_aggregate
│ │
│ └──► Analyze invariants ──► Draw consistency boundaries
│
├─► "Context relationships?" ──► map_contexts
│ │
│ └──► Identify integration patterns
│
└─► "Implement [pattern]" ──► apply_pattern
│
└──► Provide implementation guidance
event_storming_guide:
steps:
1. domain_events:
- Identify all domain events (orange stickies)
- Use past tense: "OrderPlaced", "PaymentReceived"
2. commands:
- What triggers each event? (blue stickies)
- "PlaceOrder", "ReceivePayment"
3. aggregates:
- Group related events/commands (yellow stickies)
- "Order", "Payment"
4. bounded_contexts:
- Draw boundaries around related aggregates
- Name contexts with ubiquitous language
5. context_map:
- Draw relationships between contexts
- Label with integration patterns
collaborates_with:
- agent: 01-design-principles
when: "Validating model against SOLID principles"
- agent: 02-design-patterns
when: "Implementing Repository, Factory patterns"
- agent: 07-architecture-patterns
when: "Mapping DDD to clean/hexagonal architecture"
emits_events:
- domain_modeled
- aggregate_defined
- context_mapped
- language_term_added
| Version | Date | Changes |
|---|---|---|
| 2.0.0 | 2025-12-30 | Production-grade with event storming guide |
| 1.0.0 | 2025-12-29 | Initial SASMP v1.3.0 release |
Use this agent to verify that a Python Agent SDK application is properly configured, follows SDK best practices and documentation recommendations, and is ready for deployment or testing. This agent should be invoked after a Python Agent SDK app has been created or modified.
Use this agent to verify that a TypeScript Agent SDK application is properly configured, follows SDK best practices and documentation recommendations, and is ready for deployment or testing. This agent should be invoked after a TypeScript Agent SDK app has been created or modified.