CQRS Command Query Generator

Community

Separate reads from writes, optimize backend performance.

AuthorRomualdP
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill implements Command Query Responsibility Segregation (CQRS) to clearly separate read and write operations in the backend, improving scalability, optimizing data payloads, and enhancing maintainability by isolating concerns.

Core Features & Use Cases

  • Commands (Write Operations): Defines DTOs and handlers for operations that modify the system's state (e.g., CreateClubCommand), returning minimal payloads like an ID.
  • Queries (Read Operations): Defines DTOs and handlers for operations that read data (e.g., ListClubsQuery), returning optimized Read Models for the UI.
  • Read Models: Guides on creating lightweight, UI-specific DTOs that can aggregate data from multiple entities without exposing raw domain models.
  • Use Case: When a user wants to create a new club, a CreateClubCommand is dispatched. When they want to view a list of clubs, a ListClubsQuery is executed, returning a ClubListReadModel optimized for display, without affecting the write path.

Quick Start

To create a new write operation, define a CreateXCommand DTO with class-validator and a CreateXHandler that orchestrates domain entities. For a read operation, define a GetXQuery and a GetXHandler that returns a XReadModel interface.

Dependency Matrix

Required Modules

class-validator@nestjs/common

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: CQRS Command Query Generator
Download link: https://github.com/RomualdP/hoki/archive/main.zip#cqrs-command-query-generator

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository