PluginBench
Skill
Review
Audit score 70

event-store-design

wshobson/agents

Design and implement event stores for event-sourced systems with architecture patterns and technology guidance.

What is event-store-design?

This skill provides comprehensive guidance for designing event stores in event-sourced applications. Use it when building event sourcing infrastructure, selecting event store technologies, implementing custom event stores, or optimizing event persistence and retrieval patterns.

  • Compare event store technologies (EventStoreDB, PostgreSQL, Kafka, DynamoDB, Marten) with trade-offs
  • Design event store architecture with streams, aggregates, and global ordering
  • Implement append-only, versioned event storage with optimistic concurrency control
  • Plan event subscriptions and real-time notification systems
  • Apply best practices for stream IDs, correlation tracking, and idempotency
  • Optimize indexing and query patterns for event retrieval

How to install event-store-design

npx skills add https://github.com/wshobson/agents --skill event-store-design
Claude Code
Cursor
Windsurf
Cline

How to use event-store-design

  1. 1.Review the event store architecture diagram to understand streams, aggregates, and global ordering
  2. 2.Consult the technology comparison table to select the right event store for your constraints
  3. 3.Apply the Do's best practices: use typed stream IDs, include correlation IDs, version events, implement idempotency
  4. 4.Avoid the Don'ts: never update/delete events, keep payloads small, enforce optimistic concurrency, handle backpressure
  5. 5.Reference the detailed templates in references/details.md for concrete implementation examples

Use cases

Good for
  • Choosing between EventStoreDB, PostgreSQL, or Kafka for a new event-sourced system
  • Designing stream structure and event schema for order or user aggregates
  • Implementing idempotent event writes to handle duplicate requests safely
  • Setting up event subscriptions for downstream projections or sagas
  • Planning event store scaling and handling high-throughput streaming scenarios
Who it's for
  • Backend engineers building event-sourced systems
  • Architects designing CQRS and event sourcing infrastructure
  • Teams migrating to event sourcing from traditional databases
  • Developers optimizing event storage and retrieval performance

event-store-design FAQ

What's the difference between stream ordering and global ordering?

Stream ordering maintains event sequence within a single aggregate stream (e.g., Order-123). Global ordering tracks all events across the entire event store for subscriptions and projections.

Why include correlation and causation IDs in events?

They enable tracing causal relationships between events across aggregates and systems, essential for debugging distributed systems and understanding event chains.

How do I handle duplicate event writes?

Implement idempotency using event IDs for deduplication. When the same event ID is written twice, the store rejects or ignores the duplicate rather than creating a duplicate entry.

Should I store large data in events?

No. Keep events small and focused on facts. Store large payloads separately and reference them by ID, reducing storage overhead and improving query performance.

What's optimistic concurrency control in event stores?

It uses version numbers to detect conflicts: writes include the expected version, and the store rejects writes if the stream version has advanced, preventing lost updates.

Full instructions (SKILL.md)

Source of truth, from wshobson/agents.


name: event-store-design description: Design and implement event stores for event-sourced systems. Use when building event sourcing infrastructure, choosing event store technologies, or implementing event persistence patterns.

Event Store Design

Comprehensive guide to designing event stores for event-sourced applications.

When to Use This Skill

  • Designing event sourcing infrastructure
  • Choosing between event store technologies
  • Implementing custom event stores
  • Optimizing event storage and retrieval
  • Setting up event store schemas
  • Planning for event store scaling

Core Concepts

1. Event Store Architecture

┌─────────────────────────────────────────────────────┐
│                    Event Store                       │
├─────────────────────────────────────────────────────┤
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐ │
│  │   Stream 1   │  │   Stream 2   │  │   Stream 3   │ │
│  │ (Aggregate)  │  │ (Aggregate)  │  │ (Aggregate)  │ │
│  ├─────────────┤  ├─────────────┤  ├─────────────┤ │
│  │ Event 1     │  │ Event 1     │  │ Event 1     │ │
│  │ Event 2     │  │ Event 2     │  │ Event 2     │ │
│  │ Event 3     │  │ ...         │  │ Event 3     │ │
│  │ ...         │  │             │  │ Event 4     │ │
│  └─────────────┘  └─────────────┘  └─────────────┘ │
├─────────────────────────────────────────────────────┤
│  Global Position: 1 → 2 → 3 → 4 → 5 → 6 → ...     │
└─────────────────────────────────────────────────────┘

2. Event Store Requirements

RequirementDescription
Append-onlyEvents are immutable, only appends
OrderedPer-stream and global ordering
VersionedOptimistic concurrency control
SubscriptionsReal-time event notifications
IdempotentHandle duplicate writes safely

Technology Comparison

TechnologyBest ForLimitations
EventStoreDBPure event sourcingSingle-purpose
PostgreSQLExisting Postgres stackManual implementation
KafkaHigh-throughput streamingNot ideal for per-stream queries
DynamoDBServerless, AWS-nativeQuery limitations
Marten.NET ecosystems.NET specific

Templates and detailed worked examples

Full template library and detailed worked examples live in references/details.md. Read that file when you need the concrete templates.

Best Practices

Do's

  • Use stream IDs that include aggregate type - Order-{uuid}
  • Include correlation/causation IDs - For tracing
  • Version events from day one - Plan for schema evolution
  • Implement idempotency - Use event IDs for deduplication
  • Index appropriately - For your query patterns

Don'ts

  • Don't update or delete events - They're immutable facts
  • Don't store large payloads - Keep events small
  • Don't skip optimistic concurrency - Prevents data corruption
  • Don't ignore backpressure - Handle slow consumers