From aj-geddes-useful-ai-prompts-4
Implements event sourcing and CQRS patterns with event stores, aggregates, projections, and snapshots. Use for audit trails, temporal queries, and systems requiring full history.
How this skill is triggered — by the user, by Claude, or both
Slash command
/aj-geddes-useful-ai-prompts-4:event-sourcingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- [Overview](#overview)
Store state changes as a sequence of events rather than the current state, enabling temporal queries, audit trails, and event replay.
Minimal working example:
interface DomainEvent {
id: string;
aggregateId: string;
aggregateType: string;
eventType: string;
data: any;
metadata: {
userId?: string;
timestamp: number;
version: number;
};
}
interface Aggregate {
id: string;
version: number;
}
class EventStore {
private events: DomainEvent[] = [];
async appendEvents(
aggregateId: string,
expectedVersion: number,
events: Omit<DomainEvent, "id" | "metadata">[],
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Event Store (TypeScript) | Event Store (TypeScript) |
| Projections (Read Models) | Projections (Read Models) |
| Event Store with PostgreSQL | Event Store with PostgreSQL |
| Snapshots for Performance | Snapshots for Performance |
npx claudepluginhub aj-geddes/useful-ai-promptsDesigns event-sourced systems using CQRS, event stores, projections, sagas, and eventual consistency patterns. Useful for audit trails, temporal queries, and complex workflows.
Provides expert guidance for implementing CQRS and Event Sourcing patterns with separated read/write models, complete audit trails, and temporal queries.
Designs event-sourced systems with CQRS, event stores, projections, and sagas. Use for audit trails, temporal queries, and complex domain modeling.