用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/G1Joshi/Agent-Skills --skill cqrs命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | cqrs |
| description | CQRS command query responsibility segregation. Use for complex domains. |
CQRS is a pattern that separates read and update operations for a data store. Instead of using a single model for both, you have a Command Model (Write) and a Query Model (Read).
// Command Side (Write) - Optimized for Integrity
class CreateOrderCommand { ... }
class OrderAggregate {
create(cmd: CreateOrderCommand) {
// Validate business rules
// Save to DB (Normalized / Event Store)
}
}
// Query Side (Read) - Optimized for Speed
class GetOrderSummaryQuery { ... }
class OrderSummaryProjector {
// Listens to "OrderCreated" event
on(event) {
// Update a flat "Read DB" (e.g., ElasticSearch, Redis, Document DB)
// optimized for the specific UI view
}
}
The Read DB is eventually consistent with the Write DB. Logic (Projectors) syncs them via Events.
Do:
Don't:
| Error | Cause | Solution |
|---|---|---|
Stale Data | Lag between Command execution and Query update. | UI design updates (spinners/optimistic updates); Check projector lag. |
Complexity | Over-engineering. | Revert to simple CRUD if the domain doesn't warrant separation. |