domain-modeling

Detects, designs, and validates domain models using ubiquitous language, aggregates, and type-driven decomposition.

Updated Jan 30, 2026
One-click install
npx skills add https://github.com/RyoMa99/chezmoi_dotfiles --skill domain-modeling-ryoma99
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: domain-modeling
Source: https://github.com/RyoMa99/chezmoi_dotfiles/tree/main/dot_claude/skills/domain-modeling
Command: npx skills add https://github.com/RyoMa99/chezmoi_dotfiles --skill domain-modeling-ryoma99

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Domain models degrade when the same term means different things to different actors, types accumulate boolean flags and unrelated properties, and specification tables hide cross-cutting rules. This Skill provides a consistent workflow to detect modeling problems, decide between creating or restructuring models, build types that represent domain concepts, and validate the result. ## Core Features & Use Cases - Detection signals: Identifies context boundary signs (language games), ubiquitous language decay (glossary-only lexicon, missing verbs, impossible states), and restructuring smells (fat models, boolean state flags, stamp coupling, shotgun parsing). - Modeling techniques: Covers context boundary discovery by actor purpose, hidden concept extraction from if-statements into Policies/Specifications, type granularity design, specification orthogonality checks, aggregate boundary heuristics (lock contention, cascade delete tests), and the DDD Trilemma for domain service purity. - Validation outputs: Produces mermaid classDiagram domain model diagrams, object diagrams with concrete instances, and NotebookLM-based literature review against DDD and CQRS/ES notebooks. - Use Case: When adding a feature where "order" means different things to sales, shipping, and accounting, use this Skill to split contexts, model states as discriminated unions instead of flags, and verify aggregate boundaries before implementation. ## Quick Start Ask the AI to apply the domain-modeling skill to analyze whether a new business concept needs a new model or a restructure of an existing type.

Frequently Asked Questions about domain-modeling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I know when a domain model needs restructuring?▼

Look for fat models with growing properties, boolean flags like isApproved or isShipped managing state, stamp coupling where methods receive whole objects but use few fields, and shotgun parsing with repeated null checks. These signs indicate the model is not Always-Valid and needs decomposition.

How do I decide aggregate boundaries in DDD?▼

Apply the lock contention test (does changing entity X force loading and locking all of Y?), the cascade delete test (should children die with the parent?), and keep cross-aggregate references as IDs only. If two aggregates constantly need one transaction, they are actually one aggregate.

Should a domain service use a repository?▼

This is the DDD Trilemma: you can only have two of completeness, purity, and performance. The recommended approach lifts read logic to the application layer (purity plus performance); fall back to higher-order functions hiding infrastructure when completeness cannot be compromised.

When should I use discriminated unions instead of boolean flags?▼

Use discriminated unions whenever required fields or allowed operations differ by status. Boolean flags and optional fields let the type system permit impossible states; separating states into distinct types makes invalid combinations unrepresentable.

What is the difference between synchronous domain events and the Outbox pattern?▼

Synchronous domain events separate concerns within one transaction and roll back together on listener failure. The Outbox pattern provides eventual consistency across separate transactions for external APIs, email, or heavy async work, at the cost of an outbox table and polling infrastructure.