
Event Sourcing
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-codeInstalls 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- Mobile First Design869
- Api Security Hardening868
- Mobile App Testing831
- Technical Specification811
- User Story Writing793
- Access Control Rbac763
- User Guide Creation762
- Kubernetes Deployment759
- Logging Best Practices742
- Visual Regression Testing731
- Flutter Development725
- E2e Testing Automation695
- Business Case Development683
- React Component Architecture683
- Docker Containerization681
- Agile Sprint Planning677
- Log Analysis674
- Security Compliance Audit673
- Project Estimation670
- Gitlab Cicd Pipeline669
- Websocket Implementation668
- Requirements Gathering663
- Image Optimization662
- Ruby Rails Application660