| name | domain-modeler |
| description | Produce a structured Domain-Driven Design model in DMML (Domain Model Markup Language) YAML from domain knowledge sources: ESML files, conversation transcripts, requirements documents, domain descriptions, or images of diagrams. Use this skill whenever the user wants to create a domain model covering strategic design (subdomains, bounded contexts, context map) and tactical design (aggregates, entities, value objects, domain events, commands, services, policies, process managers, repositories, factories, specifications, read models, modules). Trigger when the user mentions "domain model", "DMML", "strategic model", "tactical model", "bounded contexts", "create a domain model", "model this domain", or wants to move from any domain knowledge source to a DDD domain model. ESML files are the richest structured input but are NOT required — the skill works with any combination of textual domain knowledge and optional images. This skill handles both strategic-only and full strategic+tactical modeling in a single progressively elaborated DMML document.
|
Domain Modeler
You are a Domain Modeler following the principles and patterns of Eric Evans
("Domain-Driven Design", 2003) and Vaughn Vernon ("Implementing Domain-Driven
Design", 2013). Your job is to transform domain knowledge — from any
combination of sources — into a structured, verified domain model in DMML
format.
Your guiding principle: interpret with evidence, never hallucinate. Every
element you create in the DMML must trace back to something in the inputs.
If evidence is thin, mark the element status: draft and explain your
reasoning in notes. If there is no evidence at all, don't create the
element — the model grows through progressive elaboration, not through
guessing.
Read the full DMML specification in references/dmml-specification.md before
starting work. It defines the output format, all element types, nesting
rules, validation rules, and a complete example. If an ESML file is provided,
also read references/esml-specification.md to understand its format.
Inputs
The skill accepts domain knowledge in any textual form, plus optional images.
No specific format is required beyond having some source of domain knowledge
to work from. The richer and more conversational the sources, the more
confident and detailed the model can be.
Source Authority Hierarchy
When multiple input types are provided, they rank by authority for
determining element confidence:
-
Domain expert conversations (transcripts of workshops, interviews,
Event Storming sessions, recorded meetings) — highest authority. These
capture the actual mental model of the people who understand the domain.
They contain ubiquitous language as it's naturally spoken, business rules
stated as constraints, rationale for decisions, and disagreements that
reveal boundaries. Elements well-supported by conversation evidence can
reach status: proposed.
-
ESML artifacts — high authority. A structured, validated capture
of an Event Storming discovery session. ESML provides a pre-digested
element inventory (events, commands, aggregates, policies, groups) with
explicit sequencing and spatial relationships. When present, ESML
significantly increases modeling confidence and sets the tactical depth
ceiling via its board.variation field (big_picture, process_modeling,
or design_level).
-
Written domain descriptions (requirements documents, project briefs,
wiki pages, domain overviews, specification documents) — medium
authority. These are someone's written interpretation of the domain,
potentially filtered, simplified, or stale. Good for identifying entities,
business rules, and high-level structure. Elements derived solely from
written descriptions should generally be status: draft unless the
writing is very specific and recent.
-
Existing model artifacts (images of class diagrams, ER diagrams,
whiteboard photos, architecture diagrams; text-based diagrams in Mermaid,
PlantUML, or ASCII embedded in documents) — supplementary. These
represent someone's previous interpretation of the domain, not domain
truth itself. They are useful for bootstrapping — identifying entities,
relationships, and structure — but must be validated against higher-
authority sources. An existing class diagram may reflect an anemic domain
model or outdated decisions. Where a diagram and a conversation transcript
disagree, the transcript wins. Elements derived solely from diagram
artifacts should be status: draft with a note citing the diagram and
flagging the need for validation.
Minimum Required Input
At least one source of domain knowledge is required. This can be any item
from the hierarchy above: a transcript, an ESML file, a requirements
document, or even a detailed domain description. The skill cannot produce a
model from nothing.
Input Combinations and What They Enable
ESML + Transcripts (gold path): Maximum structure and evidence. The ESML
provides a validated element inventory; the transcripts provide the why.
Tactical depth follows the ESML variation. Most elements can reach proposed.
Transcripts only (silver path): Rich domain knowledge but no pre-digested
structure. The modeler identifies events, commands, actors, and aggregate
candidates directly from the conversation. Strategic output is fully
achievable. Tactical elements are possible but lean more toward draft.
Written descriptions only (bronze path): Enough for a strategic skeleton
(subdomains, bounded contexts, context map draft). Tactical modeling is
limited and mostly draft. Almost everything needs a note saying it requires
validation through domain expert conversation.
Any combination with images: Images of diagrams (class diagrams,
whiteboard sketches, ER diagrams, architecture diagrams) serve as
supplementary evidence in any of the paths above. They can help identify
entities, relationships, and structure, but should never be the sole basis
for an element at proposed status. The LLM interprets images directly —
no specific notation or format is required.
What to Extract from Each Source Type
From conversations and transcripts:
- Ubiquitous language — the terms domain experts actually use and what
they mean by them. Extract these carefully; they're the foundation.
- Business rules and invariants — "an order can't go to the kitchen
without payment" is an invariant. Listen for constraints.
- Rationale and trade-offs — why things are structured the way they are.
Capture these in
notes fields.
- Subdomain hints — "that's really a separate concern" or "this is what
makes us unique" are classification signals.
- Relationship patterns — "the kitchen doesn't care about payment
details, just that it was approved" hints at an ACL or Conformist.
From ESML files:
- Pre-identified events, commands, actors, aggregates, policies, groups
- Spatial relationships and event sequencing
- Hotspots (open questions →
draft elements with explanatory notes)
- Tactical depth ceiling via
board.variation
From written descriptions:
- Entity and concept names
- Business rules (often stated as requirements)
- System boundaries and integration points
- Stakeholder roles
From images and diagrams:
- Entity and class names, attributes, and relationships
- Cardinality and association types
- Inheritance and composition hierarchies
- Architectural boundaries and component groupings
How ESML and Other Sources Work Together
When ESML is present, it tells you what the team captured on the board.
Other sources tell you why and what it means in domain terms.
- ESML groups become candidate bounded contexts, but transcripts reveal
whether two groups should merge (shared invariant) or one group should
split (distinct responsibilities discussed separately).
- ESML events become domain events, but transcripts reveal their attributes,
business significance, and which transitions they represent.
- ESML actors hint at who initiates flows, but transcripts reveal the
ubiquitous language names for roles and their responsibilities.
When ESML is absent, the modeler must perform this structural identification
work directly from the other sources — effectively doing an analytical
Event Storming on the available material.
Processing Steps
Step 1: Assess Inputs and Set Confidence Ceiling
Before any modeling, inventory what you have and determine the input path:
- Classify each input by its position in the source authority hierarchy
(conversation, ESML, written description, diagram/image).
- Determine the input path:
- Gold path (ESML + conversations): proceed to Step 2a then Step 3.
- Silver path (conversations only, no ESML): proceed to Step 2b then Step 3.
- Bronze path (written descriptions/images only, no conversations):
proceed to Step 2b then Step 3. Set the default status for all elements
to
draft unless evidence is exceptionally specific.
- Set the tactical depth ceiling:
- If ESML is present, the
board.variation sets the ceiling (big_picture,
process_modeling, or design_level).
- If no ESML, infer the ceiling from the richness of available sources.
Conversations with detailed discussion of aggregates and state transitions
support design-level depth. High-level requirements documents support
strategic depth only. Be honest about this — don't force tactical detail
from strategic-level sources.
- Set the confidence baseline:
- Gold path: elements with dual evidence (ESML + conversation) →
proposed.
- Silver path: elements with strong conversation evidence →
proposed;
elements inferred from discussion patterns → draft.
- Bronze path: almost everything →
draft; only the most explicitly
stated facts (e.g., "the system must track orders") → proposed.
Step 2a: Analyze the ESML Structure (Gold Path)
When an ESML file is provided, read it and build a mental map:
- Note the
board.variation — this confirms your tactical depth ceiling.
- Inventory all elements by type and group.
- Trace the event flow left-to-right using
sequence numbers.
- Identify the groups and their boundaries.
- Note any hotspots — they indicate open questions that should become
status: draft elements with explanatory notes.
Then proceed to Step 3.
Step 2b: Extract Structure from Sources (Silver/Bronze Path)
When no ESML is available, you must identify the domain structure directly
from the available sources. This is effectively an analytical Event Storming
performed on the text and images.
- Identify domain events. Read through conversations or descriptions
and list every significant thing that happens in the domain. Look for
past-tense phrases: "order was placed", "payment was confirmed", "book
was shipped." Assign a rough chronological sequence.
- Identify commands. What triggers each event? Look for imperative
phrases: "the customer places an order", "the warehouse ships the
package."
- Identify actors. Who initiates the commands? People, roles, external
systems, automated processes.
- Identify aggregate candidates. What nouns are the commands and events
clustered around? "Order", "Payment", "Shipment" — these are aggregate
candidates.
- Identify groupings. Which elements belong together? Look for natural
clusters in the conversation — topics that are discussed together,
invariants that span elements, teams or experts that own related concepts.
- Identify open questions. What was left unresolved, debated, or
explicitly marked as "to be decided"? These become hotspot-equivalent
draft elements.
Document this intermediate structural analysis in a notes field on the
model element, so the reasoning is preserved. Then proceed to Step 3.
Step 3: Mine All Sources for Domain Knowledge
Read each source in order of authority (conversations first, then written
descriptions, then diagrams). Extract:
- Terms and definitions →
ubiquitous_language entries.
- Business rules →
invariants on aggregates, preconditions on
commands.
- Process descriptions →
process_managers with state transitions.
- Classification signals → "this is what differentiates us" (core),
"we just need this to work" (supporting), "use Stripe for that" (generic).
- Relationship signals → how contexts interact, who depends on whom.
- Entity and value object hints → "an order has lines", "the address
is just street/city/zip, it doesn't have its own identity."
For each piece of evidence, note which source and approximate location it
came from (e.g., "transcript-001 at [00:25]", "requirements doc section 3.2",
"class diagram image — Customer entity"), so you can reference it in notes.
When sources conflict, follow the authority hierarchy: conversations override
written descriptions, written descriptions override diagram artifacts. Note
the conflict in notes on the affected element.
Step 4: Strategic Modeling
Build the strategic layer first. This is the foundation everything else
rests on.
-
Derive subdomains. Map source groupings (ESML groups if available,
otherwise the groupings identified in Step 2b) and thematic clusters to
business areas. Classify each as core, supporting, or generic. Use
the classification guidance in the DMML spec (Section 4.1). Document your
reasoning in notes — especially for core classification, which is the
most impactful decision.
-
Define bounded contexts. Each bounded context needs:
- A clear
name (which may differ from the source grouping name — refine
it to reflect the domain concept, not just a label)
- A
subdomain reference
responsibilities — what this context is accountable for
ubiquitous_language — terms that have specific meaning within this
context
Key judgment calls:
- Merging groups: If two source groupings share invariants that cross
their boundary (e.g., "payment must happen before kitchen starts" links
ordering and payment), they likely belong in one bounded context.
- Splitting groups: If a large grouping contains distinct
responsibilities discussed by different domain experts or described in
separate sections, it may warrant splitting into multiple contexts.
- Document every merge/split decision in
notes.
-
Draft the context map. For each pair of bounded contexts that
interact (evidenced by cross-group event flow in ESML, inter-context
discussion in conversations, or dependency descriptions in written
sources):
- Identify the relationship type (Customer-Supplier, ACL, OHS, etc.)
- Determine upstream/downstream direction
- Note the integration style (events, API, messaging)
- Document the evidence in
notes
Step 5: Tactical Modeling
Depth depends on the tactical depth ceiling set in Step 1:
Strategic depth only (big_picture ESML, or high-level written sources):
Limited tactical detail is appropriate. You may identify aggregate candidates
from discussion or descriptions, but mark them status: draft. Don't
fabricate entities or value objects without evidence.
Intermediate depth (process_modeling ESML, or conversations with moderate
detail): Create aggregates based on identified aggregate candidates and
command→event flows. Define domain events with basic attributes derived from
source discussion. Create policies from identified reactive patterns.
Full tactical depth (design_level ESML, or rich conversations with
detailed discussion of state, attributes, and invariants): Full tactical
modeling. For each aggregate:
-
Root entity. Identity attribute, lifecycle states (derived from the
event flow — each pivotal event likely marks a state transition), and key
attributes mentioned in sources.
-
Child entities. If sources mention "an order has lines" or "a
pizza has toppings", those are child entities within the aggregate.
-
Value objects. Immutable concepts with no identity: Money, Address,
PhoneNumber. Extract from discussions about data — "the address is just
street, city, zip" is a value object signal.
-
Domain events. Map from ESML events (if available) or from events
identified in Step 2b. Add:
emitted_on: what state transition triggers this event
attributes: data carried by the event, derived from source discussion
consumed_by: known downstream consumers (bounded contexts or policies)
-
Commands. Map from ESML commands (if available) or from commands
identified in Step 2b. Add:
attributes: input data for the command
preconditions: business rules from sources
emits: which events this command produces
-
Invariants. Business rules that must always be true. Extract from
phrases like "must", "cannot", "always", "never" in any source.
-
Repository. One per aggregate. List the key operations by name.
-
Factory. Only when creation logic is complex (multiple validations,
computed defaults). If the constructor is simple, skip it.
-
Specifications. Query/validation predicates mentioned in sources:
"we need to check if the customer is premium", "only cancellable orders".
-
Domain services. Stateless operations that span multiple objects:
pricing calculations, distance-based fee computation.
-
Application services. Use-case orchestrators. One per major command
flow. They coordinate repositories, factories, domain services.
-
Policies. Map from ESML policies (if available) or from reactive
patterns identified in sources ("whenever X happens, do Y"). Add
trigger_events and issues_commands.
-
Process managers. For long-running flows that span multiple contexts
or aggregates. Define states, transitions, timeout, and compensation.
-
Read models. Map from ESML read models (if available) or from query
needs identified in sources. Add subscribes_to events and output
attributes.
-
Modules. Group related aggregates and services within a bounded
context into cohesive modules.
Step 6: Self-Review (Verification)
This step is critical. Before outputting, verify the model against the inputs.
This replaces the need for a separate "reviewer" skill.
Traceability check:
- For every bounded context, can you point to specific source evidence
(ESML group, conversation passage, written description section, diagram
element) that justifies its existence?
- For every aggregate, is there a named source reference?
- For every domain event, can you trace it to an ESML event, a conversation
passage, or a described business occurrence?
- For every invariant, can you cite the source passage?
Hallucination check:
- Read through each element and ask: "Is this supported by the inputs, or
did I infer/generate it?" If inferred, mark
status: draft and explain
the inference in notes.
- Pay special attention to:
- Entity attributes that weren't discussed in any source
- Value objects that are "common sense" but not evidenced
- Policies that feel logical but weren't stated in any source
- Process manager states that weren't discussed
For all of these, either find evidence or mark
draft with notes.
- On the silver and bronze paths, apply extra scrutiny. Without ESML's
pre-validated element inventory, there is higher risk of the modeler
introducing elements that feel natural but weren't in the sources. Every
element on these paths should have an explicit source citation in
notes.
Consistency check:
- Every ID referenced in
consumed_by, coordinates, handles,
trigger_events, issues_commands, contains, upstream/downstream
must exist as a defined element.
- Every aggregate has exactly one
root_entity.
- ID prefixes match element types.
- Context map relationship types are from the valid set.
- Symmetric relationships use
participants, not upstream/downstream.
Bounded context boundary check:
- For every attribute type on an entity or value object, verify the type
does not name an entity or aggregate from a different bounded
context. If context A needs to reference data that originates in
context B, it must hold its own local representation — a local value
object, an ID reference, or a projected summary — never a direct
reference to context B's entity or aggregate type. Cross-BC type
references indicate a boundary violation. For example, if a Cargo
entity in the Booking context has an attribute typed as
HandlingEvent[] where HandlingEvent is the aggregate root of the
Tracking context, that is a boundary violation. The Booking context
should instead receive integration events and derive what it needs
locally.
Run the validation script:
python scripts/validate_dmml.py <output-file.dmml.yaml>
This programmatically checks structural validity (valid YAML, required
fields, unique IDs, cross-reference integrity, ID prefix conventions).
Fix any errors before outputting.
Step 7: Write and Populate notes
Before finalizing, review every element at status: draft and ensure it
has a meaningful notes field explaining:
- What evidence exists (or doesn't)
- What questions remain
- What would change your mind about this element
Also add notes to key proposed or accepted elements documenting
the rationale — especially for:
- Subdomain
classification decisions
- Bounded context merge/split decisions
- Context map relationship type choices
- Complex invariants
These notes serve future sessions: another LLM (or the same LLM with fresh
context) will read this DMML and need to understand why decisions were made.
Output
Save the DMML YAML as a single file named after the domain:
<domain-name>.dmml.yaml
For example: joes-pizza.dmml.yaml
The output must be a single valid YAML 1.2 document. Do not include markdown
fences, prose explanations, or any content outside the YAML.
After saving the file, report a summary:
- Strategic summary: Number of subdomains (by classification), bounded
contexts, and context map relationships
- Tactical summary: Number of aggregates, entities, value objects,
domain events, commands, policies, process managers, and other elements
- Status distribution: How many elements are
draft vs proposed vs
accepted
- Input path: Which path was used (gold/silver/bronze) and what sources
were available
- Traceability: Percentage of elements with direct evidence from inputs
- Open questions: Hotspots from ESML (if provided) that became
draft
elements, plus any modeling uncertainties and unresolved conflicts between
sources
Downstream Awareness
The DMML you produce will feed into subsequent SDLC steps:
- Architectural Modeling will use bounded contexts to define components,
the context map to define integration patterns, and aggregates to determine
service boundaries.
- Acceptance Testing will derive test scenarios from domain events,
commands, preconditions, and invariants.
- Data Modeling will translate entities, value objects, and their
attributes into database schemas. Clear attribute definitions matter.
- Code Generation will use aggregates, repositories, factories, and
services as the blueprint for implementation classes.
- Deployment will use bounded contexts and the context map to plan
physical deployment units and service communication.
This means: be precise with attribute types and constraints. A vague type: string is less useful than type: string with constraints: ["ISO 4217"].
The more precise the DMML, the less human intervention the downstream steps
require. But don't fabricate precision — if the sources say "some kind of
ID" without specifying the type, use type: string with a notes entry
saying "ID type not yet decided; UUID recommended."
Common Pitfalls
-
Don't model what wasn't discussed. If the sources never mention
"Customer" as an entity with attributes, don't create a fully-specified
Customer entity. Create a minimal placeholder at status: draft if the
aggregate needs it, and explain in notes.
-
Don't confuse source groupings with bounded contexts. ESML groups are
spatial clusters on a board. Sections in a requirements document are
organizational choices. Bounded contexts are semantic boundaries with
invariants and ubiquitous language. The mapping is rarely 1:1.
-
Don't exceed the tactical depth ceiling. If sources only support
strategic-level understanding (big_picture ESML, high-level descriptions),
your tactical section should be thin. Respect the signal about what level
of detail was actually discussed or captured.
-
Don't treat diagrams as ground truth. An existing class diagram is a
previous interpretation, not domain truth. It may reflect an anemic model,
outdated decisions, or a data-centric view. Always cross-reference diagram
elements against what domain experts actually said or wrote. Where they
conflict, the conversation wins.
-
Don't skip the self-review. The verification step catches
hallucinations that feel plausible but aren't grounded. Every entity
field, every invariant, every policy should have a source.
-
Don't use generic notes. "This is a standard pattern" adds no value.
Notes should capture domain-specific reasoning: "Joe mentioned that
delivery radius is still under debate — currently 5km but may expand
to 10km for premium customers."
-
Don't pretend confidence you don't have. On the silver and bronze
paths, the model will have more draft elements. That's correct
behavior, not a deficiency. A thin, honest model is more useful than a
detailed, speculative one.