event-go

Implements Go domain and integration events with transactional outbox delivery.

4|Updated Jul 30, 2026
One-click install
npx skills add https://github.com/gabriellst/codm --skill event-go-gabriellst
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: event-go
Source: https://github.com/gabriellst/codm/tree/main/.claude/skills/event/go
Command: npx skills add https://github.com/gabriellst/codm --skill event-go-gabriellst

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It standardizes how Go backend code defines, raises, and dispatches domain and integration events so bounded contexts stay decoupled and events are never lost outside a database transaction. ## Core Features & Use Cases - Domain Event Patterns: Defines events as generic type aliases over types.DomainEvent[T] with past-tense naming, primitive-only payloads, and constructors. - Transactional Outbox: Enforces raising events inside entity methods and draining them via domainEventRepo.SaveAll inside the same unit of work, never publishing directly from use cases. - Integration Events: Covers cross-service events published only from handlers via ExternalMediator, plus UnmarshalDomainEvent/UnmarshalIntegrationEvent helpers for handlers. - Use Case: When adding a transcoding.transcoding_job.started event to a Go service, follow the registry patterns to create the payload struct, type alias, constructor, entity raise, and repository drain without breaking the outbox contract. ## Quick Start Ask the agent to create a new Go domain event for an aggregate in a bounded context following the event-go patterns and checklist.

Frequently Asked Questions about event-go

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

FAQPage Schema
How do I create a domain event in Go with generics?

Define a payload struct with plain primitives and JSON tags, then declare a type alias like `type MyEvent = types.DomainEvent[MyPayload]` and a constructor calling `types.NewDomainEvent`. The alias automatically satisfies the DomainEventI interface.

What is the difference between domain events and integration events?

Domain events stay within one bounded context and are dispatched in-process via the outbox and InternalMediator. Integration events cross service boundaries and are published by handlers through ExternalMediator to transports like Redis Streams.

Why should use cases not publish events directly to a mediator?

Direct publishes bypass the transactional outbox, risking lost events if the database transaction rolls back. Instead, entities append events, the repository drains them via SaveAll inside the same unit of work, and the OutboxDispatcher delivers them.

Why must Go event types use a type alias instead of a new type?

A new type declared with `type X types.DomainEvent[P]` does not inherit the methods of DomainEvent[T], so it fails to satisfy DomainEventI. Using `=` creates an alias that keeps GetEventName and GetEntityID methods.

What fields are allowed in an event payload struct?

Payloads must use plain primitives such as string, uuid.UUID, int64, bool, and time.Time, each with a JSON tag. Domain entity pointers, value objects, and interface{} fields are prohibited because they break serialization.