/trogonstack-eventmodeling:eventmodeling-identifying-outputsfrom trogonstack-eventmodeling
Guides through Step 5 of Event Modeling: identifying outputs/read models from events, including query patterns and avoiding calculation-as-event anti-pattern.
Ships in trogonstack-eventmodeling. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
When to Interview: Skip if the user has clearly identified: read model queries needed by UI, processor needs, and refresh patterns. Interview when unclear which data queries are critical or how frequently they're accessed.
Interview Strategy: Establish query patterns and identify any calculations before designing read models. The most common architecture error at this step is modeling recalculated state as an event — identifying calculated fields upfront prevents that anti-pattern.
Query Patterns (Impact: Determines which read models are needed and their update frequency)
Event vs Read Model Clarification (Impact: Ensures we don't model calculations as events)
Conditional Entry:
If user has provided:
- UI screens with data needs mapped to event sources
- AND processor query needs documented
- AND calculated/aggregated fields identified as read models (not events)
Then: Skip interview, proceed directly to read model design
Else: Conduct interview
Phase 1: Query Pattern Mapping (Question 1)
Phase 2: Calculation Detection (Question 2)
Append findings to the project's event modeling file:
File: .trogonai/interviews/[project-name]/EVENTMODELING.md
Use Write tool to add/update this section:
## 5. Identifying Outputs (eventmodeling-identifying-outputs)
### Query Patterns
[From Q1: Which consumers need what freshness? Real-time vs. periodic?]
### Calculated Fields Identified
[From Q2: Which fields are aggregated/calculated? Confirmed as read models?]
### Read Model Summary
- Real-time read models: [list]
- Near-real-time read models: [list]
- Calculation-as-event anti-patterns caught: [list or "None"]
Update Interview Trail:
| 5 | eventmodeling-identifying-outputs | Done | Read model catalog, query patterns, calculation classification |
This is the most important distinction in event sourcing. Many architectures fail because this line gets blurred.
Things that actually happened in the domain. Once created, they never change:
Characteristics:
Optimized views calculated FROM events. They recalculate multiple times:
Characteristics:
Ask these questions in order:
| Question | Answer | Type | Example |
|---|---|---|---|
| Did an actor perform an action? | YES | EVENT | Customer confirmed the order |
| Is this pure calculation? | YES | READ MODEL | Inventory level total |
| Is it immutable once created? | YES | EVENT | PaymentAuthorized |
| Does it recalculate multiple times? | YES | READ MODEL | Total sales (updates as orders change) |
| Is it independent (causes no other events)? | YES | EVENT | OrderFlagged (flagged for manual review) |
| Is it derived FROM other events? | YES | READ MODEL | OrderStatus (derived from multiple events) |
DON'T model these as EVENTS:
DO model them as READ MODELS:
WRONG: Modeling as Event
InventoryLevelRecalculated
productId: product-456
currentStock: 84 (This recalculates!)
reservedStock: 12 (Derived, not a fact)
CORRECT: Model as Read Model
InventoryLevelView
productId: product-456
totalReceived: 200
totalSold: 116
currentStock: 84
lastUpdated: 2025-01-24T10:30:00Z
history:
- 2024-12-01: stock 150 (200 received)
- 2024-12-15: stock 110 (40 sold)
- 2025-01-24: stock 84 (26 sold)
WHY:
Given commands and events, identify all outputs:
For each screen, identify source events:
Screen: Order Status View
Displays data from events:
orderId ← OrderCreated event
customerId ← OrderCreated event
items ← OrderCreated event
total ← OrderCreated event
status ← OrderConfirmed event (or OrderCancelled)
confirmedAt ← OrderConfirmed event
paymentId ← PaymentAuthorized event
shipmentId ← OrderShipped event
shippedAt ← OrderShipped event
This screen is a projection of these events:
- OrderCreated
- OrderConfirmed
- PaymentAuthorized
- OrderShipped
Create optimized views from event data:
ReadModel: OrderStatusView
Purpose: UI displays current order status
Events subscribed: OrderCreated, OrderConfirmed, PaymentAuthorized, OrderShipped, OrderCancelled
Data:
{
orderId: string (from OrderCreated)
customerId: string (from OrderCreated)
status: enum (from events: Draft → Confirmed → Authorized → Shipped → Delivered)
createdAt: Date (from OrderCreated)
confirmedAt: Date (from OrderConfirmed)
paymentId: string (from PaymentAuthorized)
shipmentId: string (from OrderShipped)
shippedAt: Date (from OrderShipped)
}
Show exactly what data each event provides:
Event: OrderCreated
Provides to UI/Processors:
orderId
customerId
items[]
total
shippingAddress
createdAt
Event: OrderConfirmed
Provides to UI/Processors:
orderId (link to stream)
paymentMethod (user selected method)
confirmedAt (timestamp)
paymentId (payment system reference)
Event: PaymentAuthorized
Provides to UI/Processors:
orderId (link to stream)
paymentId
authCode
authorizedAt (timestamp)
amount (verified amount)
Event: OrderShipped
Provides to UI/Processors:
orderId (link to stream)
shipmentId
shippedAt (timestamp)
carrier (shipping company)
trackingNumber (for delivery tracking)
List all read models:
ReadModel Catalog: Order System
1. OrderStatusReadModel
Purpose: UI shows current order status
Events: OrderCreated, OrderConfirmed, PaymentAuthorized, OrderShipped, OrderCancelled
Data: orderId, status, createdAt, confirmedAt, paymentId, shipmentId
Consumed by:
- Order Status screen (UI)
- Customer Dashboard (UI)
- Order Processing Processor (decides if can ship)
2. OrderListReadModel
Purpose: UI lists all orders for a customer
Events: OrderCreated, OrderConfirmed, OrderCancelled
Data: orderId, customerId, total, status, createdAt
Consumed by:
- Customer Order History (UI)
- Order Search/Filter (UI)
3. PaymentStatusReadModel
Purpose: UI shows payment status
Events: OrderConfirmed, PaymentAuthorized, PaymentFailed
Data: orderId, paymentId, status, authCode, failureReason, timestamp
Consumed by:
- Payment Status screen (UI)
- Accounting Processor (reconciliation)
4. ShipmentTrackingReadModel
Purpose: UI shows tracking information
Events: OrderShipped, DeliveryConfirmed
Data: orderId, shipmentId, trackingNumber, carrier, shippedAt, estimatedDelivery
Consumed by:
- Order Tracking screen (UI)
- Customer notifications (Processor)
Check if all UI needs are covered:
Question: What if UI needs "estimated delivery date"?
Event: OrderShipped has carrier + trackingNumber
Action needed: Add estimatedDelivery to OrderShipped event
(or compute from carrier info)
Question: What if UI needs to show "payment method" on status?
Event: OrderConfirmed has paymentMethod
Action needed: Include paymentMethod in relevant read models
Question: What if UI needs "item descriptions"?
Event: OrderCreated has items[]
But: items[] only has productId
Action needed: Enrich with product descriptions from catalog
(via join with product service)
Identify what processors consume:
Processor: Inventory System
Consumes from read models:
- Orders in "PaymentAuthorized" status
- Items and quantities needed
Produces commands:
- ReserveInventory
Processor: Fulfillment System
Consumes from read models:
- Orders in "InventoryReserved" status
- Items and quantities
- Shipping address
Produces commands:
- CreateShipment
Processor: Notification System
Consumes from read models:
- OrderCreated (sends confirmation)
- OrderConfirmed (sends receipt)
- OrderShipped (sends tracking)
- DeliveryConfirmed (sends thank you)
Does not produce commands (info-only)
Present as:
# Outputs: [Domain Name]
## Read Models Summary
| ReadModel | Purpose | Events | Consumed By |
|-----------|---------|--------|-------------|
| OrderStatus | Show order state | OrderCreated, OrderConfirmed | UI, Processor |
| OrderList | List orders | OrderCreated, OrderCancelled | UI |
| PaymentStatus | Payment info | OrderConfirmed, PaymentAuthorized | UI, Accounting |
| Shipment Tracking | Track delivery | OrderShipped, DeliveryConfirmed | UI, Notifications |
---
## Detailed Read Models
### ReadModel: OrderStatusView
**Purpose**: Order Status screen displays current order state
**Events subscribed**:
- OrderCreated
- OrderConfirmed
- PaymentAuthorized
- OrderShipped
- OrderCancelled
- DeliveryConfirmed
**Data**:
{ orderId: string customerId: string status: 'Draft' | 'Confirmed' | 'Authorized' | 'Shipped' | 'Delivered' | 'Cancelled' items: Array<{productId, quantity, unitPrice}> total: number shippingAddress: Address
createdAt: Date confirmedAt: Date paymentId: string paymentMethod: 'card' | 'transfer' authorizedAt: Date
shipmentId: string carrier: string trackingNumber: string shippedAt: Date estimatedDelivery: Date }
**Update Logic**:
- OrderCreated: Insert with status='Draft'
- OrderConfirmed: Update status='Confirmed'
- PaymentAuthorized: Update status='Authorized', set paymentId
- OrderShipped: Update status='Shipped', set shipmentId, carrier, trackingNumber
- DeliveryConfirmed: Update status='Delivered'
- OrderCancelled: Update status='Cancelled'
**Consumed By**:
- Order Status Screen (displays)
- Order Processing Processor (checks status)
- Notification System (sends updates)
--- [Repeat for each read model]
---
## Data Completeness Check
### Events → UI Needs
Verify all UI needs have event sources:
| UI Need | Event Source | Status |
|---------|-------------|--------|
| Order status | OrderConfirmed, OrderShipped | |
| Tracking number | OrderShipped | |
| Order items | OrderCreated | |
| Estimated delivery | OrderShipped | |
| Cancellation reason | OrderCancelled | |
### Missing Data
Identify UI needs without event sources:
- None identified
---
## Processor Consumption
### Processors and their reads:
| Processor | Reads From | Writes Commands |
|-----------|-----------|-----------------|
| Inventory | OrderStatusView (Authorized) | ReserveInventory |
| Fulfillment | OrderStatusView (InventoryReserved) | CreateShipment |
| Notification | OrderStatusView (all) | None (info-only) |
| Accounting | PaymentStatusView | None (reporting) |
history[], not as separate eventsEvents: Create, Confirm, Process, Ship
ReadModel: Accumulates data from all events
Displayed: Current state reflecting all events
Events: Create, Update, Delete (Cancel)
ReadModel: Summary of each item
Used for: Filtering, sorting, searching
Events: Any event with timestamp
ReadModel: Chronological list
Used for: History, audit trail
Events: State-changing events
ReadModel: Current state only
Processor reads to decide next action
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
event-modeling, read-models, query-patterns, cqrs, projections, architecture
npx claudepluginhub trogonstack/agentskills --plugin trogonstack-eventmodeling16 skills in this plugin
/eventmodeling-applying-conways-lawStep 6 of Event Modeling - Apply Conway's Law with swimlanes. Organize events into autonomous system parts that different teams can independently own. Use after defining inputs/outputs. Do not use for: planning feature slice implementation order (use eventmodeling-slicing-event-models) or defining command/read model boundaries (use eventmodeling-designing-event-models)./eventmodeling-brainstorming-eventsStep 1 of Event Modeling - Brainstorm all domain events from requirements. Extract every state-changing event the system could have. Use when starting event modeling from requirements or a new domain. Do not use for: arranging events in sequence (use eventmodeling-plotting-events), designing commands or read models (use eventmodeling-designing-event-models), or when a complete event list already exists./eventmodeling-checking-completenessStep 8 of Event Modeling - Completeness Check. Verify every field has origin and destination. Ensure complete event model before code generation. Use after all scenarios defined. Do not use for: architectural validation against event sourcing principles (use eventmodeling-validating-event-models) or elaborating Given-When-Then specs (use eventmodeling-elaborating-scenarios)./eventmodeling-designing-event-modelsDesigns event-sourced domain models. Maps business processes to immutable events and state projections. Events are the source of truth; state is derived from events for command validation. Use when designing event streaming architectures from domain analysis. Do not use for: brainstorming events from scratch (use eventmodeling-brainstorming-events), optimizing stream sizing or snapshotting (use eventmodeling-optimizing-stream-design), or translating external system events (use eventmodeling-translating-external-events)./eventmodeling-elaborating-scenariosStep 7 of Event Modeling - Elaborate scenarios using Given-When-Then format. Specify behavior of commands and views. Each spec tied to exactly one command or view. Use after defining systems and boundaries. Do not use for: architectural validation (use eventmodeling-validating-event-models) or verifying field completeness across the model (use eventmodeling-checking-completeness)./eventmodeling-identifying-inputsStep 4 of Event Modeling - Identify Commands/Inputs from UI and Processor actions. Map user actions to commands and data. Use after storyboarding UI. Do not use for: identifying read models or outputs (use eventmodeling-identifying-outputs) or elaborating behavior specifications (use eventmodeling-elaborating-scenarios).Other plugins' skills for the same job