cqrs-implementation – skill Viết lách & Nội dung cho agent AI
Triển khai CQRS (Command Query Responsibility Segregation) cho kiến trúc có khả năng mở rộng. Dùng khi tách mô hình đọc và ghi, tối ưu hiệu năng truy vấn hoặc xây dựng hệ thống event-sourced.
Cài skill cqrs-implementation bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/cqrs-implementation-93b3f.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /cqrs-implementation – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/cqrs-implementation-93b3f.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $cqrs-implementation – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/cqrs-implementation-93b3f.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /cqrs-implementation – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/cqrs-implementation-93b3f.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /cqrs-implementation – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
CQRS Implementation
Comprehensive guide to implementing CQRS (Command Query Responsibility Segregation) patterns.
When to Use This Skill
- Separating read and write concerns
- Scaling reads independently from writes
- Building event-sourced systems
- Optimizing complex query scenarios
- Different read/write data models needed
- High-performance reporting requirements
Core Concepts
1. CQRS Architecture
┌─────────────┐
│ Client │
└──────┬──────┘
│
┌────────────┴────────────┐
│ │
▼ ▼
┌─────────────┐ ┌─────────────┐
│ Commands │ │ Queries │
│ API │ │ API │
└──────┬──────┘ └──────┬──────┘
│ │
▼ ▼
┌─────────────┐ ┌─────────────┐
│ Command │ │ Query │
│ Handlers │ │ Handlers │
└──────┬──────┘ └──────┬──────┘
│ │
▼ ▼
┌─────────────┐ ┌─────────────┐
│ Write │─────────►│ Read │
│ Model │ Events │ Model │
└─────────────┘ └─────────────┘2. Key Components
| Component | Responsibility |
| ------------------- | ------------------------------- |
| Command | Intent to change state |
| Command Handler | Validates and executes commands |
| Event | Record of state change |
| Query | Request for data |
| Query Handler | Retrieves data from read model |
| Projector | Updates read model from events |
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
- Separate command and query models - Different needs
- Use eventual consistency - Accept propagation delay
- Validate in command handlers - Before state change
- Denormalize read models - Optimize for queries
- Version your events - For schema evolution
Don'ts
- Don't query in commands - Use only for writes
- Don't couple read/write schemas - Independent evolution
- Don't over-engineer - Start simple
- Don't ignore consistency SLAs - Define acceptable lag
Skill liên quan
- baoyu-post-to-x – Đăng nội dung và bài viết lên X (Twitter). Hỗ trợ bài đăng thường có hình ảnh/video và X…
- copy-editing – Dùng khi người dùng muốn chỉnh sửa, rà soát hoặc cải thiện nội dung marketing hiện có…
- boost-asio-pro – Dùng khi viết hoặc review code mạng bất đồng bộ C++ với Boost.Asio hoặc Asio độc lập…
- dhdna-profiler – Áp dụng khung DHDNA như thang đánh giá khám phá để phân tích mẫu suy luận và viết trong…
- baoyu-translate – Skill này nên được dùng khi người dùng yêu cầu “translate”, “翻译”, “精翻”, “translate…
- baoyu-wechat-summary – Tóm tắt các điểm nổi bật của nhóm chat WeChat thành bản tin có cấu trúc bằng binary…
- exa-search – Tìm kiếm nội dung web khoa học và kỹ thuật bằng Exa, đồng thời trích xuất văn bản từ…
- caveman – Chế độ giao tiếp siêu nén. Giảm khoảng 75% token bằng cách bỏ từ đệm, mạo từ và lời xã…