handler

Creates idempotent domain and integration event handlers for TypeScript and Go backends.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Event-driven architectures need consistent, idempotent handlers that react to domain and integration events without duplicating side effects on retries. This Skill scaffolds and reviews event handlers across a polyglot backend (TypeScript daemon and Go gateway), enforcing the correct mediator registration, outbox patterns, and error-handling rules per language. ## Core Features & Use Cases - Dual-language dispatch: Routes to TypeScript or Go playbooks based on file extension, with per-language registries of mandatory patterns and bad practices. - Internal and external handlers: Covers same-context domain event handlers, cross-context integration event consumers, and named integration-event publishers via ExternalMediator. - Idempotency and error policy: Enforces existence checks or entity-level deduplication, outbox-based event chaining, and critical vs non-critical error handling rules. - Use Case: When a WhatsApp message arrives and a MessageReceived domain event fires, scaffold a handler that republishes it as an integration event, then a second handler in another context that reacts by creating a collaborator record idempotently. ## Quick Start Ask the agent to create an event handler for a specific domain event in a given context, for example: create a handler that sends a welcome email when the UserCreated event fires in the auth context.

Frequently Asked Questions about handler

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

FAQPage Schema
How do I create an event handler for a domain event?

Run the scaffolder with bun cli handler <context> <eventName>, then implement the handle method in a class extending EventHandler. Export internal handlers from handlers/internal.ts and register Go handlers via fx.Invoke in module.go.

What is the difference between internal and external event handlers?

Internal handlers react to domain events within the same bounded context and are exported from internal.ts or registered with InternalMediator. External handlers consume integration events from other contexts or services and use external.ts or ExternalMediator.

How do I make an event handler idempotent?

Check for existing records before creating state, or delegate deduplication to the entity method itself following Tell Don't Ask. Handlers can be delivered more than once by the outbox, so duplicate processing must be a safe no-op.

Should a handler publish integration events directly?

Only a named publisher per context may call ExternalMediator.publish in TypeScript, or a dedicated *IntegrationHandler per event in Go. All other handlers stay domain-pure and never publish integration events.

When should handler errors be swallowed versus returned?

Non-critical handlers like notifications or logging should log the error and return nil so the event chain is not blocked. Critical handlers affecting data consistency return the error so the outbox retries delivery.

When should I use a projector instead of an event handler?

Use a projector when the side effect updates a read model, since read-model writes belong to the read side with a canonical find-apply-save flow. Handlers must not upsert read models directly except for narrow cache-mirror cases.