← ClaudeAtlas

create-cqrs-commandslisted

Set up the full domain layer for a CQRS entity: identity value object, additional value objects, exception hierarchy, commands (Add, Edit, Delete, Toggle, sub-resource, or any custom domain action), and handler interfaces. Covers everything in src/Core/Domain/{Domain}/. Trigger: "create CQRS commands for {Domain}", "set up domain layer for {Domain}".
jeffsenso/prestashop-skills · ★ 4 · AI & Automation · score 79
Install: claude install-skill jeffsenso/prestashop-skills
# create-cqrs-commands This skill creates the entire domain layer for an entity. It covers the Core side only (interfaces and data objects) — handler implementations live in `implement-cqrs-handlers`. Read [CQRS/CONTEXT.md](../../CONTEXT.md) for conventions (scalar inputs/VO getters, exception hierarchy, handler rules). ## 1. Identity Value Object Create `src/Core/Domain/{Domain}/ValueObject/{Domain}Id.php`: - Constructor takes `int $value`, validates `$value > 0`, throws `{Domain}Exception` if not - Single getter: `getValue(): int` - No Symfony/Doctrine dependencies — pure PHP **Reference:** `src/Core/Domain/Tax/ValueObject/TaxId.php` (simple), `src/Core/Domain/Carrier/ValueObject/CarrierId.php` (complex domain) ## 2. Additional Value Objects (if needed) For fields with non-trivial validation or domain meaning (not just `string`/`int`): - Enum-like fields: class with constants + `fromInt()`/`fromString()` factory - URL fields: validate format in constructor - Constrained numbers: range checks in constructor Not every field needs a VO — only those with invariants beyond primitive type checking. For has-many relations, create typed collections implementing `\Countable` and `\IteratorAggregate`. ## 3. Exception Hierarchy Create in `src/Core/Domain/{Domain}/Exception/` following the hierarchy documented in [CQRS/CONTEXT.md](../../CONTEXT.md#exception-hierarchy): base, not-found, per-action, and constraint classes. **Reference:** `src/Core/Domain/Tax/Exception/` (si