ワンクリックで
ddd-architecture
Domain-Driven Design patterns for bounded contexts, aggregates, and ubiquitous language.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Domain-Driven Design patterns for bounded contexts, aggregates, and ubiquitous language.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Optimize token usage and context window discipline. Reduce costs and improve response quality through smart context management.
Unified context lifecycle for FlowDeck sessions — ingest, filter, prune, protect, summarize, and persist with telemetry.
Predict affected files, modules, APIs, tests, and DB paths before changes. Returns an impact map for human review.
Map architecture, conventions, and file structure into `.codebase/`. Use when onboarding or before deep feature work.
Plan differently when the agent has low certainty — ask for clarification or narrow scope instead of pretending full understanding.
Protect critical context from pruning during compaction. Preserve active plans, safety files, pending operations, and user intent anchors.
| name | ddd-architecture |
| description | Domain-Driven Design patterns for bounded contexts, aggregates, and ubiquitous language. |
| origin | FlowDeck |
When modeling complex business domains where deep understanding of the problem space, ubiquitous language, and bounded contexts are critical for long-term maintainability.
// 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>
}