Skip to content
Skills Library
Programming · Analysis

domain-model

/domain-model

Build and sharpen the project's domain model – the ubiquitous language in CONTEXT.md, bounded contexts, context map, aggregates/invariants and the logical, stack-neutral data model based on docs/domain/events.yaml. Use when discussing domain terminology, writing or editing CONTEXT.md, or modeling contexts, aggregates and data.

Repository
kataster ↗
Licence
MIT
Last repository change
07.11.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
3
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 07.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Build and sharpen the project's domain model – the ubiquitous language in CONTEXT.md, bounded contexts, context map, aggregates/invariants and the logical, stack-neutral data model based on docs/domain/events.yaml. Use when discussing domain terminology, writing or editing CONTEXT.md, or modeling contexts, aggregates and data.

Original author description

Build and sharpen the project's domain model – the ubiquitous language in CONTEXT.md, bounded contexts, context map, aggregates/invariants and the logical, stack-neutral data model based on docs/domain/events.yaml. Use when discussing domain terminology, writing or editing CONTEXT.md, or modeling contexts, aggregates and data.

How it works

  1. Files
  2. 1. Language (during every session)
  3. 2. Bounded Contexts & Context Map
  4. 3. Aggregates
  5. 4. Logical Data Model (docs/architecture/data-model.md)
  6. 5. Quality Check Before Hand-off
Original SKILL.md headings · 81 lines, 957 words
SKILL.md preview
---
name: domain-model
description: Build and sharpen the project's domain model – the ubiquitous language in CONTEXT.md, bounded contexts, context map, aggregates/invariants and the logical, stack-neutral data model based on docs/domain/events.yaml. Use when discussing domain terminology, writing or editing CONTEXT.md, or modeling contexts, aggregates and data.
---

# Domain Modeling

Actively build and sharpen the domain model as you go. This is the *active* discipline: challenging terms, inventing edge-case scenarios, and writing the glossary and the model down the moment they crystallise. (Merely *reading* `CONTEXT.md` for vocabulary is not this skill: that's a one-line habit every skill and agent has. This skill is for when you're changing the model, not just consuming it.)

Architecture decisions (ADRs, tech stack) belong to the `architect` skill. The domain comes first.

## Files

| What | Where |
|---|---|
| Glossary (ubiquitous language) | `CONTEXT.md` at the repo root – format: [CONTEXT-FORMAT.md](./CONTEXT-FORMAT.md) |
| Event storming model incl. `bounded_contexts`, `aggregates` | `docs/domain/events.yaml` |
| Target context map | `docs/domain/context-map.md` – where the domain is going |
| As-is context map | `docs/domain/context-map.as-is.md` – recovered from code, written only by `/adopt` |
| Gap register | `docs/domain/gap-register.md` – links as-is and target, generated rows + user decisions |
| Logical data model | `docs/architecture/data-model.md` – template: `templates/data-model.md` |

## 1. Language (during every session)

### Challenge against the glossary
When the user uses a term that conflicts with the existing language in `CONTEXT.md`, call it out immediately. "Your glossary defines 'invoice' as X, but you seem to mean Y. Which is it?"

### Sharpen fuzzy language
When the user uses vague or overloaded terms, propose a precise canonical term. "You're saying 'order': do you mean the customer's request, or the shipment that fulfils it? Those are different things."

### Discuss concrete scenarios
When domain relationships are being discussed, stress-test them with specific scenarios. Invent scenarios that probe edge cases and force the user to be precise about the boundaries between concepts. "A customer reports the same problem on an item that already has an open case – a new case or the same one?"

### Cross-reference with docs and code
When the user states how something works, check whether `docs/domain/events.yaml`, the stories (and the code, once it exists) agree. If you find a contradiction, surface it. A source that contradicts the model is a grilling question, not a silent rewrite of the model (see the `research` skill).

### Update CONTEXT.md inline
When a term is resolved, update `CONTEXT.md` right there. Don't batch these up: capture them as they happen. `CONTEXT.md` is totally devoid of implementation details. It is a glossary and nothing else – not a spec, not a scratch pad.

Same word, different meaning in two places → a hint at a bounded context boundary (see 2).

