Domain Driven Design logo

Domain Driven Design

Community
techygarg
domain-driven-design

Apply DDD tactical patterns when working with domain code, and validate proposed domain models before approval (design mode). Enforces aggregate design, value objects over primitives, entity identity rules, and bounded context boundaries. Use when creating or modifying domain models, designing aggregates, working in the domain layer, or when the user mentions 'domain', 'aggregate', 'value object', 'entity', 'bounded context', or 'DDD'.

Overview

Publishertechygarg
Repositorylattice
Skill namedomain-driven-design
Stars
208
Forks
16
Bundled files
1
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by techygarg on GitHub. Read the source before you install it.

Installation

Install the Domain Driven Design AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/techygarg/lattice/tree/main/skills/domain-driven-design
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/techygarg/lattice.git /tmp/lattice
mkdir -p .claude/skills
cp -r /tmp/lattice/skills/domain-driven-design .claude/skills/domain-driven-design
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Domain Driven Design in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Domain Driven Design on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Domain Driven Design is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Domain-Driven Design

Config Resolution

The skill supports project-custom principles. Resolution:

  1. Look for .lattice/config.yaml in the repo root.
  2. If found, check paths.ddd_principles for a custom doc path.
  3. If a custom document exists at that path, read it and check its YAML frontmatter mode:
    • mode: override: the custom doc has full precedence. Use it instead of the embedded default. It must be comprehensive -- sole reference.
    • mode: overlay (or no mode): read the embedded ./references/defaults.md first, then apply the custom doc on top. A custom section replaces the matching default section (matched by heading); new sections append after the defaults.
  4. If a custom path is configured but no document exists at it → tell the user which configured path is missing, then read ./references/defaults.md.
  5. If there is no config file or no paths.ddd_principles key → read ./references/defaults.md.
  6. Language adaptation: if paths.language_idioms is set in the config and the document exists, read its "Type System & Object Model" section and adapt entity, value object, and aggregate implementation patterns to language constructs (e.g., struct vs class, trait vs interface, data class vs record). Language idioms take precedence over pseudocode defaults.

Self-Validation Checklist

STOP after generating each component. Verify ALL checks before proceeding. If any check fails, fix before presenting. If a check is a judgment call with multiple valid approaches (see Ambiguity Signals), flag it — present options and reasoning rather than silently choosing; if framework:collaborative-judgment is loaded, use its presentation format.

  1. ENTITY VS VALUE OBJECT: For each domain object — does the business track individual instances over time? Yes → entity with identity. No → value object, immutable and self-validating.
  2. AGGREGATE BOUNDARY: Does a transactional invariant require this object inside the aggregate? If not → reference it from a separate aggregate by ID.
  3. RICH BEHAVIOR: Does the entity have methods that enforce business rules, guard state transitions, raise events? If the entity is just a data holder → move logic from services into the entity.
  4. VALUE OBJECT COVERAGE: Scan for primitives that should be value objects — string emails, number amounts, raw UUIDs as identifiers → wrap in a validating value object.
  5. AGGREGATE COHESION: List the business rules the root enforces. Does every internal entity participate in at least one invariant? If not → it belongs in its own aggregate.
  6. DOMAIN EVENTS: Should a domain event be raised — a state transition another aggregate reacts to, a change triggering notification, an audit/compliance requirement? Do not raise events for internal changes nothing reacts to.
  7. DOMAIN SERVICE: Does stateless logic spanning multiple entities belong in a domain service rather than an application service? Keep I/O and infrastructure calls out of it.
  8. FACTORY: Is complex aggregate creation encapsulated behind a factory method (Order.create(...)) or a standalone factory class? Are initial creation and reconstitution from persistence handled separately?

All checks pass → state "Passes domain-driven-design. [next step]."

Active Anti-Pattern Scan

After verifying the checklist above, scan the output for these specific anti-patterns. If you find any, fix before presenting.

  • Anemic Domain Model: Entity is a getter/setter data holder; all logic lives in services → move business rules into entities and value objects
  • Primitive Obsession: Raw string for email, number for money, UUID for ID → wrap in a validating value object with behavior
  • God Aggregate: Aggregate has many entities, loads slowly, high contention → decompose; keep only what shares a transactional invariant
  • Cross-Aggregate Transaction: Service updates two aggregates in one transaction → use domain events and eventual consistency
  • Leaking Domain Logic: Business rule in a controller, application service, or infrastructure → extract into a domain object or domain service
  • Misidentified Entity/Value Object: Entity without a lifecycle, or value object with tracked identity → apply the identity test

Ambiguity Signals

These checks often have multiple valid outcomes. When you encounter one, present the options rather than silently choosing. If framework:collaborative-judgment is loaded, use its presentation format.

  • Aggregate Boundary Size: Small aggregate (more events, eventual consistency) vs large aggregate (simple transaction, immediate consistency). Neither is inherently correct — it depends on contention patterns and invariant scope.
  • Entity vs Value Object: Some concepts (like Address or Money) may or may not need identity depending on domain complexity. Apply the identity test, but acknowledge when borderline.
  • Domain Service vs Entity Method: Logic spanning multiple entities could live in a domain service or be a method on the primary entity. The choice depends on which entity "owns" the invariant.
  • Object Creation Pattern: Factory method on the aggregate root, standalone factory class, builder pattern, or plain constructor — depends on assembly complexity and team convention. Don't prescribe a pattern; ask which approach the team prefers.

Scope Statement

This skill operates within a single repo, single bounded context (e.g., one API -- Order, User, Pricing). It covers tactical DDD patterns only -- not strategic DDD (no context maps, no microservice topology, no bounded-context integration).

If a task appears to span multiple bounded contexts (e.g., an Order feature calling Shipping logic), flag before proceeding: "This task touches [Context A] and [Context B]. Cross-context integration is strategic DDD — outside this skill's scope. Would you like to scope to one context, or proceed knowing cross-context coordination is your responsibility?"

Design Mode

When invoked during design — no code is being written; a planning molecule is validating a proposed domain model — apply the same checks as a forward-looking validation:

  1. Take the proposed artifact (aggregate list, entity/value object classification, event set, or contract types) as the unit of validation.
  2. Run the Self-Validation Checklist and Active Anti-Pattern Scan against it — before the model is presented for user approval.
  3. Report violations as concrete findings on the model ("Order aggregates both pricing and fulfillment state — split by transactional invariant"), not generic advice. Resolve them through the design.
  4. STOP: do not skip evaluation because no code exists yet — the proposed model is what gets validated.

See ./references/defaults.md for aggregate design rules, entity/value object/domain service/domain event/repository/creation patterns with code examples, inline anti-pattern warnings, and a decomposition guide.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Domain Driven Design AI skill do?

Apply DDD tactical patterns when working with domain code, and validate proposed domain models before approval (design mode). Enforces aggregate design, value objects over primitives, entity identity rules, and bounded context boundaries. Use when creating or modifying domain models, designing aggregates, working in the domain layer, or when the user mentions 'domain', 'aggregate', 'value object', 'entity', 'bounded context', or 'DDD'.

Why use Domain Driven Design on TypingMind?

Because you install it once and use it with any model. Domain Driven Design is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Domain Driven Design in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/techygarg/lattice/tree/main/skills/domain-driven-design. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Domain Driven Design?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Domain Driven Design?

As many as you like. As long as a model supports skills, you can use Domain Driven Design with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Domain Driven Design AI skill free?

Yes. It is published on GitHub by techygarg under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