Architecture Domain Driven Design logo

Architecture Domain Driven Design

Community
j4flmao
architecture-domain-driven-design

Use this skill when the user says 'DDD', 'domain-driven design', 'bounded context', 'aggregate', 'aggregate root', 'ubiquitous language', 'context map', 'anti-corruption layer', 'event storming', 'value object'. Applies strategic DDD (subdomains, bounded contexts, context maps) and tactical DDD (aggregates, entities, value objects, domain events, repositories) to model complex business logic. Do NOT use for: simple CRUD apps where DDD adds ceremony, service decomposition mechanics (architecture/system-design/microservices-patterns), or layering/folder structure only (backend/universal/clean-architecture).

Overview

Publisherj4flmao
Repositoryagent-skills
Skill namearchitecture-domain-driven-design
Stars
41
Forks
6
Bundled files
Instructions only
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.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

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

Installation

Install the Architecture 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/j4flmao/agent-skills/tree/main/skills/architecture/system-design/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/j4flmao/agent-skills.git /tmp/agent-skills
mkdir -p .claude/skills
cp -r /tmp/agent-skills/skills/architecture/system-design/domain-driven-design .claude/skills/architecture-domain-driven-design
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Architecture 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 Architecture 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 Architecture 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

Purpose

DDD aligns software structure with the business: a shared language inside explicit boundaries, models that enforce business invariants, and deliberate translation where contexts meet. Use it where domain complexity is the main risk (pricing, underwriting, logistics, billing). For simple CRUD, plain layered code is cheaper.

Agent Protocol

Trigger

"DDD", "bounded context", "aggregate", "aggregate root", "entity vs value object", "domain event", "context map", "anti-corruption layer", "ubiquitous language", "event storming".

Input Context

  • Business capabilities and processes; domain experts' vocabulary.
  • Current pain: tangled models, inconsistent rules, overloaded terms.
  • Team structure (contexts usually map to team ownership).
  • Persistence and integration constraints.

Output Artifact

Strategic map (subdomains, contexts, relationships) and/or tactical model (aggregates with invariants, value objects, events, repository interfaces).

Response Format

Subdomains: {core|supporting|generic}: {name}
Contexts: {name} owns {terms}; team {x}
Context map: {upstream} -> {downstream} [{pattern}]
Aggregate: {Root} invariants: {list}; references others by id
Events: {PastTenseName}(fields)

Completion Criteria

  • Each term defined per context (no global "User"/"Product" model).
  • Every aggregate lists the invariants it protects.
  • One aggregate modified per transaction; others updated via events.
  • Context relationships named with a context-map pattern.

Strategic Design

Subdomains: core (competitive advantage: invest, custom build), supporting (needed, specific: build simply), generic (commodity: buy/SaaS, e.g. auth, payments).

Bounded context: a boundary within which a model and its language are consistent. "Product" in Catalog (description, images), Inventory (SKU, quantity, location), and Pricing (price lists, discounts) are different models that share an identifier.

Context map patterns

PatternRelationship
PartnershipTwo teams coordinate releases jointly
Shared KernelSmall shared model owned by both (keep tiny)
Customer/SupplierDownstream needs influence upstream's roadmap
ConformistDownstream adopts upstream model as-is
Anti-Corruption Layer (ACL)Downstream translates upstream model into its own terms
Open Host Service + Published LanguageUpstream offers a stable, documented API/schema for many consumers
Separate WaysNo integration; duplicate where cheaper

Event Storming (Brandolini): domain experts and engineers place domain events (orange) on a timeline, then commands, actors, policies, and aggregates; clusters suggest context boundaries.

Tactical Design

Building blockIdentityMutabilityExample
EntityHas id; equality by idMutable via methodsOrder
Value objectNo id; equality by valueImmutableMoney, Address, DateRange
AggregateCluster with one root; consistency boundaryChanged only through rootOrder + OrderLine
Domain eventImmutable factImmutableOrderPlaced
RepositoryLoads/saves whole aggregatesn/aOrderRepository
Domain serviceLogic not belonging to one entityStatelessPricingService

Aggregate rules (Vernon)

  1. Protect true invariants inside the boundary.
  2. Design small aggregates.
  3. Reference other aggregates by identity only.
  4. Use eventual consistency (domain events) outside the boundary; modify one aggregate per transaction.

Example (TypeScript)

typescript
export class Money {
  private constructor(readonly cents: number, readonly currency: string) {}
  static of(cents: number, currency: string): Money {
    if (!Number.isInteger(cents) || cents < 0) throw new RangeError(`invalid amount: ${cents}`);
    return new Money(cents, currency);
  }
  add(other: Money): Money {
    if (other.currency !== this.currency) {
      throw new Error(`currency mismatch: ${this.currency} vs ${other.currency}`);
    }
    return new Money(this.cents + other.cents, this.currency);
  }
}

