Skip to content
Back to skills

Event Sourcing

ASecurity

Event sourcing — state as an append-only event log, event design and versioning (upcasting), snapshots, projections, replay and rebuild, GDPR and deletion concerns, operational costs. Use when audit history or temporal queries are core requirements (event sourcing, event store, upcasting, snapshots, replay).

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
ai-agentsgorails

Security analysis

A100/100

Scanned December 3, 2026

npx -y skills add vectora-os/kit --skill event-sourcing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Event Sourcing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Event Sourcing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectora-os-event-sourcing/badge)](https://www.skillsdirectory.com/skills/vectora-os-event-sourcing)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: event-sourcing
description: Event sourcing — state as an append-only event log, event design and versioning (upcasting), snapshots, projections, replay and rebuild, GDPR and deletion concerns, operational costs. Use when audit history or temporal queries are core requirements (event sourcing, event store, upcasting, snapshots, replay).
metadata:
  category: design-patterns
---

# Event sourcing

## Purpose

Persist every state change as an immutable event when history itself is a requirement.

**Use when:** full audit trails, temporal queries or complex state reconstruction are required.

**Not for:** when a simple audit table suffices.

## Inputs

- Domain events, audit and temporal requirements.

## Outputs

- Event schemas, versioning strategy, snapshot and projection design.

## Read first

- [Project Brain](../../../project-brain/README.md) — `npm run brain -- query "event sourcing"` for prior decisions, patterns and anti-patterns.

## Steps

1. **Justify.** Confirm history is a requirement, not a nice-to-have; compare with an audit log.
   Done when decision is recorded via `decision-analysis`.
2. **Events.** Design fine-grained, business-meaningful, past-tense events with schemas.
   Done when each event has a versioned schema.
3. **Evolution.** Plan upcasting and never rewrite stored events.
   Done when old events remain readable.
4. **Operations.** Design snapshots, projection rebuild time, and personal data handling (crypto-shredding).
   Done when rebuild time is measured; deletion path exists.

## Best practices

- Events describe business facts, not CRUD diffs.
- Keep personal data out of events or encrypt per subject.
- Measure replay time early.

## Common mistakes

- Using event sourcing for every entity.
- Breaking event schemas.
- No plan for right-to-erasure.

## Example

Ledger: `FundsDeposited`, `FundsWithdrawn` events; snapshot every 500 events; balances projection rebuild 4 min for 10M events.

## Reusable prompt

```text
Apply the Event sourcing skill (.agents/skills/event-sourcing/SKILL.md).
Context: {{task card or question; links to PRD, ADRs, code paths}}
Constraints: {{approved thresholds, deadlines, allowed files}}
Assess whether event sourcing is justified, then design events, versioning, snapshots, projections and the personal-data strategy.
Return: Event schemas, versioning strategy, snapshot and projection design..
Cite evidence (file:line, command output, source) for every claim; list open questions separately.
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.