This prompt is designed for architects and platform engineers who have drafted a read model schema and event subscription list and need a rigorous, pre-implementation review. The job-to-be-done is not to generate code, but to surface design risks that are easy to miss during whiteboard sessions: stale read windows, projection synchronization gaps, rebuild feasibility, and query performance bottlenecks. The ideal user understands CQRS fundamentals and can provide a concrete read model schema, the list of events it subscribes to, and the intended query patterns. The prompt acts as a second pair of eyes, systematically evaluating the design against known failure modes in eventually-consistent systems.
Prompt
CQRS Read Model Design Prompt

When to Use This Prompt
Use this prompt to conduct a structured design review of a CQRS read model before writing projection handler code.
You should run this prompt after the team has aligned on the read model's purpose and shape but before any projection handler code is written. Required inputs include the read model's target schema (fields, types, and keys), the list of source events with their schemas, the expected query load and latency requirements, and the planned rebuild strategy (e.g., full replay from event store, snapshot-based, or hybrid). The prompt assumes the event store and write-side model are already defined; it does not review the command side. Do not use this prompt for simple CRUD views that don't involve event projection, or for systems where strong consistency is required and eventual consistency is unacceptable.
The prompt's value lies in its structured output: it produces a review covering projection logic gaps, eventual consistency window analysis, rebuild strategy feasibility, and query performance risks. It also includes explicit eval checks for stale read risk and synchronization gaps. After receiving the output, the team should walk through each identified risk, decide which require design changes, and document the accepted trade-offs in an architecture decision record. Avoid using this prompt as a one-time gate; re-run it when the event schema evolves or new query patterns are introduced, as these changes often invalidate prior assumptions about consistency and performance.
Use Case Fit
Where this prompt works, where it fails, and what you need before you start.
Good Fit: Greenfield Read Model Design
Use when: designing a new read model from a known event stream or write model. The prompt excels at identifying projection boundaries, query patterns, and consistency windows before code is written. Guardrail: provide the event schema, expected query load, and freshness requirements.
Bad Fit: Runtime Query Optimization
Avoid when: debugging a slow production query or tuning database indexes. This prompt reviews design structure, not execution plans. Guardrail: use a database-specific performance analysis prompt for runtime issues; this prompt is for design review before implementation.
Required Inputs
What you need: event schemas, write model aggregate boundaries, expected query patterns, freshness tolerance (ms/sec/min), and rebuild constraints. Guardrail: missing inputs produce generic advice. The prompt's eval harness checks for input completeness before accepting output.
Operational Risk: Stale Read Blindness
Risk: the prompt may underestimate the impact of eventual consistency on user experience if freshness requirements are vague. Guardrail: always specify the maximum acceptable staleness window and the business impact of stale reads. The eval checks flag designs without explicit consistency boundaries.
Operational Risk: Rebuild Feasibility Gaps
Risk: the prompt may propose a read model without validating that the event store retention window supports a full rebuild. Guardrail: provide event retention policies and rebuild time constraints. The harness checks for rebuild strategy completeness and flags missing retention data.
Variant: Existing Read Model Audit
Use when: reviewing an existing read model for synchronization gaps, performance degradation, or schema drift. Guardrail: provide current projection code, event stream metadata, and observed production issues. The prompt adapts to audit mode when given as-is state instead of greenfield requirements.
Copy-Ready Prompt Template
A copy-ready prompt for generating a structured CQRS read model design review, covering projection design, consistency windows, rebuild strategies, and query performance risks.
The following prompt template is designed to be pasted directly into your AI workspace. It instructs the model to act as a systems architect conducting a rigorous review of a CQRS read model design. The prompt is structured to produce a consistent, actionable output by focusing on the four critical areas of read model risk: projection logic, eventual consistency, rebuild feasibility, and query performance. Replace every square-bracket placeholder with the specific details of your system before execution.
textYou are a systems architect specializing in CQRS and event-driven architectures. Your task is to review a read model design for correctness, resilience, and performance. You will produce a structured review report. ## SYSTEM CONTEXT [SYSTEM_DESCRIPTION: A brief overview of the system and the bounded context this read model belongs to.] ## READ MODEL DEFINITION - **Name:** [READ_MODEL_NAME] - **Purpose:** [QUERY_USE_CASE: The specific query or UI view this model supports.] - **Source Events:** [LIST_OF_SOURCE_EVENTS: The domain events that trigger updates to this read model.] - **Projection Logic:** [PROJECTION_LOGIC_DESCRIPTION: How events are transformed into the read model state. Include aggregation, filtering, and joining logic.] - **Target Data Store:** [DATABASE_TYPE: e.g., PostgreSQL, Elasticsearch, Redis, DynamoDB] - **Target Schema:** [OUTPUT_SCHEMA: The final shape of the read model data, including fields and types.] ## CONSTRAINTS [CONSTRAINTS: Specific non-functional requirements like max query latency, data freshness SLA (e.g., < 5 seconds), and consistency guarantees.] ## OUTPUT FORMAT Generate a review report with the following sections: 1. **Projection Design Review:** Analyze the projection logic for correctness, idempotency, and handling of out-of-order events. Identify any missing state transitions. 2. **Eventual Consistency Assessment:** Quantify the expected consistency window. Identify scenarios where stale reads could cause user-facing errors or incorrect business logic. 3. **Rebuild Strategy Audit:** Evaluate the feasibility of a full historical rebuild. Identify missing event history, snapshot dependencies, and time-to-rebuild estimates. 4. **Query Performance Analysis:** Review the target schema and data store choice against the query use case. Flag potential performance bottlenecks like missing indexes, hot partitions, or N+1 query patterns. 5. **Risk Register:** A table of identified risks, each with a severity (High/Medium/Low), a description, and a recommended mitigation. ## EVALUATION CRITERIA A successful review will: - Explicitly state the assumptions made about event ordering and delivery guarantees. - Flag any projection logic that is not idempotent. - Provide a concrete, testable scenario for a stale read risk. - Identify if the rebuild strategy relies on event streams with a limited retention period.
To adapt this prompt, start by filling in the [SYSTEM_DESCRIPTION] and [READ_MODEL_NAME] to ground the model. The most critical placeholders are [PROJECTION_LOGIC_DESCRIPTION] and [CONSTRAINTS]. Be precise about the projection logic, as this is where subtle bugs like missed state transitions or non-idempotent operations hide. For constraints, specify a concrete data freshness SLA (e.g., 'read model must reflect state no more than 2 seconds behind the write model') to force a quantitative consistency assessment. After receiving the output, you should manually verify the identified stale read scenarios against your actual event flow latency to confirm the model's analysis is grounded in your production reality.
Prompt Variables
Each placeholder the CQRS Read Model Design Prompt needs to produce a reliable review. Validate inputs before calling the model to prevent garbage-in/garbage-out failures.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[AGGREGATE_NAME] | The domain aggregate whose read model is under review | Order, CustomerProfile, Shipment | Must be a single, non-empty string matching a known aggregate in the domain model. Reject if empty or contains multiple aggregates. |
[READ_MODEL_PURPOSE] | The specific query use case the read model serves | OrderHistoryDashboard, CustomerSearchIndex, PendingShipmentsView | Must be a non-empty string describing a concrete query scenario. Reject generic inputs like 'reporting' or 'analytics' without a specific consumer. |
[PROJECTION_SCHEMA] | The current or proposed schema for the read model | JSON Schema object or SQL DDL | Must be a valid schema definition. Parse and validate structure before passing. Reject if schema is empty or contains only placeholder fields. |
[EVENT_STREAM] | The list of domain events that feed this read model | OrderPlaced, OrderShipped, OrderDelivered | Must be a non-empty array of event type names. Validate that each event type exists in the event catalog. Reject if stream is empty or contains unknown event types. |
[CONSISTENCY_WINDOW_MS] | The maximum acceptable staleness in milliseconds | 5000, 30000, 60000 | Must be a positive integer. Reject zero or negative values. Flag values under 100ms for feasibility review. Null allowed if eventual consistency window is undefined. |
[REBUILD_STRATEGY] | The current approach for rebuilding the read model from the event store | Full replay from event store, Snapshot + incremental replay, CDC pipeline rebuild | Must be a non-empty string describing the rebuild mechanism. Validate against known strategy patterns. Reject if strategy is 'none' without explicit acknowledgment of rebuild gap. |
[QUERY_PATTERNS] | The expected query patterns against this read model | SELECT by customer_id with date range filter, Full-text search on product description, Aggregation by region and status | Must be a non-empty array of query descriptions. Each query should specify fields, filters, and aggregation. Reject if queries are missing filter criteria or return unbounded result sets. |
[CONSUMER_SLA_MS] | The latency SLA the read model consumer requires | 200, 500, 1000 | Must be a positive integer representing p95 or p99 latency target in milliseconds. Reject if SLA is stricter than consistency window. Null allowed if no SLA is defined. |
Implementation Harness Notes
How to wire the CQRS Read Model Design Prompt into an architecture review workflow with validation, retries, and human approval gates.
This prompt is designed to operate as a gated review step within a broader architecture workflow, not as a standalone chatbot interaction. The implementation harness should treat the prompt output as a structured artifact that requires validation before it enters your decision log. The core integration pattern is: collect the read model specification from the architect, assemble the prompt with the specification and any relevant event schema context, submit to the model, validate the output against the expected schema, and route the result to a human reviewer for final sign-off before filing it as an architecture decision record.
Validation and retry logic is critical because this prompt operates in a domain where stale reads and projection gaps can cause data corruption in production. Implement a schema validator that checks the output JSON for required fields: projection_risks, consistency_window_assessment, rebuild_feasibility, and query_performance_notes. If validation fails, retry once with the error message appended to the prompt context. If the retry also fails, escalate to a human reviewer with the partial output and validation errors logged. For model choice, prefer a model with strong reasoning capabilities and long context windows, as read model reviews often require reasoning across multiple event types and projection logic simultaneously. Claude 3.5 Sonnet or GPT-4o are suitable defaults; avoid smaller models that may drop structural fields under complex constraints.
Logging and observability should capture the full prompt, the raw model output, the validated output, and the human review decision. Store these in a review log that can be referenced during incident postmortems if a read model failure occurs in production. Include the model version, timestamp, and retry count in the log. For teams using RAG, you can augment the prompt with relevant event schema definitions and existing read model documentation retrieved from your architecture repository, but ensure the retrieved context is clearly separated from the architect's new specification to avoid conflation. The human approval gate is mandatory for any read model that serves customer-facing queries or financial reconciliation workflows; automated approval is acceptable only for internal operational read models with low staleness tolerance. The next step after approval is to file the validated review alongside the read model implementation plan and link both to the parent CQRS design document.
Expected Output Contract
Fields the model must return for a CQRS read model design review. Validate each field before accepting the output.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
read_model_name | string | Non-empty; matches [READ_MODEL_NAME] if provided; no markdown | |
projection_source_events | string[] | Array with >=1 element; each element references an event type from [EVENT_CATALOG] | |
projection_logic_summary | string | <=300 words; must describe how events fold into the read model state | |
eventual_consistency_window | string | Must specify a duration (e.g., '<500ms', '<2s'); null allowed only if justification provided in [CONSISTENCY_REQUIREMENTS] | |
stale_read_risk | string | One of: 'low', 'medium', 'high'; must align with consistency window and query pattern | |
rebuild_strategy | string | Must specify one of: 'full_replay', 'snapshot_and_replay', 'incremental_backfill'; include estimated rebuild time | |
query_patterns | object[] | Array with >=1 element; each object must contain 'query_name' (string), 'fields_accessed' (string[]), 'expected_latency' (string) | |
synchronization_gaps | object[] | If present, each object must contain 'gap_description' (string), 'impact' (string), 'mitigation' (string); empty array allowed |
Common Failure Modes
CQRS read models introduce specific failure patterns around staleness, synchronization, and rebuild complexity. These cards cover the most common production issues and how to prevent them before they reach users.
Stale Read Detection Gap
What to watch: Consumers read from a projection that is seconds or minutes behind the write model, but the system provides no staleness indicator. Users make decisions on outdated data without knowing it. Guardrail: Include a last_event_timestamp or version field in every read model response. Require clients to check freshness against a tolerance window before acting on critical data.
Projection Drift Without Monitoring
What to watch: The projection handler silently fails on a subset of events due to schema changes, poison messages, or handler bugs. The read model diverges from the write model over hours or days with no alert. Guardrail: Implement a reconciliation job that periodically compares read model checksums or record counts against the event store. Alert on any drift beyond a configured threshold.
Rebuild Time Exceeds Recovery Window
What to watch: A projection corruption requires a full rebuild from the event store, but the rebuild takes 12 hours while the business requires recovery in under 2 hours. The read model is unavailable for an unacceptable duration. Guardrail: Benchmark rebuild time against event store volume growth projections. Implement snapshot-based rebuilds or parallel partition rebuilding. Define and test a recovery time objective (RTO) before production deployment.
Missing Event Handler for New Event Type
What to watch: A new event type is added to the write model, but the read model projection has no handler registered. Events are silently skipped, and the read model never reflects the new data. Guardrail: Implement a catch-all handler that logs unknown event types and alerts the team. Require that every new event type includes a read model impact assessment in the schema evolution checklist.
Out-of-Order Event Processing Corruption
What to watch: Events arrive out of order due to partition rebalancing or network delays, and the projection applies them in the wrong sequence. Aggregate state becomes permanently corrupted with no easy repair path. Guardrail: Design projections to be order-tolerant where possible, or enforce strict ordering by aggregate ID. Include a sequence number in every event and reject or buffer out-of-sequence events with a clear error log.
Query Performance Degradation Under Load
What to watch: The read model is optimized for a specific query pattern, but production traffic shifts to unindexed fields or complex joins. Query latency spikes, and the read model becomes a bottleneck for the entire system. Guardrail: Define query performance SLIs and monitor them in production. Index the read model for the actual query patterns observed, not just the ones anticipated. Use load testing with production-shaped query distributions before launch.
Evaluation Rubric
Criteria for testing CQRS read model design output quality before integrating this prompt into your architecture review pipeline. Each row targets a specific failure mode common in projection design.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Projection Completeness | Output lists all required fields from the write model that the read model must serve, with explicit mapping | Missing fields that are required by at least one known query use case; fields present in write model but absent in projection without documented exclusion reason | Schema diff: compare projected fields against a golden set of required query fields for the target use case |
Eventual Consistency Window | Output specifies a maximum acceptable staleness in milliseconds or seconds with a clear justification tied to user experience requirements | No staleness bound provided; bound is stated as 'real-time' without acknowledging physics; bound is orders of magnitude wrong for the use case | Boundary test: check if stated bound is achievable given known event processing latency and consumer throughput limits |
Rebuild Strategy | Output describes a complete rebuild procedure including data source, estimated duration, and whether the read model is available during rebuild | Rebuild procedure assumes zero-downtime without blue-green or shadowing strategy; no duration estimate; source of truth not specified | Scenario test: simulate a schema change requiring full rebuild and verify the described steps are executable without data loss |
Query Performance Justification | Output identifies the primary query patterns and explains how the read model shape (denormalization, indexing, caching) supports them | Read model is a direct copy of the write model with no transformation; indexing strategy contradicts stated query patterns; performance claims lack latency targets | Load test: validate that the proposed read model shape can serve the top 3 query patterns within stated latency targets at expected throughput |
Stale Read Risk Identification | Output explicitly identifies which read operations may return stale data and under what conditions staleness exceeds the acceptable window | No mention of stale read scenarios; claims all reads are consistent without acknowledging CQRS physics; conflates read-model staleness with database replication lag | Fault injection: simulate a write that has not yet propagated to the read model and verify the output warns about this scenario |
Projection Synchronization Gap | Output describes how the projection detects and recovers from gaps, including monitoring for lag and a catch-up mechanism | No lag detection mentioned; assumes projections never fall behind; no backfill or catch-up procedure described | Drift test: artificially pause projection consumption for a known interval and verify the output's recovery procedure restores consistency within the stated window |
Write Model Coupling Assessment | Output identifies which write model changes would break the projection and recommends a versioning or schema registry strategy | Projection reads directly from write model tables without an event stream or abstraction; no mention of schema evolution impact on the read side | Change simulation: introduce a backward-incompatible write model change and verify the output flags the projection breakage risk |
Multi-Read-Model Consistency | Output addresses whether multiple read models must be consistent with each other and proposes a strategy if required | Assumes all read models are independent without checking cross-model consistency requirements; no mention of the trade-off between per-model optimization and cross-model consistency | Cross-model check: identify two read models that serve overlapping data and verify the output either documents their independence or proposes a consistency mechanism |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a frontier model (GPT-4o, Claude 3.5 Sonnet) and lightweight validation. Focus on getting a useful read model review quickly. Remove the eval harness and structured output schema initially—just ask for a narrative review. Replace [EVAL_CRITERIA] with a simple checklist of 3-5 must-have items.
Watch for
- The model may skip the eventual consistency window analysis entirely
- Projection rebuild strategy often gets vague without explicit prompting
- Query performance estimates will be hand-wavy without real data
- Missing concrete stale-read scenarios—the model defaults to generic "data might be stale" language

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us