type OrderStatus = "draft" | "placed" | "cancelled";
export type OrderEvent =
  | { type: "OrderPlaced"; orderId: string; customerId: string; totalCents: number; at: Date };

interface OrderLine { readonly sku: string; readonly qty: number; readonly unitPrice: Money }

export class Order {
  private lines: OrderLine[] = [];
  private status: OrderStatus = "draft";
  private pending: OrderEvent[] = [];

  constructor(readonly id: string, readonly customerId: string, private readonly currency: string) {}

  addLine(sku: string, qty: number, unitPrice: Money): void {
    if (this.status !== "draft") throw new Error(`order ${this.id} is ${this.status}; cannot add lines`);
    if (qty <= 0) throw new RangeError(`qty must be positive, got ${qty}`);
    if (unitPrice.currency !== this.currency) throw new Error("line currency differs from order");
    if (this.lines.length >= 100) throw new Error("max 100 lines per order");   // invariant
    this.lines.push({ sku, qty, unitPrice });
  }

  total(): Money {
    return this.lines.reduce((sum, l) => sum.add(Money.of(l.unitPrice.cents * l.qty, this.currency)),
                             Money.of(0, this.currency));
  }

  place(now: Date): void {
    if (this.status !== "draft") throw new Error(`order ${this.id} already ${this.status}`);
    if (this.lines.length === 0) throw new Error("cannot place an empty order");
    this.status = "placed";
    this.pending.push({ type: "OrderPlaced", orderId: this.id, customerId: this.customerId,
                        totalCents: this.total().cents, at: now });
  }

  pullEvents(): OrderEvent[] {
    const events = this.pending;
    this.pending = [];
    return events;
  }
}

export interface OrderRepository {
  get(id: string): Promise<Order>;
  save(order: Order): Promise<void>;   // persists state + pulled events (outbox) in one transaction
}

Application service: load aggregate → call one method → save (state + events via outbox) in one transaction. Other contexts (Inventory, Billing) react to OrderPlaced asynchronously, translating through their own ACL.

Anti-Corruption Layer

typescript
// Shipping context translating a legacy ERP customer into its own model
export function toRecipient(erp: { CUST_NM: string; ADDR1: string; CNTRY_CD: string }): Recipient {
  if (!erp.ADDR1) throw new Error(`ERP customer ${erp.CUST_NM} has no address`);
  return { name: erp.CUST_NM.trim(), street: erp.ADDR1.trim(), country: mapCountry(erp.CNTRY_CD) };
}

The ACL keeps upstream naming, quirks, and changes from leaking into the downstream model.

Anti-Patterns

  • Anemic domain model: entities as property bags, rules spread through services.
  • Giant aggregates (Customer containing all orders): lock contention and slow loads.
  • One enterprise-wide model for core concepts.
  • Repositories per table instead of per aggregate.
  • DDD ceremony on CRUD subdomains.
  • Bounded contexts that ignore team boundaries (Conway's law will win).

Checklist

  • Subdomains classified; investment matches type.
  • Bounded contexts with glossary and owning team.
  • Context map with explicit patterns; ACL where upstream model is foreign.
  • Aggregates small, invariants listed and enforced in methods.
  • Value objects immutable with validation.
  • Domain events published via outbox; consumers idempotent.
  • Unit tests on aggregates without infrastructure.

References

  • Evans, "Domain-Driven Design" (2003); Vernon, "Implementing Domain-Driven Design" (2013) and "Effective Aggregate Design" essays.
  • Brandolini, "Introducing EventStorming"; Khononov, "Learning Domain-Driven Design" (2021).

Frequently asked questions

What does the Architecture Domain Driven Design AI skill do?

Use this skill when the user says 'DDD', 'domain-driven design', 'bounded context', 'aggregate', 'aggregate root', 'ubiquitous language', 'context map', 'anti-corruption layer', 'event storming', 'value object'. Applies strategic DDD (subdomains, bounded contexts, context maps) and tactical DDD (aggregates, entities, value objects, domain events, repositories) to model complex business logic. Do NOT use for: simple CRUD apps where DDD adds ceremony, service decomposition mechanics (architecture/system-design/microservices-patterns), or layering/folder structure only (backend/universal/clean...

Why use Architecture Domain Driven Design on TypingMind?

Because you install it once and use it with any model. Architecture 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 Architecture Domain Driven Design in TypingMind?

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

Which AI models can use Architecture 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 Architecture Domain Driven Design?

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

Is the Architecture Domain Driven Design AI skill free?

Yes. It is published on GitHub by j4flmao 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 👇