Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)41k · #6638

event-store-design

Skill này làm gì

Công cụ này giúp lên kế hoạch và tạo một “event store” (kho sự kiện) cho các hệ thống ghi lại mọi việc đã xảy ra. Nó hữu ích để lưu trữ thông tin an toàn và có tổ chức.

Khi nào nên dùng

  • ✓Khi xây dựng nền tảng cho một hệ thống ghi nhật ký sự kiện.
  • ✓Khi chọn công nghệ để lưu trữ các sự kiện này.
  • ✓Khi tổ chức cách các sự kiện được lưu và truy xuất.

Liên kết skill

https://github.com/wshobson/agents/blob/main/plugins/backend-development/skills/event-store-design/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/wshobson/agents/blob/main/plugins/backend-development/skills/event-store-design/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Làm thế nào để thiết kế event store để ghi lại hành động của người dùng trong một ứng dụng?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ hướng dẫn bạn tạo cấu trúc cho event store, xác định cách các sự kiện được thêm vào (luôn ở cuối), được sắp xếp thành chuỗi, và cách đảm bảo không có bản sao hay mất mát.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Event Store Design

Comprehensive guide to designing event stores for event-sourced applications.

When to Use This Skill

  • Designing event sourcing infrastructure
  • Choosing between event store technologies
  • Implementing custom event stores
  • Optimizing event storage and retrieval
  • Setting up event store schemas
  • Planning for event store scaling

Core Concepts

1. Event Store Architecture

┌─────────────────────────────────────────────────────┐
│                    Event Store                       │
├─────────────────────────────────────────────────────┤
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐ │
│  │   Stream 1   │  │   Stream 2   │  │   Stream 3   │ │
│  │ (Aggregate)  │  │ (Aggregate)  │  │ (Aggregate)  │ │
│  ├─────────────┤  ├─────────────┤  ├─────────────┤ │
│  │ Event 1     │  │ Event 1     │  │ Event 1     │ │
│  │ Event 2     │  │ Event 2     │  │ Event 2     │ │
│  │ Event 3     │  │ ...         │  │ Event 3     │ │
│  │ ...         │  │             │  │ Event 4     │ │
│  └─────────────┘  └─────────────┘  └─────────────┘ │
├─────────────────────────────────────────────────────┤
│  Global Position: 1 → 2 → 3 → 4 → 5 → 6 → ...     │
└─────────────────────────────────────────────────────┘

2. Event Store Requirements

Requirement Description
Append-only Events are immutable, only appends
Ordered Per-stream and global ordering
Versioned Optimistic concurrency control
Subscriptions Real-time event notifications
Idempotent Handle duplicate writes safely

Technology Comparison

Technology Best For Limitations
EventStoreDB Pure event sourcing Single-purpose
PostgreSQL Existing Postgres stack Manual implementation
Kafka High-throughput streaming Not ideal for per-stream queries
DynamoDB Serverless, AWS-native Query limitations
Marten .NET ecosystems .NET specific

Templates and detailed worked examples

Full template library and detailed worked examples live in references/details.md. Read that file when you need the concrete templates.

Best Practices

Do's

  • Use stream IDs that include aggregate type - Order-{uuid}
  • Include correlation/causation IDs - For tracing
  • Version events from day one - Plan for schema evolution
  • Implement idempotency - Use event IDs for deduplication
  • Index appropriately - For your query patterns

Don'ts

  • Don't update or delete events - They're immutable facts
  • Don't store large payloads - Keep events small
  • Don't skip optimistic concurrency - Prevents data corruption
  • Don't ignore backpressure - Handle slow consumers
Câu hỏi thường gặp

“Event sourcing” là gì?

Đây là cách xây dựng hệ thống trong đó mọi thay đổi trạng thái được lưu dưới dạng một chuỗi sự kiện. Thay vì chỉ lưu trạng thái hiện tại, bạn lưu lịch sử đã dẫn tới trạng thái đó.

Vì sao không được cập nhật hoặc xóa sự kiện?

Sự kiện là các sự thật đã xảy ra. Thay đổi chúng giống như viết lại lịch sử, có thể gây mâu thuẫn. Tốt hơn là thêm sự kiện mới để sửa hoặc hủy các hành động trước đó.

“Correlation IDs” và “causation IDs” là gì?

Đây là các mã định danh giúp theo dõi nguồn gốc và luồng đi của một sự kiện qua các phần khác nhau của hệ thống, giúp gỡ lỗi và hiểu chuyện gì đã xảy ra dễ hơn.

Chi tiết

Mô tả gốc của tác giả

Design and implement event stores for event-sourced systems. Use when building event sourcing infrastructure, choosing event store technologies, or implementing event persistence patterns.

repo: wshobson/agents

Độ phổ biến

Sao GitHub
41k
Vị trí xếp hạng
#6638
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự