cqs-patterns
Apply CQS and CQRS Patterns in .NET
Teams often mix state changes and data reads, which makes code harder to test and reason about. This skill guides clear CQS and CQRS designs for .NET methods, handlers, and controllers.
Install with my Agent
Copy this request to your Agent. It includes the canonical Skill page and manifest.
Review the Skillstore skill "cqs-patterns" from https://skillstore.io/skills/doubleslashse-cqs-patterns.md and its manifest at https://skillstore.io/api/skills/doubleslashse-cqs-patterns/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.Your Agent should still show its plan and request any confirmation required by the security policy.
Agent-readable resources
Use these links when an AI agent, crawler, or script needs clean context instead of reading the full page.
Test it
Using "cqs-patterns". A stack class has one method that removes and returns the top item.
Expected outcome:
- The method mixes a command and a query.
- Use one operation to inspect the top item and a separate operation to remove it.
- This keeps repeated reads safe and makes state changes explicit.
Using "cqs-patterns". An order feature needs create, cancel, lookup, and customer order list operations.
Expected outcome:
- Create and cancel are commands because they change state.
- Lookup and list operations are queries because they return data without side effects.
- Separate handlers make validation, persistence, and read optimization easier to test.
Using "cqs-patterns". A small CRUD admin page is being considered for CQRS.
Expected outcome:
- CQRS may add unnecessary complexity for a simple admin workflow.
- Use it only if read and write models have meaningfully different needs.
- A standard service or controller may be enough.
Security Audit
SafeAll static findings appear to be false positives caused by Markdown code fences, ASCII diagrams, and C# examples in documentation. I found no prompt injection, data exfiltration intent, executable scripts, network behavior, or real system reconnaissance in SKILL.md.
Risk Factors
โ๏ธ External commands (25)
Share & cite this report
Share the versioned assessment report, neutral badge, embed card, and citations. Skillstore reports evidence without deciding whether this Skill is safe.
Copy report link
https://skillstore.io/skills/doubleslashse-cqs-patterns/audits/9?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdown badge
[](https://skillstore.io/skills/doubleslashse-cqs-patterns?utm_source=security_passport_badge)HTML badge
<a href="https://skillstore.io/skills/doubleslashse-cqs-patterns?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/doubleslashse-cqs-patterns/security.svg" alt="Skillstore security assessment" loading="lazy"></a>Embed card
<iframe src="https://skillstore.io/embed/skills/doubleslashse-cqs-patterns.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>Academic citations (APA ยท BibTeX ยท CFF)
APA citation
DoubleslashSE. (2026). cqs-patterns security audit report (audit version 9) [Author version unspecified]. Skillstore. https://skillstore.io/skills/doubleslashse-cqs-patterns/audits/9BibTeX citation
@techreport{doubleslashse-doubleslashse-cqs-patterns-2026,
author = {DoubleslashSE},
title = {cqs-patterns security audit report (audit version 9)},
institution = {Skillstore},
year = {2026},
number = {9},
url = {https://skillstore.io/skills/doubleslashse-cqs-patterns/audits/9},
note = {Author version unspecified}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "cqs-patterns security audit report (audit version 9)"
version: "unspecified"
type: report
authors:
- name: "DoubleslashSE"
date-released: "2026-07-06"
url: "https://skillstore.io/skills/doubleslashse-cqs-patterns/audits/9"
identifiers:
- type: other
value: "skillstore:doubleslashse-cqs-patterns:audit:9"
description: "Skillstore immutable audit report identifier"
Skillstore Score
Why this score Evidence Confidence: HighWhat You Can Build
Separate Service Methods
Review service methods that both modify state and return domain data, then split them into clearer commands and queries.
Design CQRS Handlers
Create command and query records with matching handlers for a .NET application layer.
Review Architecture Complexity
Decide whether a feature needs CQRS or whether simpler CRUD patterns are more appropriate.
Try These Prompts
Review this .NET class for CQS violations. Identify methods that both change state and return data, then suggest simpler names and responsibilities.
Refactor this service API into separate command and query operations. Keep behavior equivalent and explain each new responsibility.
Design a CQRS application layer for this feature. Include command records, query records, handler responsibilities, and controller flow.
Assess whether CQRS fits this system. Compare benefits, added complexity, testing impact, read model needs, and alternatives.
Best Practices
- Name commands with imperative verbs and queries with read-oriented names.
- Keep queries free of side effects so they are safe to repeat.
- Use CQRS when read and write paths have different models, scale, or rules.
Avoid
- Returning full domain objects from methods that also persist changes.
- Adding CQRS to simple CRUD screens without a clear need.
- Hiding state changes inside getters, calculated properties, or query handlers.
Frequently Asked Questions
What problem does this skill solve?
Does it generate production-ready code?
Is CQS the same as CQRS?
When should I avoid CQRS?
Can commands return identifiers?
Which tools can use this skill?
Developer Details
Author
DoubleslashSELicense
MIT
Skillstore revision
r1
Version notice
The author did not declare a version.
Repository
https://github.com/DoubleslashSE/claude-workflows/tree/main/Plugins/dotnet-tdd/skills/cqs-patternsRef
72d5025b022c77f7a51bdf5c1637c689c80e89d1
Maintenance freshness
7/21/2026
Usage
5 downloads ยท 194 views
File structure
๐ SKILL.md