add-event-handler

Implement event publishers and consumers following schema contracts, idempotency rules, and delivery semantics.

Updated Feb 10, 2026
One-click install
npx skills add https://github.com/vesviet/agent-skills --skill add-event-handler-vesviet
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: add-event-handler
Source: https://github.com/vesviet/agent-skills/tree/main/core/skills/backend/add-event-handler
Command: npx skills add https://github.com/vesviet/agent-skills --skill add-event-handler-vesviet

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Event-driven changes often break consumers through incompatible payloads, duplicate side effects from retries, and dual-write inconsistencies between databases and message brokers. This Skill guides the safe addition or modification of event publishers, consumers, and subscriber flows while enforcing the repo's event contract. ## Core Features & Use Cases - Contract-First Event Changes: Register schemas in the event schema registry (Avro, Protobuf, or JSON Schema) before publishing, prefer additive evolution, and use CloudEvents 1.0 envelopes when no repo convention exists. - Idempotency and Delivery Guarantees: Enforce exactly-once consumer semantics via idempotency keys in Redis or Postgres, route failures to dead-letter queues, and document retry and ordering behavior. - Transactional Outbox Pattern: Prevent dual-write inconsistency by writing events to an outbox table in the same database transaction and dispatching asynchronously with SELECT ... FOR UPDATE SKIP LOCKED workers. - Use Case: When adding a new order-created consumer to a Kafka-based service, use this Skill to validate the payload schema, add idempotent handling, wire a DLQ, and cover duplicate-delivery paths with tests. ## Quick Start Use the add-event-handler skill to add a consumer for the order-created event with idempotent handling and a dead-letter queue.

Frequently Asked Questions about add-event-handler

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

FAQPage Schema
How do I add an event consumer without breaking existing subscribers?▼

Prefer additive schema evolution so existing consumers keep working, and register any new schema in the event schema registry before publishing. Validate AI-generated payloads against the repo's event contract, since LLMs often produce type-incompatible field names.

How do I make an event consumer idempotent?▼

Make idempotency explicit using the event id field rather than a content hash, and store idempotency keys in a transactional store like Redis or Postgres with TTL-based deduplication. This protects against retry floods producing duplicate side effects.

What is the Transactional Outbox pattern and when should I use it?▼

The Transactional Outbox pattern writes the event payload to an outbox table in the same local database transaction as the state change, then dispatches asynchronously. Use it whenever a service must persist records and publish to a broker like Kafka or RabbitMQ, avoiding network I/O inside database transactions.

Does this approach work with Kafka, RabbitMQ, and Dapr?▼

Yes, the guidance covers external brokers including Kafka, RabbitMQ, and Dapr, with CloudEvents 1.0 as the standard wire format when no repo-level convention exists. Schema registration supports Avro, Protobuf, or JSON Schema.

Why do event handlers fail silently and how do I detect it?▼

Handlers fail silently when no dead-letter queue is bound or when consumer lag goes unmonitored. Require a DLQ binding on every handler, wire a consumer-lag alert at the 80th percentile, and instrument OpenTelemetry spans on publish and consume operations.