backend-cqrs-patterns

backend-cqrs-patterns is a skill for Claude Code, Codex from j4flmao/agent-skills. It costs 125 tokens per session (4,063 once invoked), scanned A, original, MIT.

A guide to CQRS, an approach that keeps operations which change data separate from operations which read data. The write side handles validation and consistency, while the read side can use its own optimized model or view.

In plain words
What is it for?
Use it to design command and query handlers, separate read and write models, plan materialized views, and choose between strong and eventual consistency.
Why use it?
It helps when reading and writing data have different performance, structure, or consistency needs.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions Codex.

Good fit Use it to design command and query handlers, separate read and write models, plan materialized views, and choose between strong and eventual consistency.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/j4flmao/agent-skills/cqrs-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add j4flmao/agent-skills --skill cqrs-patterns
Clone the repo
git clone --depth 1 https://github.com/j4flmao/agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for backend-cqrs-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/j4flmao/agent-skills/cqrs-patterns/github.svg)](https://agentmods.dev/skills/j4flmao/agent-skills/cqrs-patterns)
Your own site
<a href="https://agentmods.dev/skills/j4flmao/agent-skills/cqrs-patterns"><img src="https://agentmods.dev/badge/skills/j4flmao/agent-skills/cqrs-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for backend-cqrs-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/j4flmao/agent-skills/cqrs-patterns"><img src="https://agentmods.dev/badge/skills/j4flmao/agent-skills/cqrs-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 125 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,063 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00125 $0.04063
Opus 5 $0.00063 $0.02031
Sonnet 5 $0.00025 $0.00813
Haiku 4.5 $0.00013 $0.00406

Measured 5d ago against content hash b9d4dccbc739, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

backend-cqrs-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/backend/universal/cqrs-patterns/SKILL.md · 521 lines

How it starts

The opening of the file, as written. The whole thing — 521 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Backend CQRS Patterns

Purpose

Separate read and write models so each can be optimized independently — write side for consistency and validation, read side for query performance and projection flexibility.

Agent Protocol

Trigger

Exact user phrases: "CQRS", "command query segregation", "separate read write", "command model", "query model", "read model", "write model", "materialized view", "command handler", "query handler", "command bus", "query bus".

Input Context

  • Whether the system is greenfield or existing.
  • Current data access pattern (CRUD, repository, ORM).
  • Read-to-write ratio and query complexity.
  • Consistency requirements (strong vs eventual).

Output Artifact

CQRS design as text. No file unless requested.

Response Format

Command: {name}
Handler: {class/module}
Validation: {rules}
Write model: {storage}

Query: {name}
Handler: {class/module}
Read model: {storage/projection}

Completion Criteria

  • Commands and queries are in separate model classes.
  • Commands return success/failure, never data.
  • Queries return data, never cause side effects.
  • Write model uses transactional consistency.
  • Read model tolerates eventual consistency.
  • Command validation is separate from command execution.
  • Synchronization mechanism defined (if separate stores).

Max Response Length

Per command/query: 6 lines. Full design: 30 lines.

Architecture Decision Tree

Should I Use CQRS?

Are read and write data shapes significantly different?
  ├── Yes → CQRS candidate
  └── No → Is the read-to-write ratio > 10:1?
            ├── Yes → Consider CQRS for read optimization
            └── No → Is query complexity causing write model compromises?
                      ├── Yes → CQRS may help separate concerns
                      └── No → Simple CRUD is sufficient — skip CQRS

Same Database vs Separate Databases?

Do queries require different storage technology than writes?
  ├── Yes → Separate databases (e.g., PG for writes, Elasticsearch for reads)
  └── No → Can you use materialized views or same-DB projections?
            ├── Yes → Same database, different models (simpler)
            └── No → Separate databases

Read the full file on GitHub · 521 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 521 lines · 125 tokens per session scan A b9d4dccbc739

Subscribe to this mod's changes

backend-cqrs-patterns is a skill published in the GitHub repository j4flmao/agent-skills (22 stars, last pushed 2d ago), licensed MIT. It adds 125 tokens to every session and 4,063 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.