Create cqrs queries

From PrestaShop/PrestaShop · View interactive version

Create cqrs queries is an AI agent skill from the GitHub repository PrestaShop/PrestaShop. Create the read-side CQRS layer: queries, result DTOs, and query handler interfaces. Covers Get{Domain}ForEditing (single entity for edit form) and optionally Get{Domain}sForListing (grid data source). Trigger: "create queries for {Domain}", "set up read side for {Domain}".

How to use this skill

Skill file

create-cqrs-queries

Read CQRS/CONTEXT.md for conventions (scalar inputs/VO getters, QueryResult scalar-only rule).

1. Get-for-editing query

Create src/Core/Domain/{Domain}/Query/Get{Domain}ForEditing.php:

2. Result DTO

Create src/Core/Domain/{Domain}/QueryResult/Editable{Domain}.php:

Reference: src/Core/Domain/Tax/QueryResult/EditableTax.php (simple), src/Core/Domain/Manufacturer/QueryResult/EditableManufacturer.php (with associations)

3. List query (assess first)

Most PS grids use SearchCriteria + grid QueryBuilder directly — no explicit CQRS query class needed.

Check the domain convention before creating a list query:

Reference: Most domains (Tax, Manufacturer, Category) use the grid QueryBuilder pattern without an explicit list query.

4. Query handler interfaces

Create in src/Core/Domain/{Domain}/QueryHandler/:

Rules

Conventions (scalar-only DTOs, read-only queries) are in CQRS/CONTEXT.md. Skill-specific reminders:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.