emitting-api-events
Build event-driven APIs with webhooks, Server-Sent Events, and real-time notifications. Use when building event-driven API architectures. Trigger with phrases like "add webhooks", "implement events", or "create event-driven API".
Install
mkdir -p .claude/skills/emitting-api-events && curl -L -o skill.zip "https://mcp.directory/api/skills/download/3841" && unzip -o skill.zip -d .claude/skills/emitting-api-events && rm skill.zipInstalls to .claude/skills/emitting-api-events
About this skill
Emitting API Events
Overview
Build event-driven API architectures using outbound webhooks, Server-Sent Events (SSE), and message broker integration. Implement event emission from API mutations, event schema registry, subscriber management, delivery guarantees with retry logic, and event sourcing patterns for maintaining a complete audit log of API state changes.
Prerequisites
- Message broker: Redis Pub/Sub, RabbitMQ, Apache Kafka, or AWS SNS/SQS
- Persistent storage for event log and subscriber registrations (PostgreSQL, MongoDB)
- Webhook delivery infrastructure with retry queue (Bull, Celery, or managed service)
- Event schema registry for versioned event type definitions
- SSE-capable web framework for real-time event streaming to browser clients
Instructions
- Identify event-producing operations using Grep and Read, cataloging every API mutation (POST, PUT, PATCH, DELETE) that should emit events, with event type names following
resource.actionconvention (e.g.,order.created,user.updated). - Define event schemas for each event type with versioning: include
eventId(UUID),eventType,version,timestamp(ISO 8601),source(service identifier), anddata(type-specific payload). - Implement the event emitter service that publishes events to the message broker after successful API mutations, using the transactional outbox pattern to ensure events are not lost on application crash.
- Build a webhook subscription management API:
POST /webhooks(subscribe),GET /webhooks(list),DELETE /webhooks/:id(unsubscribe), with URL validation, event type filtering, and signing secret generation. - Implement webhook delivery with HMAC-SHA256 signed payloads, configurable retry policy (exponential backoff: 1min, 5min, 30min, 2hr, 24hr), and automatic subscription deactivation after consecutive failures.
- Add Server-Sent Events endpoint (
GET /events/stream) for real-time event delivery to browser clients, withLast-Event-IDsupport for reconnection and missed event replay. - Create a dead-letter queue for events that exhaust all delivery retry attempts, with alerting and manual replay capability.
- Write integration tests covering event emission, webhook delivery with signature verification, SSE stream connection with reconnection, and dead-letter queue behavior.
See ${CLAUDE_SKILL_DIR}/references/implementation.md for the full implementation guide.
Output
${CLAUDE_SKILL_DIR}/src/events/emitter.js- Event emission service with outbox pattern${CLAUDE_SKILL_DIR}/src/events/schemas/- Versioned event type schema definitions${CLAUDE_SKILL_DIR}/src/events/webhooks/- Webhook delivery, signing, and retry logic${CLAUDE_SKILL_DIR}/src/events/sse.js- Server-Sent Events streaming endpoint${CLAUDE_SKILL_DIR}/src/routes/webhooks.js- Webhook subscription management API${CLAUDE_SKILL_DIR}/src/events/dead-letter.js- Dead-letter queue handler with replay${CLAUDE_SKILL_DIR}/tests/events/- Event emission and delivery integration tests
Error Handling
| Error | Cause | Solution |
|---|---|---|
| Event lost on crash | Application crashes between database commit and event publish | Use transactional outbox pattern: write event to outbox table in same transaction, poll and publish separately |
| Webhook delivery failure | Subscriber endpoint unreachable or returns non-2xx | Retry with exponential backoff; deactivate subscription after 5 consecutive failures; notify subscriber admin |
| Event ordering violation | Concurrent mutations publish events out of order | Use partition keys (resource ID) for ordered delivery within a partition; accept out-of-order across partitions |
| SSE connection memory leak | Server accumulates stale SSE connections without cleanup | Implement heartbeat comments (:keepalive\n\n) every 15 seconds; detect and close dead connections |
| Schema version mismatch | Consumer expects v1 event format but receives v2 | Include version field in event envelope; support simultaneous v1/v2 delivery; deprecate old versions with notice |
Refer to ${CLAUDE_SKILL_DIR}/references/errors.md for comprehensive error patterns.
Examples
Order lifecycle events: Emit order.created, order.payment_received, order.shipped, and order.delivered events with order details, enabling downstream services (warehouse, email, analytics) to react asynchronously.
SSE live notifications: Browser client connects to GET /events/stream?types=message.received,order.updated and receives real-time event updates with automatic reconnection and Last-Event-ID replay on network interruption.
Transactional outbox: Write the event record to an outbox table within the same database transaction as the API mutation, then poll the outbox table every 100ms to publish events to Kafka, ensuring at-least-once delivery.
See ${CLAUDE_SKILL_DIR}/references/examples.md for additional examples.
Resources
- CloudEvents specification: https://cloudevents.io/
- Server-Sent Events (MDN): https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events
- Transactional outbox pattern: Microservices.io
- Webhook best practices: Standard Webhooks specification
More by jeremylongshore
View all skills by jeremylongshore →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversEmpower your CLI agents with NotebookLM—connect AI tools for citation-backed answers from your docs, grounded in your ow
Unlock powerful text to speech and AI voice generator tools with ElevenLabs. Create, clone, and customize speech easily.
Integrate TomTom's APIs for advanced location-aware apps with maps, routing, geocoding, and traffic—an alternative to Go
Telnyx MCP Server: manage phone numbers, calls, SMS and AI assistants with Telnyx API. Real-time webhooks, voice & messa
Access Tyler Forge’s design system, React UI library, component APIs, and framework guides for seamless app development
Shopify Dev integrates with Shopify APIs, perfect for Shopify developer partners to build Shopify websites and streamlin
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.