Loading the domain model as context
A well-formed domain model is a type system for the problem space. Loading it before a coding task means you use the team's exact names, respect the declared relationships, and don't violate invariants.
What to load
- Find the domain model in the repo — a
*.modelith.yamland its rendered*.modelith.md(often underdocs/or the repo root). - Prefer the rendered Markdown for reading: it's the readable form, with
the relationship diagram inline. If it's missing or stale (check with
modelith render --check <file>— the file argument is required), regenerate it withmodelith render <file>first. (Ifmodelithisn't installed, you can still read the committed.mddirectly; just note it may be stale.) - Read it in full before writing code. Internalize:
- the canonical names — use
Project, never "workspace" or "container"; - the relationships and cardinality — what owns what;
- the invariants — rules your code must not break.
- the canonical names — use
- If it has an
imports:list, itsscope.Namereferences (in attributetypevalues) name vocabulary that lives in the imported file, not this one — load that file too before treating ascope.Nameterm as unknown.
How to apply it while coding
- Name variables, types, functions, and UI strings using the model's terms.
- When a requirement seems to need a concept the model doesn't have, stop: that
may be a real gap. Flag it and offer to capture it with the
domain-model-authorskill rather than silently inventing a name. - When code would violate an invariant, treat that as a bug in the plan, not a detail to smooth over.
Keep the model honest
If implementing the feature reveals the model is wrong or incomplete — a missing entity, an invariant that can't hold — surface it. The model is meant to be a living source of truth; coding against it is exactly when its gaps show up.