Przejdź do treści
Biblioteka skilli
Programowanie · Nauka i wyjaśnianie

event-sourcing

/event-sourcing

Opisuje przechowywanie stanu jako dziennika zdarzeń z projekcjami i snapshotami oraz pomaga ocenić, kiedy wzorzec to przesada, np. gdy historia audytu jest wymogiem.

Repozytorium
AI-SKILLS ↗
Licencja
MIT
Ostatnia zmiana repozytorium
05.09.2026

Ocena i bezpieczeństwo

90/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść25 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 05.09.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Opisuje przechowywanie stanu jako dziennika zdarzeń z projekcjami i snapshotami oraz pomaga ocenić, kiedy wzorzec to przesada, np. gdy historia audytu jest wymogiem.

Oryginalny opis (EN)

Persist state as an append-only event log with projections and snapshots, and know when the pattern is overkill. Use when audit history is a first-class requirement or evaluating event sourcing against CRUD.

Jak działa

  1. Method
  2. Boundaries
Sekcje z nagłówków SKILL.md, w oryginale · 55 linii, 409 słów
Podgląd SKILL.md
---
name: event-sourcing
description: Persist state as an append-only event log with projections and snapshots, and know when the pattern is overkill. Use when audit history is a first-class requirement or evaluating event sourcing against CRUD.
---

# Event sourcing

State becomes derived data: the log of what happened is the truth, and
current state is a fold over it. You buy perfect history and temporal
queries; you pay with schema-for-life discipline and eventual-read
plumbing.

## Method

1. **Adopt only for log-shaped requirements.** Audit that cannot lie,
   temporal reconstruction ("what did we believe on May 3"), domains
   that are natively event streams (ledgers, orders, inventory
   movements). "It might be nice to have history" is what changelog
   tables are for; see the Boundaries.
2. **Design events as immutable business facts.** Past tense, aggregate
   id, sequence number, occurred_at, schema version:
   `OrderShipped{order_id, carrier, at}`. Facts, not CRUD deltas
   (`RowUpdated{diff}` is a changelog, not a domain event) and not
   commands (`ShipOrder` is a request; it can be rejected).
3. **Write through the aggregate with optimistic concurrency.** Load the
   aggregate's events (or snapshot + tail), validate the command against
   current state, append new events with expected-version
   compare-and-swap. A version conflict means someone else wrote first:
   reload and retry. This is the consistency boundary; keep aggregates
   small enough that conflicts are rare.
4. **Read from projections.** Consumers fold events into read models
   (SQL tables, search indexes, caches), each rebuildable from the log.
   Projections lag: this is CQRS's eventual consistency (see cqrs), so
   session tricks (read-your-writes via in-memory apply) cover the UI
   where lag shows.
5. **Snapshot for load time, never for truth.** When replay exceeds
   tens of milliseconds, store `(aggregate_id, version, state)` every N
   events and replay the tail. Snapshots are disposable cache;
   correctness never depends on them.
6. **Version events additively, upcast on read.** New optional fields
   are free; shape changes get a new event version plus an upcaster
   (old shape to new) applied at read/replay. You will replay
   five-year-old events; every schema decision is permanent in a way
   CRUD migrations are not.
7. **Handle mistakes with compensating events.** Wrong shipment gets
   `ShipmentCorrected`, not an edited log. For legal erasure (GDPR),
   crypto-shredding (per-subject encryption keys, deleted on request)
   keeps the log immutable while the data dies.

## Boundaries

- Most systems need an audit trail, not event sourcing: an append-only
  changelog table beside CRUD state (or CDC feeding one) delivers 80%
  of the value at 20% of the cost. Choose that first.
- Cross-aggregate invariants do not fit inside one append; they become
  sagas (see saga-pattern) or process managers, with real complexity.
- The event log is a poor query engine; without projections you have
  written a database with no indexes.

Wersje

RepozytoriumWynikLicencja
Ta strona · Amey-Thakur/AI-SKILLS90MIT
citypaul/.dotfiles100MIT
G1Joshi/Agent-Skills100MIT

Migawka bazy z 28.10.2026 · wersja paczki 7a85ee7ce13c (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100crud-vs-event-sourcing
    Pomaga zdecydować, czy funkcja lub agregat w .NET ma być zbudowana jako CRUD, Event Sourcing czy architektura sterowana zdarzeniami, i wskazuje konkretną ścieżkę implementacji.
  • 90event-sourcing-architect
    Projektuje systemy oparte na event sourcingu z CQRS, magazynami zdarzeń, projekcjami i wzorcami spójności ostatecznej.
  • 95backend-event-sourcing
    Wdraża event sourcing: zdarzenia jako jedyne źródło prawdy, stan odtwarzany z dziennika, niezmienne zdarzenia i przebudowę projekcji.
  • 95event-store
    Projektuje i implementuje magazyny zdarzeń dla systemów event sourcing: trwałość zdarzeń, projekcje, snapshoty i wzorzec CQRS.
  • 100cqrs-event-sourcing
    Pomaga projektować architektury zdarzeniowe: granice agregatów, wybór między event sourcingiem a przechowywaniem stanu bieżącego, modele odczytu i porządkowanie nakładających się obiektów domeny emitujących zdarzenia.
  • 95event-driven
    Wyjaśnia i wdraża architekturę sterowaną zdarzeniami: Event Sourcing, CQRS, wzorzec Saga i magistrale jak Kafka czy RabbitMQ.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.