go-domain-events

Design Go domain events with an event bus and outbox-based publishing.

Updated Apr 20, 2026
One-click install
npx skills add https://github.com/vincent119/ai-rules-kit --skill go-domain-events
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-domain-events
Source: https://github.com/vincent119/ai-rules-kit/tree/main/skills/go-domain-events
Command: npx skills add https://github.com/vincent119/ai-rules-kit --skill go-domain-events

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go Domain Events provides a structured approach to defining and publishing domain events in Go, enabling decoupled business logic, reliable messaging, and observable workflows.

Core Features & Use Cases

  • Domain Event definitions with a BaseEvent and concrete events (e.g. UserCreated, OrderPlaced).
  • In-memory Event Bus for multi-handler subscriptions and synchronous publishing.
  • Outbox pattern to persist events within a transaction for reliable delivery.
  • Idempotency guarantees with processed events tracking to avoid duplicate handling.
  • Event Sourcing basics with an append-only event store and replay capability.

Quick Start

Initialize domain events in a Go project and implement an outbox-based, idempotent event publishing flow.

Frequently Asked Questions about go-domain-events

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

FAQPage Schema
How do I implement idempotent domain events in Go microservices?

Implement idempotent domain events in Go by defining structured event models, tracking processed events, and using an outbox pattern to persist events within a transaction for reliable, duplicate-free delivery.

What is the outbox pattern for event publishing in Go?

The outbox pattern for event publishing persists domain events within the same database transaction as business state changes, ensuring reliable delivery and preventing event loss in Go applications.

How do I set up event sourcing basics in a Go project?

Set up event sourcing basics in a Go project by using an append-only event store to save domain events and implementing replay capabilities to reconstruct state from the event history.

Can I use an in-memory event bus for synchronous event publishing in Go?

Yes, you can use an in-memory event bus in Go for multi-handler subscriptions and synchronous event publishing, allowing decoupled business logic to react to domain events efficiently.

How does Go domain events handle idempotency and duplicate event processing?

Go domain events handle idempotency by tracking processed events, ensuring that duplicate event handlers do not reprocess the same event, maintaining data consistency across workflows.

When should I use domain events for decoupled microservices in Go?

Use domain events for decoupled microservices, scheduled tasks, and asynchronous workflows in Go when you need to isolate business logic, ensure reliable messaging, and achieve observable event-driven operations.