net-cqrs

Implement CQRS patterns in .NET applications using MediatR.

165|62|Updated Jan 9, 2026
One-click install
npx skills add https://github.com/mitkox/ai-coding-factory --skill net-cqrs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: net-cqrs
Source: https://github.com/mitkox/ai-coding-factory/tree/main/.opencode/skill/net-cqrs
Command: npx skills add https://github.com/mitkox/ai-coding-factory --skill net-cqrs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enables developers to implement a clean CQRS pattern in .NET applications using MediatR, separating command and query responsibilities for maintainable, scalable code.

Core Features & Use Cases

  • Command handlers for mutations
  • Query handlers for reads
  • MediatR pipeline configuration
  • Validation with FluentValidation
  • Domain events publishing
  • Event-sourcing basics
  • Use Case: Build a maintainable order workflow with commands, queries, and events in a Clean Architecture project.

Quick Start

Use the net-cqrs skill to implement a CreateOrder command with its validator, a corresponding GetOrder query, and register MediatR pipeline behaviors in a Clean Architecture project.

Frequently Asked Questions about net-cqrs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement CQRS with MediatR in a .NET Clean Architecture project?

Implementing CQRS with MediatR in .NET involves separating command and query handlers, configuring pipeline behaviors, and using FluentValidation. This approach provides a ready-to-use template for maintainable, scalable code across enterprise-grade services.

What is the best way to handle validation in a .NET CQRS pipeline?

The best way to handle validation in a .NET CQRS pipeline is using FluentValidation within MediatR pipeline behaviors. This ensures commands are validated before execution, maintaining clean architecture boundaries and preventing invalid state mutations.

How does domain event publishing work with MediatR commands?

Domain event publishing with MediatR commands works by dispatching events through the MediatR pipeline after a command handler processes a mutation. This allows decoupled notification of state changes across your Clean Architecture setup.

Can I use this CQRS template for both reads and writes in a .NET application?

Yes, you can use this CQRS template for both reads and writes in a .NET application by implementing dedicated query handlers for reads and command handlers for mutations. This separation ensures optimized, maintainable data access.

When should I separate commands and queries in a .NET application?

You should separate commands and queries in a .NET application when building complex, enterprise-grade services that require scalable and maintainable code. Using CQRS with MediatR allows independent evolution of read and write logic.

Does MediatR support transactional behavior and event sourcing basics in .NET?

MediatR supports transactional behavior and event sourcing basics in .NET through pipeline behaviors and domain event publishing. This allows you to coordinate mutations and dispatch events reliably within a Clean Architecture setup.