realize-read-model

Implements CQRS read-model projections with consumer-driven view contract tests.

Updated Jun 12, 2026
One-click install
npx skills add https://github.com/lucolucus/mismagent --skill realize-read-model-lucolucus
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: realize-read-model
Source: https://github.com/lucolucus/mismagent/tree/main/plugins/mismagent/skills/realize-read-model
Command: npx skills add https://github.com/lucolucus/mismagent --skill realize-read-model-lucolucus

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building the read side of a CQRS architecture often goes wrong: projections silently re-implement domain rules, sort on unpinned fields, or fold event streams assuming an order the wire never guaranteed. This Skill guides the implementation of a single read-model block so its output strictly respects the view_shape pinned in the manifest and is verified by a consumer-driven contract test. ## Core Features & Use Cases - Read-only projection enforcement: keeps all domain rules on the Aggregate; the read-model only consumes already-computed predicates and never writes. - Wire-guarantee-aware folding: designs event folds against the boundary's pinned delivery semantics, handling single-writer streams or commutative folds with tombstones and orphan buffers. - Ordering discipline: rejects sorting on fields not pinned ORDERABLE, bouncing the block instead of shipping a lexicographic bug. - Consumer-driven view tests: translates the user's natural-language tests (tests_nl) into contract tests where the UI is the consumer of the pinned view_shape. - Use Case: When the mismAgent worker builds a block whose manifest type is read-model — for example, a shift-history view aggregating takings — this Skill realizes the projection, runs TDD until green on its own gate, and returns the realized view_shape as its PUBLIC_API. ## Quick Start Ask the worker to realize the read-model block defined in the manifest, implementing its pinned view_shape with a consumer-driven view test.

Frequently Asked Questions about realize-read-model

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

FAQPage Schema
How do I implement a CQRS read-model projection?

Implement the read-model as a read-only projection that serves the view_shape pinned in the manifest, taking predicates already computed by the Aggregate rather than recomputing rules. Verify it with a consumer-driven contract test where the UI is the consumer.

How to fold event streams into a read model safely?

Design the fold against the boundary's pinned delivery guarantees, since cross-stream order does not exist unless pinned. Use single-writer folding on the owning stream or a commutative fold with tombstones and orphan buffers for late or out-of-order events.

Can a read model contain business logic or domain rules?

No. A read-model decides nothing; all domain rules live on the Aggregate. If a predicate is needed, it must be taken already computed from the root or port, never recomputed in the projection.

Why does sorting fail in a read model projection?

Sorting fails when the field's format is not pinned ORDERABLE upstream, because lexicographic ordering over unpinned strings breaks at digit boundaries. The block should be bounced rather than sorting on an unpinned field.

What tests should a CQRS read model have?

A read-model carries a consumer-driven contract test of the view, where the consumer is the UI and the pinned view_shape is verified. Natural-language test statements (tests_nl) are translated into concrete view test cases on shape and values.