Stores your application state as an immutable sequence of events instead of just the current state, which means you can rebuild state at any point in time, run temporal queries, and get full audit trails for free. The skill covers event stores, aggregates, CQRS projections, and includes practical implementations in TypeScript and PostgreSQL. Use this when you need audit compliance, are building financial systems, or want to debug by replaying past states. The concurrency control and snapshot examples are solid, though you'll need to think hard about event schema evolution before you're in production. Fair warning that querying gets more complex since you're reading from projections instead of your source of truth.

skills.sh installs
892
GitHub stars
379
last updated
Aug 21, 2026

Install

$ npx -y skills add aj-geddes/useful-ai-prompts --skill event-sourcing --agent claude-code

Installs into .claude/skills of the current project.

Files

Event Sourcing

Table of Contents

Overview

Store state changes as a sequence of events rather than the current state, enabling temporal queries, audit trails, and event replay.

When to Use

  • Audit trail requirements
  • Temporal queries (state at any point in time)
  • Event-driven microservices
  • CQRS implementations
  • Financial systems
  • Complex domain models
  • Debugging and analysis
  • Compliance and regulation

Quick Start

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)

Reference Guides

Sponsors

Details

Repository
github.com/aj-geddes/useful-ai-prompts
Category
AI & Agent Building
First seen
May 16, 2026

More from aj-geddes/useful-ai-prompts

All 258
1dbt-labs avatarworking-with-dbt-meshdbt-labs/dbt-agent-skillsUse when changing a dbt model in a way that could break its consumers — renaming, removing, or retyping a column, or changing a model that downstream models, ex892skills.sh installs
2asyrafhussin avatargit-workflowasyrafhussin/agent-skillsGit best practices, branching strategies, commit conventions, and PR workflows. Use when reviewing git history, writing commits, setting up branching strategy, 890skills.sh installs
3github avatarsalesforce-apex-qualitygithub/awesome-copilotApex code quality guardrails for Salesforce development. Enforces bulk-safety rules (no SOQL/DML in loops), sharing model requirements, CRUD/FLS security, SOQL 885skills.sh installs
4pulumi avatarprovider-upgradepulumi/agent-skillsUpgrade any Pulumi provider to a newer version and reconcile the resulting diff. Use when users want to upgrade or update a provider (including editing package.885skills.sh installs
5github avatarreact-audit-grep-patternsgithub/awesome-copilotProvides the complete, verified grep scan command library for auditing React codebases before a React 18.3.1 or React 19 upgrade. Use this skill whenever runnin884skills.sh installs
6mblode avataragents-mdmblode/agent-skillsAudits, scores, and refactors AGENTS.md and CLAUDE.md agent instruction files using execution-first standards: working commands, real-failure gotchas, signal-to884skills.sh installs