domain-event-conventions

Define and enforce domain event naming and structuring conventions for CritterCab services.

Updated Apr 21, 2026
One-click install
npx skills add https://github.com/erikshafer/CritterCab --skill domain-event-conventions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: domain-event-conventions
Source: https://github.com/erikshafer/CritterCab/tree/main/docs/skills/domain-event-conventions
Command: npx skills add https://github.com/erikshafer/CritterCab --skill domain-event-conventions

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides guidelines for naming, file placement, and structuring domain events in CritterCab services, ensuring consistency and clarity in event design.

Core Features & Use Cases

  • Event Naming: Follows past-tense verb + noun naming convention, avoiding 'Event' suffix.
  • File Placement: Organizes events alongside commands and handlers, in feature-based directories.
  • Type Shape: Defines a canonical shape for domain events, using sealed records and value objects.
  • Aggregate ID Naming: Uses {AggregateTypeName}Id for ID fields, ensuring clarity.
  • Integration Events: Differentiates between slim domain events and rich integration events.
  • Marten Registration: Ensures all events are registered in Marten event streams.
  • Naming Collisions: Provides guidance for handling naming collisions between domain and integration events.
  • Enum Types: Defines enum types within the service's own namespace, avoiding cross-service sharing.

Quick Start

Implement a new domain event in your CritterCab service by following the naming and structuring conventions outlined in this Skill.

Frequently Asked Questions about domain-event-conventions

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

FAQPage Schema
How do I name domain events for event sourcing in Marten?

Domain events are named using past-tense verbs combined with nouns, avoiding the 'Event' suffix entirely. This convention ensures clarity and consistency when registering events in Marten event streams for event sourcing.

What is the canonical type shape for a domain event?

The canonical type shape for a domain event uses sealed records and value objects. Aggregate ID fields must follow the {AggregateTypeName}Id naming convention to ensure clarity and enforce structural consistency across the service.

How do I handle naming collisions between domain and integration events?

Naming collisions between domain and integration events are handled by differentiating their structures: domain events remain slim, while integration events are rich. This distinction prevents conflicts and maintains clear boundaries between internal and external event contracts.

Where should I place domain event files in a feature-based directory structure?

Domain event files should be placed alongside commands and handlers within feature-based directories. This organizational convention groups related logic together, improving discoverability and maintaining consistency across service development.

Can I share enum types across services when defining domain events?

Enum types must be defined within the service's own namespace and should not be shared across services. This isolation prevents cross-service coupling and ensures that each service maintains control over its own domain event definitions.

Do I need to register all domain events in Marten event streams?

All domain events must be registered in Marten event streams to ensure they are properly tracked and stored. This registration step is required for the event sourcing mechanism to function correctly within the service.