ddd-architecture

ddd-architecture is a skill for Claude Code, Codex from DVNghiem/FlowDeck. It costs 19 tokens per session (784 once invoked), scanned A, original, MIT.

A guide to Domain-Driven Design, a way to shape software around the real business concepts and rules it represents.

In plain words
What is it for?
Use it to define business boundaries, model entities and value objects, group related rules, represent important events, and connect the domain to databases or external systems.
Why use it?
Complex business software can become confusing when terminology, responsibilities, and boundaries are unclear. It helps organize the model so the code matches the problem domain.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/dvnghiem/flowdeck/ddd-architecture
Any agent
npx skills add DVNghiem/FlowDeck --skill ddd-architecture
Clone the repo
git clone --depth 1 https://github.com/DVNghiem/FlowDeck

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ddd-architecture

README.md
[![agentmods](https://agentmods.dev/badge/skills/dvnghiem/flowdeck/ddd-architecture.svg)](https://agentmods.dev/skills/dvnghiem/flowdeck/ddd-architecture)
Your own site
<a href="https://agentmods.dev/skills/dvnghiem/flowdeck/ddd-architecture"><img src="https://agentmods.dev/badge/skills/dvnghiem/flowdeck/ddd-architecture.svg" alt="Measured on agentmods" height="20"></a>
Per session 19 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 784 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00019 $0.00784
Opus 5 $0.00010 $0.00392
Sonnet 5 $0.00004 $0.00157
Haiku 4.5 $0.00002 $0.00078

Measured 6d ago against content hash b53cbdb5154c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

ddd-architecture scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

src/skills/ddd-architecture/SKILL.md · 111 lines

How it starts

The opening of the file, as written. The whole thing — 111 lines — stays where its author put it; the contents beside it link to each section on GitHub.

ddd-architecture

When to Activate

When modeling complex business domains where deep understanding of the problem space, ubiquitous language, and bounded contexts are critical for long-term maintainability.

Steps

  1. Establish the bounded context - Identify the explicit boundary within which a single model (ubiquitous language) holds.
  2. Build the domain model - Create entities, value objects, aggregates, and domain events that reflect real business concepts.
  3. Define aggregates - Group related entities and value objects under a root aggregate that enforces invariants.
  4. Identify domain events - Capture meaningful business occurrences that other parts of the system may need to react to.
  5. Create domain services - Model operations that don't naturally belong to a single entity or value object.
  6. Define repository interfaces - Create ports for persisting and retrieving aggregates (implementation is infrastructure).
  7. Implement application services - Orchestrate the domain model, handle transactions, and coordinate multiple aggregates.
  8. Establish anti-corruption layers - Translate between external systems (legacy, third-party) and your domain model.

Examples

// Value Object - Immutable concept with equality
class Money {
  constructor(
    public readonly amount: number,
    public readonly currency: Currency
  ) {}

  static of(amount: number, currency: Currency): Money {
    return new Money(Math.round(amount * 100) / 100, currency)
  }

  add(other: Money): Money {
    if (this.currency !== other.currency) {
      throw new Error('Currency mismatch')
    }
    return Money.of(this.amount + other.amount, this.currency)
  }
}

// Aggregate Root - Enforces invariants for the aggregate
class Order extends AggregateRoot {
  constructor(
    private readonly id: OrderId,
    private readonly customer: Customer,
    private items: OrderItem[],
    private status: OrderStatus
  ) {
    super()
    this.validate()
  }

  private validate(): void {
    if (this.items.length === 0) {
      throw new DomainException('Order must have at least one item')
    }
  }

  get total(): Money {
    return this.items.reduce(
      (sum, item) => sum.add(item.subtotal),
      Money.of(0, Currency.USD)
    )
  }

  // Business methods that enforce invariants
  addItem(item: OrderItem): void {
    if (this.status !== OrderStatus.DRAFT) {
      throw new DomainException('Cannot add items to a non-draft order')
    }
    this.items.push(item)
    this.addDomainEvent(new OrderItemAddedEvent(this.id, item))
  }

  submit(): void {
    if (!this.canSubmit()) {
      throw new DomainException('Order cannot be submitted')
    }
    this.status = OrderStatus.SUBMITTED
    this.addDomainEvent(new OrderSubmittedEvent(this))
  }

  private canSubmit(): boolean {
    return this.status === OrderStatus.DRAFT && this.items.length > 0
  }
}

// Domain Event - Business facts that may trigger reactions
class OrderSubmittedEvent extends DomainEvent {
  constructor(public readonly order: Order) {
    super('order.submitted', order.id)
  }
}

// Repository Interface (Port) - Persistence abstraction
interface OrderRepository {
  findById(id: OrderId): Promise<Order | null>
  findByCustomer(customerId: CustomerId): Promise<Order[]>
  save(order: Order): Promise<void>
}

Read the full file on GitHub · 111 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 111 lines · 19 tokens per session scan A b53cbdb5154c

Subscribe to this mod's changes

ddd-architecture is a skill published in the GitHub repository DVNghiem/FlowDeck (24 stars, last pushed 17d ago), licensed MIT. It adds 19 tokens to every session and 784 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

oh-my-opencode-slim

Configure and improve oh-my-opencode-slim for the current user. Use when users want to tune agents, models, prompts, custom agents, skills, MCPs, presets, or plugin behavior. Also use when recurring workflow friction suggests a safe config or prompt improvement.

alvinunreal/oh-my-opencode-slim · 61 tokens

clonedeps

Clone important project dependency source code into an ignored local workspace so OpenCode can inspect library internals. Use when the user asks to clone dependencies, inspect dependency/source internals, understand SDK/framework behavior from source, debug library implementation details, or make core dependency repos…

alvinunreal/oh-my-opencode-slim · 76 tokens

codemap

Generate comprehensive hierarchical codemaps for UNFAMILIAR repositories. Expensive operation - only use when explicitly asked for codebase documentation or initial repository mapping.

alvinunreal/oh-my-opencode-slim · 34 tokens

deepwork

High-cost orchestrator workflow for large, high-risk, multi-phase coding efforts with meaningful dependencies and review gates. Do not activate for routine multi-file changes.

alvinunreal/oh-my-opencode-slim · 34 tokens

worktrees

Manage Git worktrees as OMO safe isolated coding lanes for complex, risky, or parallel work.

alvinunreal/oh-my-opencode-slim · 23 tokens

simplify

Simplifies code for clarity without changing behavior. Use for readability, maintainability, and complexity reduction after behavior is understood.

alvinunreal/oh-my-opencode-slim · 27 tokens