/typescript:ts-ddd-eventsfrom typescript
Implements domain events, event stores, outbox pattern, and reliable event publishing in TypeScript DDD projects. Covers event structure, naming conventions, append-only stores, and consumer patterns.
Ships in typescript. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A business fact that occurred in the past. Named in past tense, immutable:
type ReceiptGenerated = {
readonly receiptId: string;
readonly tenantId: string;
readonly landlordId: string;
readonly period: { year: number; month: number };
readonly amount: number;
readonly generatedAt: Date;
};
| Element | Convention | Example |
|---|---|---|
| Type | PascalCase past tense | ReceiptGenerated, LeaseTerminated |
| File | kebab-case.event.ts | receipt-generated.event.ts |
| Directory | domain/events/ | Co-located with the aggregate |
type DomainEvent<T> = {
readonly id: string; // UUID unique
readonly type: string; // 'receipt.generated'
readonly payload: T;
readonly createdAt: Date;
};
Persist events as source of truth. Append-only, never delete.
Guarantees reliable event publishing. The event is persisted in an outbox table atomically with the state change, then published asynchronously:
Command -> Domain Logic -> Transaction {
1. Persist aggregate state
2. Insert event in outbox table <- atomic
}
Worker -> Poll outbox -> Publish event -> Mark as processed
Status flow: created -> in_progress -> processed / failed
When implementing event store persistence, outbox tables, or outbox publishers, read
references/event-implementation-patterns.mdfor complete Drizzle schemas and publisher implementations.
When emitting events from handlers or writing consumers, read
references/event-implementation-patterns.mdfor atomic transaction patterns and consumer examples.
| Pattern | Use case |
|---|---|
| Domain Event | Business fact to communicate between bounded contexts |
| Event Store | Audit trail, replay, event sourcing |
| Outbox | Reliable publishing without dual-write |
| Consumer | Asynchronous reaction to an event |
Event and a type named DomainEvent.emit* or raise*.make*Mapper factory per bounded context, never one per event type.outbox without this note costs a reader the reliable-publishing assumption; the note is the one-line fix.| Rule | Convention |
|---|---|
| Naming | Past tense (ReceiptGenerated) |
| Structure | { id, type, payload, createdAt } |
| Event Store | Append-only, domain_events table |
| Outbox | Atomic with state change |
| Status | created -> in_progress -> processed / failed |
| Retries | numberOfRetries + maxNumberOfRetries |
| Consumer | Idempotent, null-safe |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
9 skills in this plugin
/ddd-ts-fpACTIVATE when modeling DDD aggregates, value objects and domain logic in TypeScript using functional patterns. ACTIVATE for 'aggregate', 'smart constructor', 'make*', 'validation pipeline', 'enrichment', 'domain handler' in TypeScript. Provides TypeScript-specific examples for cross-language functional DDD principles defined in craft:ddd-fp-principles. DO NOT use for: infrastructure code, general FP patterns (see ts-functional), OOP modeling (see ts-oop)./ts-code-conventionsACTIVATE whenever writing or modifying TypeScript code in src/. ACTIVATE for code review, formatting, or 'coding standards'. Provides TS-specific code style examples for the cross-language rules defined in craft:code-style-principles, plus TS-specific patterns (optional chaining, nullish coalescing, template literals, no truthy/falsy). DO NOT use for: TypeScript typing rules (see ts-conventions), test conventions, domain/infra layer boundaries (see ts-layer-boundaries)./ts-conventionsACTIVATE when writing TypeScript types, generics, branded types, discriminated unions, or configuring tsconfig. ACTIVATE for 'type vs interface', 'enum alternative', 'branded type', 'satisfies', 'strict mode'. Covers: strict mode policy, no-any/no-enum rules, type over interface, discriminated unions, satisfies operator, branded types for ID safety, utility types. DO NOT use for: code formatting (see ts-code-conventions), functional patterns (see ts-functional)./ts-functionalACTIVATE when writing functional-style TypeScript: pipe, compose, currying, Result types, railway-oriented programming, or AsyncResult. ACTIVATE for 'pipe', 'Result type', 'railway', 'functional', 'chain'. Covers: type-safe pipe implementation, currying patterns, generic Result type, railway-oriented error handling, AsyncResult for async pipelines. DO NOT use for: DDD aggregate modeling (see ddd-ts-fp), OOP patterns (see ts-oop), imperative code./ts-layer-boundariesACTIVATE when wiring a Worker entry point, a Router, a controller, or a domain event consumer in a TypeScript CQRS codebase, or when deciding where a port belongs. ACTIVATE for 'composition root', 'layer boundary', 'ESLint zones', 'domain must not import infrastructure'. Covers: the *Worker.ts composition root, the curried consumer, Router wiring of command endpoints, the five-gesture controller, the domain-to-infrastructure import boundary enforced by ESLint, infrastructure-only ports, in-memory doubles for every port, the read-can-reach-write asymmetry, and read endpoints going through a domain handler. DO NOT use for: the port's own shape and adapter binding (see ts-ports-adapters), the Result type (see ts-functional), domain event structure (see ts-ddd-events)./ts-oopACTIVATE when designing TypeScript classes, and the value objects or collections modelled as classes, or when the user asks about object design, encapsulation, Tell Don't Ask, or Symbol.iterator. Provides TS-specific examples for the cross-language OOP rules defined in craft:oop-principles, plus TS-specific patterns (Symbol.iterator, branded types for primitive identifiers). DO NOT use for: a value object or an aggregate modelled as an immutable record rather than a class (see ddd-ts-fp), refactoring methodology (see ts-refactoring).npx claudepluginhub fabiensalles/claude-marketplace --plugin typescript