Back to list
dralgorhythm

domain-driven-design

by dralgorhythm

A More Effective Agent Harness for Claude

4🍴 0📅 Jan 22, 2026

SKILL.md


name: domain-driven-design description: Apply Domain-Driven Design patterns. Use when modeling complex business domains, defining bounded contexts, or designing aggregates. Covers entities, value objects, and repositories. allowed-tools: Read, Write, Glob, Grep

Domain-Driven Design

Core Concepts

Ubiquitous Language

Use the same terminology as domain experts. Code should read like business documentation.

Bounded Context

A boundary within which a particular domain model is defined and applicable.

Context Map

Shows how bounded contexts relate to each other.

Building Blocks

Entity

Has identity that persists over time. Equality based on ID.

class User {
  constructor(
    public readonly id: UserId,
    public email: Email,
    public name: string
  ) {}
}

Value Object

Immutable, equality based on attributes.

class Email {
  private constructor(public readonly value: string) {}

  static create(value: string): Email {
    if (!value.includes('@')) {
      throw new Error('Invalid email');
    }
    return new Email(value);
  }

  equals(other: Email): boolean {
    return this.value === other.value;
  }
}

Aggregate

Cluster of entities and value objects with a root entity.

class Order { // Aggregate Root
  private items: OrderItem[] = [];

  addItem(product: ProductId, quantity: number): void {
    // Business rules enforced here
    this.items.push(new OrderItem(product, quantity));
  }

  get total(): Money {
    return this.items.reduce((sum, item) => sum.add(item.subtotal), Money.zero());
  }
}

Repository

Abstracts data access for aggregates.

interface OrderRepository {
  findById(id: OrderId): Promise<Order | null>;
  save(order: Order): Promise<void>;
}

Domain Event

Something that happened in the domain.

class OrderPlaced {
  constructor(
    public readonly orderId: OrderId,
    public readonly userId: UserId,
    public readonly occurredAt: Date
  ) {}
}

Strategic Patterns

Anti-Corruption Layer

Translate between your model and external systems.

Shared Kernel

Shared subset of domain model between contexts.

Customer-Supplier

Upstream provides what downstream needs.

Score

Total Score

55/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon