build-state-change

Implements Wolverine.Http and Marten state-change slices from slice.json definitions.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Turning an event-modeling board's state-change slice into working .NET code involves many conventions (handler naming, validation placement, storage strategy, test layering) that are easy to get wrong. This Skill codifies those conventions so a Wolverine.Http + Marten command slice is implemented correctly and consistently from its slice.json definition. ## Core Features & Use Cases - Slice-driven codegen: Reads slice.json (commands, events, specifications, comments) as the single source of truth and generates request/response records, a handler, and tests without inventing fields. - Dual storage strategies: Chooses between Marten document-store (IDocumentSession.Store/LoadAsync) and event-sourced (session.Events.Append with live-computed state) patterns per module, following ADR-019. - Test-first layering: Produces Layer 1 domain tests, Layer 2 mocked handler tests (xUnit, FluentAssertions, NSubstitute), and Layer 3 Testcontainers integration tests when session.Query<T>() is used. - Use Case: Given a new "EditApplicationDetails" slice on the eventmodelers.ai board, run this Skill to generate the request record with DataAnnotations validation, the <SliceName>Handler with authorization and ownership checks, Marten schema registration, and the matching test suite. ## Quick Start Ask the AI to build the state-change slice for a given slice name, after running the load-slice skill so its slice.json is fresh.

Frequently Asked Questions about build-state-change

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

FAQPage Schema
How do I implement a state-change slice with Wolverine.Http and Marten?▼

Read the slice.json definition first, then create request/response records with DataAnnotations validation and a static handler class named <SliceName>Handler with a Handle method. Choose document-store or event-sourced persistence based on the module, and write tests before the handler logic.

When should I use event-sourced vs document-store in Marten?▼

Use document-store (IDocumentSession.Store/LoadAsync) by default for new modules. Choose event-sourced (session.Events.Append) only when the slice's specifications genuinely require replaying prior events to decide, such as detecting whether a pair has already matched.

Why is my Wolverine handler not being discovered?▼

Wolverine's convention-based discovery only recognizes a Handle method if the containing class name ends in Handler. A correctly implemented Handle method in a class named anything else is silently never registered.

Why does FluentValidation not run on Wolverine.Http endpoints?▼

WolverinePost and WolverineGet endpoints bypass Wolverine's message-bus validation pipeline entirely, so AbstractValidator classes never execute. Put validation on the request record itself using DataAnnotations attributes or IValidatableObject.

Can NSubstitute mock Marten session.Query for handler tests?▼

No, Marten's IMartenQueryable returned by session.Query<T>() cannot be meaningfully mocked by NSubstitute. Handlers that query need a Layer 3 Testcontainers integration test against a real PostgreSQL container instead.