create-domain-event

Scaffolds cross-bounded-context IMessage event records and IMessageHandler classes with DI registration.

Updated Nov 19, 2020
One-click install
npx skills add https://github.com/kwojtasinski-repo/ECommerceApp --skill create-domain-event-kwojtasinski-repo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-domain-event
Source: https://github.com/kwojtasinski-repo/ECommerceApp/tree/main/.github/skills/create-domain-event
Command: npx skills add https://github.com/kwojtasinski-repo/ECommerceApp --skill create-domain-event-kwojtasinski-repo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Manually creating cross-bounded-context domain events in a modular .NET application requires remembering exact folder conventions, namespace rules, interface contracts, and DI registration patterns, which is error-prone and repetitive. ## Core Features & Use Cases - Three generation modes: Create an event-only IMessage record, a handler-only IMessageHandler with DI registration, or both together. - Convention enforcement: Generates public event records in the publisher BC's Messages folder and internal sealed handlers in the consumer BC's Handlers folder, with namespaces matching the folder structure. - Nested record support: Provides a pattern for complex event payloads using nested records. - Use Case: When the Orders BC must notify the Inventory BC that an order was placed, generate an OrderPlaced IMessage record in Orders and an OrderPlacedHandler in Inventory with a single request. ## Quick Start Ask the assistant to create a domain event named OrderPlaced in both mode for the Orders bounded context.

Frequently Asked Questions about create-domain-event

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

FAQPage Schema
How do I create a cross-bounded-context domain event in .NET?

Define a public record implementing IMessage in the publishing bounded context's Messages folder, then publish it via ModuleClient.PublishAsync. Consumers implement an internal sealed IMessageHandler<T> registered as scoped in DI.

What is the difference between a cross-BC message and a domain-level event?

A cross-BC message implements IMessage and lives in the Application layer's Messages folder for routing between bounded contexts. A domain-level event is a plain record in the Domain layer's Events folder, used only internally within one BC.

Can one message have multiple handlers with IMessageHandler?

No. ModuleClient resolves handlers with GetService (singular), so only one handler per message type is supported. Register a single IMessageHandler<T> implementation per event.

What happens if an event has no registered handler?

Nothing breaks. ModuleClient logs a warning when no handler is found for a published message but does not throw or crash, so events can be published before consumers exist.

Should event records use typed IDs or primitive values?

Name properties using the aggregate's typed ID concept (e.g., OrderId) for clarity, but pass the underlying .Value primitive (int) in the record to keep the cross-assembly message contract simple.