用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/G1Joshi/Agent-Skills --skill event-sourcing命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | event-sourcing |
| description | Event sourcing event-based persistence. Use for audit trails. |
Event Sourcing ensures that all changes to application state are stored as a sequence of events. We don't just store the current state; we store "what happened".
Traditional (State Stored):
Order { id: 1, status: 'Shipped' } -> Update to 'Delivered' -> Order { id: 1, status: 'Delivered' } (History lost)
Event Sourcing (Events Stored):
OrderCreated(id=1)PaymentReceived(id=1)OrderShipped(id=1)OrderDelivered(id=1)To get current state: Replay (1) + (2) + (3) + (4).
A database optimized for appending immutable events (e.g., EventStoreDB).
To avoid replay performance issues for long histories (10,000 events), save a "Snapshot" every 100 events. Replay = Snapshot + subsequent events.
Code that listens to events and builds a read-optimized view (The "R" in CQRS).
Do:
Don't:
| Error | Cause | Solution |
|---|---|---|
Slow Replay | Too many events for an aggregate. | Implement Snapshots or check Aggregate boundaries. |
Schema Evolution | Old events don't match new code. | Implement "Upcasters" to transform old events on the fly. |