build-state-view

Implements Wolverine.Http and Marten state-view slices with query endpoints and projectors from slice.json definitions.

1|1|Updated Jul 19, 2026
One-click install
npx skills add https://github.com/Powerworks/K9DatingApp --skill build-state-view-powerworks
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: build-state-view
Source: https://github.com/Powerworks/K9DatingApp/tree/main/.claude/skills/build-state-view
Command: npx skills add https://github.com/Powerworks/K9DatingApp --skill build-state-view-powerworks

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building read-model slices in an event-modeled .NET modular monolith requires coordinating query endpoints, projectors, Marten schema registration, and integration event wiring, where small mistakes (missing SaveChangesAsync, wrong class naming, unbound queues) silently fail without errors. ## Core Features & Use Cases - Query Endpoint Generation: Creates [WolverineGet] handlers for single-document and filtered collection reads against Marten documents. - Projector Implementation: Builds event-driven projectors for same-module domain events or cross-module RabbitMQ integration events, with explicit SaveChangesAsync and upsert semantics. - Test-First Workflow: Writes Testcontainers-based Layer 3 integration tests for projectors before implementation, plus direct query handler tests. - Use Case: Given a slice.json defining a discovery feed read model fed by a DogProfileCreated event from another module, generate the read-model document, projector, query handler, Marten schema registration, and passing tests in one guided flow. ## Quick Start Ask the AI to build the state-view slice defined in build-kit-dotnet/.slices for your chosen slice name, running load-slice first if the definition may be stale.

Frequently Asked Questions about build-state-view

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

FAQPage Schema
How do I build a state-view slice with Wolverine and Marten?▼

Read the slice.json definition first, then decide whether a projector is needed. Create a [WolverineGet] query handler reading via IQuerySession, and if the read model aggregates events, add a projector class ending in Handler that stores the read-model document with an explicit SaveChangesAsync call.

When does a state-view slice need a projector?▼

A projector is needed when the read model reshapes or aggregates data from events rather than reading a document a command slice already stores. If the query reads an existing document directly via LoadAsync, only the query half is required.

Why is my Wolverine projector handler never invoked?▼

Wolverine discovers handlers by class name, so the class must end in Handler even if the file is named Projector. A class named Projector with a correct Handle method is silently never invoked, with the envelope marked Handled but nothing processed.

Why does my Marten projector write no rows without errors?▼

IDocumentSession.Store only stages changes in-session and does not auto-flush. The projector must call SaveChangesAsync explicitly, otherwise it runs successfully with no exception and silently writes nothing.

How do I consume a cross-module integration event in a Marten module?▼

Set IntegrationEventQueueName on the consuming module's module class so the host binds a queue to the k9crush.events exchange. Without it, the published integration event has nothing bound to receive it and is silently dropped.

Do Marten read models need SQL migration files?▼

No. Register the read model in the module's IMartenModuleConfiguration.Configure via options.Schema.For<T>() with indexes on filtered fields, and Marten manages the DDL automatically with AutoCreate schema objects.