domain-driven-design

Guide domain modeling with type-driven design and generate Mermaid, Graphviz, or ASCII diagrams.

52|7|Updated Jul 5, 2025
One-click install
npx skills add https://github.com/bfollington/terma --skill domain-driven-design
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: domain-driven-design
Source: https://github.com/bfollington/terma/tree/main/skills/domain-driven-design
Command: npx skills add https://github.com/bfollington/terma --skill domain-driven-design

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Software often struggles with complexity, inconsistent terminology, and invalid states, leading to bugs and difficult maintenance. This skill provides a structured approach to domain modeling, leveraging principles from Rich Hickey and Scott Wlaschin, to ensure your software accurately reflects the business domain, prevents illegal states, and fosters a clear, ubiquitous language.

Core Features & Use Cases

  • Ubiquitous Language Development: Guides you in establishing consistent terminology across code, documentation, and business conversations, reducing ambiguity.
  • Type-Driven Design: Helps you model data and workflows using types that make illegal states unrepresentable, catching errors at compile time.
  • Architectural Patterns: Provides guidance on entities, value objects, aggregates, bounded contexts, and functional core/imperative shell architecture.
  • Visualization Tools: Generates Mermaid, Graphviz/DOT, or ASCII diagrams to clearly communicate complex domain structures and workflows.
  • Use Case: You're designing an e-commerce order system. Use this skill to define Order as an aggregate root, model its PaymentStatus using a sum type to prevent invalid states, and visualize the order lifecycle with a Mermaid state diagram, ensuring a robust and clear design.

Quick Start

Help me define the core entities and value objects for a simple banking domain, focusing on Account and Money.

Frequently Asked Questions about domain-driven-design

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

FAQPage Schema
How do I design domain models that prevent invalid states in my code?

Type-driven design uses types and sum types to make illegal states unrepresentable, catching errors at compile time. Model your domain concepts—like payment status or order states—as types that enforce valid transitions, reducing bugs and eliminating defensive checks throughout your codebase.

What is ubiquitous language and why does it matter for software design?

Ubiquitous language is consistent terminology shared between code, documentation, and business conversations. It reduces ambiguity, aligns developers and domain experts, and ensures your codebase accurately reflects business concepts, making maintenance and collaboration easier.

How do I structure complex domains using entities, value objects, and aggregates?

Entities have identity and lifecycle; value objects are immutable and defined by their attributes; aggregates group related entities around a root entity that manages consistency. This layered structure organizes domain logic, clarifies responsibilities, and prevents invalid state transitions across your models.

Can I visualize domain structures and workflows to communicate design decisions?

Yes. Generate Mermaid, Graphviz/DOT, or ASCII diagrams to visualize domain entities, state transitions, and workflows. Visual representations help teams align on complex domain structures and serve as executable documentation alongside your code.

What architectural pattern separates domain logic from infrastructure concerns?

The functional core/imperative shell pattern isolates pure domain logic (functional core) from side effects and I/O (imperative shell). This separation makes domain behavior testable, reusable, and independent of framework or database choices.

When should I apply domain-driven design instead of generic data modeling?

Use domain-driven design when complexity, invalid states, or inconsistent terminology cause bugs and maintenance friction. It's especially valuable for business-critical domains—e-commerce, banking, workflows—where precision and clarity directly impact system reliability and team communication.