cqrs-implementation
實作 CQRS 架構模式
使用命令查詢職責分離建立可擴展應用程式。分離讀取和寫入操作以實現最佳效能和可維護性。
下載技能 ZIP
在 Claude 中上傳
前往 設定 → 功能 → 技能 → 上傳技能
開啟並開始使用
測試它
正在使用「cqrs-implementation」。 Generate a CQRS implementation for inventory management
預期結果:
- Command handlers for stock adjustments, receipts, and transfers
- Query handlers for inventory levels, locations, and history
- Event sourcing for audit trail and stock movement tracking
- FastAPI endpoints with proper HTTP method mapping
- Read model optimization for real-time inventory queries
- Eventual consistency handling for multi-warehouse scenarios
安全審計
安全Pure documentation skill containing Python code examples for CQRS architecture patterns. All 38 static findings are false positives: cryptographic flags triggered by words like 'segregation' and 'separation'; system reconnaissance flags from architectural terms like 'Command' and 'Query'; external_commands flags from markdown backticks; and network flags from legitimate documentation URLs. The skill-report.json already contains a previous audit rating this 'safe'.
風險因素
品質評分
你能建構什麼
建立可擴展的訂單管理
實作 CQRS 來處理高流量的訂單處理,使用獨立的讀取/寫入模型用於庫存和報告。
設計事件驅動的微服務
建立具有適當的命令/查詢分離和最終一致性的事件驅動架構。
最佳化資料庫查詢效能
分離讀取和寫入資料庫以獨立擴展查詢並針對特定使用案例進行最佳化。
試試這些提示
Generate a CQRS implementation for a user registration system with CreateUserCommand and GetUserQuery handlers
Show me how to implement event sourcing with CQRS for an e-commerce order system using Python
Create FastAPI endpoints that use CQRS pattern for a blog post system with separate read/write operations
Implement a read model synchronizer that updates query models from events with proper error handling
最佳實務
- 完全分離命令和查詢模型,避免混合讀取/寫入邏輯
- 使用具有定義 SLA 的最終一致性來更新讀取模型
- 正確地版本化事件以處理隨時間推移的架構演進
避免
- 在命令處理程式中進行查詢會破壞職責分離
- 在讀取和寫入模型之間共享資料庫會造成耦合
- 忽略一致性要求會導致資料過時問題
常見問題
哪些框架可以與這些 CQRS 範例搭配使用?
什麼時候應該避免使用 CQRS?
如何與現有資料庫整合?
事件溯源是 CQRS 必需的嗎?
如何處理讀取-寫入一致性?
CQRS 的效能影響是什麼?
開發者詳情
作者
wshobson授權
MIT
儲存庫
https://github.com/wshobson/agents/tree/main/plugins/backend-development/skills/cqrs-implementation引用
main
檔案結構
📄 SKILL.md