domain-events

Publish domain events with save-before-publish and transactional outbox support.

1|1|Updated Mar 30, 2026
One-click install
npx skills add https://github.com/Entelligentsia/skillforge --skill domain-events-entelligentsia
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: domain-events
Source: https://github.com/Entelligentsia/skillforge/tree/main/design-patterns/skills/domain-events
Command: npx skills add https://github.com/Entelligentsia/skillforge --skill domain-events-entelligentsia

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Domain events enable decoupling of aggregates by publishing facts that other parts of the system react to, reducing tight coupling and enabling scalable, observable reactions across bounded contexts.

Core Features & Use Cases

  • Publish events after state changes to trigger reactions without altering core business logic.
  • Support synchronous and asynchronous handling, idempotent consumers, and reliability patterns like transactional outbox.
  • Use case: when Order or Inventory aggregates save, emit OrderSubmitted or InventoryAdjusted events to drive projections, notifications, and audits.

Quick Start

Create a DomainEvent class for a business fact and publish it after persisting the aggregate to trigger downstream handlers.

Frequently Asked Questions about domain-events

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

FAQPage Schema
How do I decouple domain logic with event-driven architecture in distributed systems?

Domain events decouple aggregates by publishing immutable facts about state changes, enabling reactive listeners across bounded contexts to handle side effects without tight coupling. This supports scalable, observable cross-aggregate reactions in both synchronous and asynchronous modes.

What is the transactional outbox pattern for reliable event publishing?

The transactional outbox pattern ensures save-before-publish reliability by persisting domain events within the same transaction as aggregate state changes, guaranteeing that events are durably stored before being dispatched to downstream consumers.

How do I implement idempotent event handlers for reactive systems?

Idempotent handlers process immutable domain event data safely by ensuring repeated event deliveries produce the same result as a single delivery, preventing duplicate side effects when consumers react to cross-aggregate reactions.

When should I use domain events in a domain-driven design architecture?

Domain events should be used in distributed domains with multiple aggregates, side effects, and cross-aggregate reactions, allowing bounded contexts to react to business facts like OrderSubmitted or InventoryAdjusted without altering core business logic.

Can I publish domain events asynchronously or do they need to be synchronous?

Domain events support both synchronous and asynchronous handling modes, allowing you to choose immediate in-process reactions or deferred message-driven processing depending on your distributed system's scalability and reliability requirements.

What is the best way to trigger side effects after an aggregate saves without modifying core business logic?

Publishing domain events after persisting aggregate state changes triggers downstream reactions for projections, notifications, and audits without altering core business logic, keeping bounded contexts loosely coupled and maintainable.