event-sourcing

Model TypeScript system state as an append-only action log.

Updated Mar 8, 2026
One-click install
npx skills add https://github.com/AndreaCadonna/sbobuz-web-game-app --skill event-sourcing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: event-sourcing
Source: https://github.com/AndreaCadonna/sbobuz-web-game-app/tree/main/skills/event-sourcing
Command: npx skills add https://github.com/AndreaCadonna/sbobuz-web-game-app --skill event-sourcing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Event sourcing models state as a sequence of immutable events rather than mutable state, enabling a complete audit trail and deterministic replay for debugging and recovery.

Core Features & Use Cases

  • Immutable state with an action log as the source of truth
  • Validation separation from reducers to keep state transitions pure
  • Snapshotting and replay mechanisms for scalable long-running systems
  • Typified actions and events (discriminated unions) for strong typing in TypeScript
  • Applicable to game engines, workflows, and any domain needing auditability and replay

Quick Start

Create an initial state, define a typed action log, and replay a sequence of actions to produce the final state.

Frequently Asked Questions about event-sourcing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build an event sourcing system with TypeScript for deterministic state replay?

To build an event sourcing system in TypeScript, model your state as an append-only action log using typed discriminated unions for actions. Use immutable reducers and a separate validator phase to guarantee deterministic replay outcomes and a complete audit trail.

What is the best way to structure reducers for an event-sourced game state architecture?

The best way to structure reducers for an event-sourced game state is to keep them completely pure and immutable, separating validation logic from state transitions. This ensures the action log remains the single source of truth for deterministic replay.

When do I need snapshotting in an event-sourced state machine?

You need snapshotting in an event-sourced state machine when managing scalable, long-running systems. Snapshots capture intermediate state to avoid replaying the entire action log from the beginning, significantly optimizing recovery and debugging processes.

Does event sourcing work with CQRS patterns for audit trails in TypeScript workflows?

Event sourcing works effectively with CQRS patterns in TypeScript workflows by maintaining an immutable action log as the source of truth. This combination provides a reliable audit trail and enables deterministic replay for complex state machines and workflow debugging.

Why should validation be separated from reducers in a deterministic replay architecture?

Validation must be separated from reducers in a deterministic replay architecture to keep state transitions pure. If reducers handle validation, impure side effects break reproducibility, making the action log unreliable for audit trails and state recovery.

Can I use event sourcing for workflow state management instead of just game engines?

You can use event sourcing for workflow state management alongside game engines. Any domain requiring auditability, immutable state, and deterministic replay benefits from modeling system state as a sequence of typed events within an append-only log.