## 2. Bounded Contexts & Context Map
- Draw boundaries along language (same word, different meaning → different context) and responsibility (who decides?).
- `docs/domain/context-map.md` is the **target** map: per context its purpose, core terms, owner role. Relationships as a Mermaid `flowchart` using the patterns Customer/Supplier, Conformist, Anti-Corruption Layer, Shared Kernel, Published Language.
- `docs/domain/context-map.as-is.md` is the **as-is** snapshot: what the code does today, with evidence. Only `/adopt` writes it; every other discovery path writes the target. The gap register links both.
- 2–4 contexts are typical for a small system. More only with justification.
- Maintain them in `events.yaml` under `bounded_contexts`, and group the terms in `CONTEXT.md` by context.

## 3. Aggregates
- An aggregate protects invariants that must be consistent **immediately**. Everything else is eventually consistent via events/policies.
- Keep them small. Reference other aggregates by ID only.
- Per aggregate in `events.yaml`: `context`, `invariants` (as testable statements). Assign commands and events via `aggregate`.
- **An invariant is stated once, on the aggregate** (user, 2026-10-01). A command's `rules` list only what it adds beyond them: defaults, actor permissions no invariant carries, required input, checks across aggregate or context boundaries, and consequences of the transition. Everything the stored state has to satisfy is an invariant, not a rule – the spec engineer reads both when deriving scenarios.
- Sign of a wrong aggregate: a command needs data from several aggregates to check a rule.

### Aggregate status: target, as-is, unresolved
Every aggregate carries a status; a missing `status` means `target`, so existing models stay valid.

| Status | Meaning | Rule |
|---|---|---|
| `target` | The boundary the project wants. The default in greenfield and in a confirmed target model. | Only a user decision makes an inferred boundary `target`. |
| `as-is` | The factual consistency boundary recovered from code. | Requires `evidence`: the table, service method or path that marks it. |
| `unresolved` | The boundary is unclear. | Requires an open hotspot (`refs: [AGG-…]`) and grilling. No story on it can become ready. |

**Prefer `as-is` or `unresolved` over an invented aggregate.** `/adopt` never writes `target` for something it
inferred from code. If you cannot name the table, method or path that holds the boundary together, it is not
`as-is` – it is `unresolved`. After changing a status or evidence, refresh the gap register:

```bash
node .claude/skills/adopt/scripts/gap-register.ts
```

## 4. Logical Data Model (`docs/architecture/data-model.md`)
- Per aggregate: root entity, entities, value objects, attributes with **domain** types (e.g. `SerialNumber`, `Money`, `Timestamp`), required/optional.
- Lifecycle as a Mermaid `stateDiagram-v2` (derive states from the events).
- Overall view as a Mermaid `erDiagram` (logical, no database types).
- **Traceability**: every attribute comes from the `data` of an event or the `fields` of a read model. Attributes without a source → hotspot.
- Stack-neutral until an ADR decides the stack. After that, a "Physical Model" section may follow.

## 5. Quality Check Before Hand-off
- Every term used in events, commands and stories is in `CONTEXT.md`; no `_Avoid_` term is used anywhere.
- Every event has an aggregate or context, every command a trigger (actor or policy).
- No open hotspots that affect an aggregate or a context boundary – otherwise present them to the user.
- `node .claude/skills/event-storming/scripts/validate-events.ts` passes.
Files in this package (3)
  • CONTEXT-FORMAT.md 2 KB
  • SKILL.md 7 KB
  • templates/data-model.md 1 KB

Versions

RepositoryScoreLicence
This page · hemi1986/kataster100MIT
sammcj/agentic-coding100Apache-2.0
andreibesleaga/gabbe100CC-BY-4.0
ayoubben18/ab-method100MIT
mkurman/zorai100MIT
OutlineDriven/odin-codex-plugin100Apache-2.0
paivot-ai/paivot-graph95Apache-2.0
redpanda-data/ui-harness90MIT
biliboss/skills90MIT

Database snapshot: 13.11.2026 · package version 6857b6ad11ee (SHA-256 digest of the entire package)

Downloads in the last 30 days: 5 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100domain-modeling
    Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a CONTEXT.md, or recording or editing an ADR.
  • 95domain-modeling
    Build and sharpen a project's domain model. Use when the user wants to pin down domain terminology or a ubiquitous language, or when another skill needs to maintain the domain model.
  • 100domain-modeling
    Build and sharpen a project's domain model. Use when the user wants to pin down domain terminology or a ubiquitous language, record an architectural decision, or when another skill needs to maintain the domain model.
  • 95domain-modeling
    Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a CONTEXT.md, or recording or editing an ADR.
  • 100domain-modeling
    Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.
  • 100domain-modeling
    Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.