domain-driven-design
Audited by Runlayer on Feb 24, 2026
Malicious tool definition detected
Tool: SKILL.md [1/3] Description: --- name: domain-driven-design description: 'Model software around the business domain using bounded contexts, aggregates, and ubiquitous language. Use when the user mentions "domain modeling", "bounded context", "aggregate root", "ubiquitous language", or "anti-corruption layer".
Tool: SKILL.md [2/3] Description: state changes | | Immutable attributes | Value Object | `Address(street, city, zip)` -- replace, never mutate | | Consistency boundary | Aggregate Root | `Order` is root; `OrderLine` items exist only through it | | Cross-aggregate reference | Reference by ID | `Order` stores `customerId`, not a `Customer` object | | Concurrency control | Optimistic locking on root | Version field on `Order`; conflict if two edits race | See: [references/building-blocks.md](refer
Tool: SKILL.md [3/3] Description: context gets its own `Customer` model with only the attributes it needs | | Giant aggregates with many nested entities | Concurrency conflicts, slow loads, transactional bottlenecks | Keep aggregates small; reference other aggregates by ID; use eventual consistency between aggregates | | Anemic domain model (all logic in services) | Domain objects are data bags; business rules scatter across service classes; duplication and inconsistency | Move behavior into ent
Malicious tool definition detected
Tool: references/bounded-contexts.md [1/3] Description: # Bounded Contexts and Context Mapping A bounded context is the most important strategic pattern in Domain-Driven Design. It defines an explicit boundary within which a particular domain model is defined, consistent, and applicable.
Tool: references/bounded-contexts.md [2/3] Description: use:** When you need to integrate with a system whose model does not fit yours, and you cannot afford to let that foreign model leak into your domain. This is the most important defensive pattern in DDD. **Structure:** ``` Your Domain Layer <--> ACL (Adapters + Translators) <--> External System ``` The ACL contains: - **Adapters** that handle the technical protocol (HTTP, gRPC, message queue) - **Translators** that convert external model ob
Tool: references/bounded-contexts.md [3/3] Description: small contexts owned by the same team with heavy inter-communication; merge them and eliminate the translation overhead.
Malicious tool definition detected
Tool: references/building-blocks.md [1/3] Description: # Building Blocks: Entities, Value Objects, and Aggregates The tactical building blocks of Domain-Driven Design provide a vocabulary for structuring domain models. Entities, Value Objects, and Aggregates are the three most critical patterns. Getting them right determines whether a domain model is expressive and maintainable or bloated and fragile.
Tool: references/building-blocks.md [2/3] Description: an Entity to a Value Object) is much harder. ## Aggregates An Aggregate is a cluster of domain objects (entities and value objects) treated as a single unit for data changes.
Tool: references/building-blocks.md [3/3]
Malicious tool definition detected
Tool: references/domain-events.md [1/2] Description: # Domain Events A domain event represents something that happened in the domain that domain experts care about.
Tool: references/domain-events.md [2/2] Description: | Must be versioned and backward-compatible | | Naming | Uses internal ubiquitous language | Uses published language (shared schema) | | Transport | In-process event bus or same database | Message broker (Kafka, RabbitMQ, SNS) | ### Translation at the Boundary When a domain event crosses a bounded context boundary, it should be translated into an integration event that uses the published language: 1.
Malicious tool definition detected
Tool: references/repositories-factories.md [1/2] Description: # Repositories and Factories Repositories and Factories are infrastructure-facing patterns in Domain-Driven Design that separate domain logic from persistence and object creation concerns. The Repository provides the illusion of an in-memory collection of aggregates.
Tool: references/repositories-factories.md [2/2] Description: cart is not empty # Converts cart items to OrderLineItems # Calculates initial total # Returns a fully valid Order order = Order( id=OrderId.generate(), customer_id=customer_id, status=OrderStatus.PENDING, items=[OrderLineItem.from_cart_item(item) for item in cart.items], total=cart.calculate_total() ) order._raise_event(OrderCreated(...)) return order ``` **Advantages:** Creation logic lives close to the aggregate.
Malicious tool definition detected
Tool: references/strategic-design.md [1/3] Description: # Strategic Design and Distillation Strategic design is the practice of identifying which parts of a system matter most and allocating design effort accordingly.
Tool: references/strategic-design.md [2/3] Description: A Domain Vision Statement is a short document (one page or less) that describes the Core Domain's value proposition and its most important aspects.
Tool: references/strategic-design.md [3/3]
Malicious tool definition detected
Tool: references/ubiquitous-language.md [1/2] Description: # Ubiquitous Language The single most important practice in Domain-Driven Design. A ubiquitous language is the shared vocabulary between developers and domain experts that is used everywhere -- in conversation, documentation, code, tests, and diagrams. It is not a glossary appended to a wiki.
Tool: references/ubiquitous-language.md [2/2] Description: | Term | Definition | Context | Example | |------|-----------|---------|---------| | Claim | A formal request for payment under an insurance policy following a covered event | Claims processing | "The policyholder filed a claim for water damage" | | Adjudication | The process of evaluating a claim to determine whether it is covered and how much to pay | Claims processing | "The claim is in adjudication pending the damage assessment" | |