domain-model
Stress-tests plans and architecture against the Soonlane modules and packages, Effect ports and layers, ADRs, product docs and code reality, and maintains the UBIQUITOUS_LANGUAGE.md glossary. Use when
SKILL.md.agents/skills/domain-model/SKILL.md
GitHubDomain Model
Use this skill to sharpen architecture and language before implementation.
Sources
Read the relevant sources for the topic:
UBIQUITOUS_LANGUAGE.mdCONTEXT.mdandCONTEXT-MAP.mdwhen they existdocs/decisions/*.mdPRODUCT.mdwhen product behavior matters (decisions there are final)ARCHITECTURE.mdfor the package and module map and the server boundary- The root
AGENTS.mdnaming table and Effect layering rules - Existing modules and at least 3 similar files before proposing folder or boundary changes
Use CONTEXT-FORMAT.md for context docs, ADR-FORMAT.md for ADRs and GLOSSARY-FORMAT.md for UBIQUITOUS_LANGUAGE.md.
Flow
- Identify the affected modules (see
ARCHITECTURE.md) and packages, and which one owns the behavior. - Check context docs, glossary and ADRs for existing ownership, terms and decisions.
- Compare the plan with current code behavior and the product docs.
- Call out conflicts between language, ADRs, docs and code.
- When the user asks to brainstorm, push back or establish a pattern, stay analysis-only until they explicitly say to proceed.
- Ask one sharp question at a time only when code and docs cannot answer it.
- Propose canonical terms for vague or overloaded language.
- Keep
UBIQUITOUS_LANGUAGE.mdcurrent: when a task introduces, renames or retires a domain term or UI label, update it in the same change (format in GLOSSARY-FORMAT.md). Update context docs only when the user asks. - Recommend
adr-authoringonly when the decision is hard to reverse, surprising without context, and based on a real trade-off.
Soonlane Boundaries
packages/domain: brands (CalendarDate,UserId) and constants shared by every workspace. No Effect, framework, ORM or RPC.packages/contracts: the oRPC contract and Zod schemas; the only API boundary between server, browser and the future desktop app.packages/ui: reusable, app-agnostic React primitives. No router, no data fetching, no domain types.apps/web/src/modules/<module>/domain: pure types, tagged errors (*.errors.tswith acodefield) and helpers. No Effect services, framework, ORM or RPC imports.application/: ports (*.port.ts, aContext.Servicewithout implementation) and services (*.service.ts, aContext.Serviceplus its*Livelayer, methods viaEffect.fn('Service.method')). Services orchestrate ports; they never touch Drizzle or HTTP directly.infrastructure/: adapters that implement ports.*.repository.tsruns every query throughDb.runand never catches or translates errors;*.layer.tswraps an external system as a Layer.presentation/: oRPC routers, raw HTTP handlers, middleware, components, hooks and helpers. Tagged errors become oRPC errors only inplatform/rpc/rpc.base.ts.platform/: config, the composedAppLiveand the singleManagedRuntime. A new*Livelayer is wired inapp.layers.ts.- Cross-module use goes through another module's service or port; importing another module's
infrastructure/should be flagged. - Everything under
platform/,application/andinfrastructure/is server-only; browser code reaches it only through oRPC.
Rules
- Use current repo architecture over generic DDD examples; there is no CQRS, event bus or outbox here.
- Apply structure selectively to the module whose ownership changes; do not reshape untouched modules.
- Promote code into a package only when a second consumer (another app, the desktop app, another package) needs it.
- Flag "task", "date", "due", "today" and "overdue" when they are used ambiguously; "today" is always the user's local calendar day.
- Do not create ADRs, tickets, commits or comments unless the user asks.