Agent skill · software engineering · aiskillstore
cqs-patterns
Command Query Separation (CQS) and CQRS patterns for .NET. Use when designing methods, handlers, and application architecture. Ensures predictable, testable code.
Why this skill is useful
Provides specific patterns and examples for implementing CQS and CQRS in .NET, which the AI may not reliably generate on its own.
What it needs
About 6k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.
What this skill does
Command Query Separation (CQS) The Principle A method should either be a Command that performs an action, or a Query that returns data, but not both. --- CQS at Method Level Violation Examples Correct CQS Implementation --- CQS Exceptions Some situations justify combining command and query: 1. Atomic Operations 2. Fluent APIs 3. Factory Methods --- CQRS - Command Query Responsibility Segregation CQRS applies CQS at the architectural level, using separate models for reads and writes. Commands and Queries Command Handlers Query Handlers Dispatcher Pattern Usage in Controllers --- Benefits of CQS/CQRS Benefit Description --------- ------------- Testability Commands and queries are isolated, easy to test Scalability Read and write sides can scale independently Optimization Read models optimized for queries, write models for business rules Clarity Clear intent - methods either change state or return data Maintainability Single responsibility, easier to modify Debugging Queries are safe to call repeatedly --- When to Use CQRS Good Fit Complex domains with different read/write patterns High-read, low-write scenarios Systems requiring audit trails Event-sourced systems Microservices with separate read replicas Not Needed Simple CRUD applications Small teams/projects Consistent read/write patterns When added complexity outweighs benefits --- Quick Reference
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills aiskillstore/cqs-patterns