Skip to content
Skills Library
Programming · Planning

event-driven-architecture

/event-driven-architecture

Use when designing systems around events and message queues. Covers event schema design, delivery guarantees, idempotent consumers, ordering, dead-letter handling, and event sourcing. Trigger on "should we use kafka", "messages are processed twice", "consumer is stuck", "design the event schema". Do not use for a simple task queue of background work — see the background-jobs skill; for whether to split into services, see the microservices skill.

Licence
MIT
Last repository change
24.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 24.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Use when designing systems around events and message queues. Covers event schema design, delivery guarantees, idempotent consumers, ordering, dead-letter handling, and event sourcing. Trigger on "should we use kafka", "messages are processed twice", "consumer is stuck", "design the event schema". Do not use for a simple task queue of background work — see the background-jobs skill; for whether to split into services, see the microservices skill.

Triggers from the description

should we use kafkamessages are processed twiceconsumer is stuckdesign the event schema
Original author description

Use when designing systems around events and message queues. Covers event schema design, delivery guarantees, idempotent consumers, ordering, dead-letter handling, and event sourcing. Trigger on "should we use kafka", "messages are processed twice", "consumer is stuck", "design the event schema". Do not use for a simple task queue of background work — see the background-jobs skill; for whether to split into services, see the microservices skill.

How it works

  1. Purpose
  2. When to Use
  3. Capabilities
  4. Inputs
  5. Outputs
  6. Workflow
  7. Best Practices
  8. Examples
  9. Notes
Original SKILL.md headings · 82 lines, 633 words
SKILL.md preview
---
name: event-driven-architecture
description: Use when designing systems around events and message queues. Covers event schema design, delivery guarantees, idempotent consumers, ordering, dead-letter handling, and event sourcing. Trigger on "should we use kafka", "messages are processed twice", "consumer is stuck", "design the event schema". Do not use for a simple task queue of background work — see the background-jobs skill; for whether to split into services, see the microservices skill.
metadata:
  category: backend
  version: 1.0.0
  tags: [events, kafka, queues, messaging, idempotency]
---

# Event-Driven Architecture

## Purpose

Design event flows that survive redelivery, reordering, and consumer failure — because all three will happen, and the broker's guarantees are weaker than most designs assume.

## When to Use

- Introducing a message broker or queue.
- Designing event schemas that other teams will consume.
- Debugging duplicate processing, lost messages, or stuck consumers.
- Evaluating event sourcing for a subsystem.

## Capabilities

- Event schema design and versioning.
- Delivery semantics: at-most-once, at-least-once, effectively-once.
- Idempotent consumer design.
- Ordering and partitioning strategy.
- Dead-letter queues, retry policies, and poison-message handling.
- Event sourcing and CQRS, and when the cost is justified.

## Inputs

- The events the domain actually produces, in the domain's language.
- The broker and its real guarantees (not its marketing).
- Consumer requirements: ordering, latency, replay.

## Outputs

- Versioned event schemas with a registry or equivalent.
- Consumers that are safe to run twice on the same message.
- Retry, DLQ, and replay procedures.

## Workflow

1. **Name events in the past tense** — `OrderPlaced`, `PaymentFailed`. An event is a fact that happened, not a command to do something.
2. **Design the payload for consumers you do not control** — Include enough context that a consumer does not have to call back for the basics; do not include so much that every field change breaks someone.
3. **Assume at-least-once** — Every consumer must be idempotent. Deduplicate on an event ID, or make the operation naturally idempotent.
4. **Partition for ordering** — Ordering is guaranteed only within a partition. Key by the entity whose order matters (usually the aggregate ID).
5. **Handle poison messages** — A message that always fails must land in a DLQ after N attempts, not retry forever and block the partition.
6. **Version from the start** — Additive changes only; a new required field is a new event version.

## Best Practices

- Exactly-once delivery does not exist across a network. Exactly-once *processing* is achievable with idempotent consumers, and that is where the effort belongs.
- Retry with exponential backoff and jitter. Fixed-interval retries from many consumers synchronize into a thundering herd.
- A consumer that retries a permanently failing message forever blocks every message behind it. Always cap attempts.
- Do not put large payloads on the bus. Publish a reference and let the consumer fetch — or accept the coupling knowingly.
- Events are a public contract. Removing a field breaks consumers you have never met.
- Log the event ID at every hop. Without it, tracing a lost message is archaeology.

## Examples

**Idempotent consumer keyed on event ID:**

```python
async def handle(event: Event, conn: Connection) -> None:
    async with conn.transaction():
        # Insert the marker first. If this event was already processed,
        # the unique constraint rejects it and we skip the side effect.
        inserted = await conn.execute(
            "INSERT INTO processed_events (event_id, consumer) VALUES ($1, $2) "
            "ON CONFLICT DO NOTHING RETURNING 1",
            event.id, CONSUMER_NAME,
        )
        if not inserted:
            logger.info("duplicate_event_skipped", extra={"event_id": event.id})
            return

        await apply_side_effect(event, conn)   # same transaction as the marker
```

The marker and the side effect commit together. Redelivery is a no-op; a crash mid-transaction rolls back both and the message is redelivered cleanly.

## Notes

- Kafka guarantees ordering per partition, not per topic. If two events for the same order land in different partitions, they can be processed out of order — key by order ID.
- A DLQ with no alerting and no replay tooling is a place where messages go to be forgotten. Build the replay path when you build the DLQ.
- Event sourcing is a large commitment: every schema change becomes a versioning problem for events you can never rewrite. Adopt it where the audit log *is* the product, not as a default persistence strategy.

Versions

RepositoryScoreLicence
This page · nimadorostkar/Claude-Skills-collection100MIT
travisjneuman/.claude100MIT
reddygopalkrishna/developer-agent-skills100MIT
andreibesleaga/gabbe90CC-BY-4.0
Amey-Thakur/AI-SKILLS90MIT
NickCrew/Claude-Cortex90MIT
rade-nugroho/agentic-enteprises-skill90MIT

Database snapshot: 13.11.2026 · package version ce0c3bfa4d38 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100event-driven
    Use when designing or debugging an event-driven system — choosing Kafka partitioning strategies, implementing the outbox pattern, handling dead-letter queues, ensuring idempotent consumers, or making event sourcing decisions.
  • 100event-driven
    Use when designing or debugging an event-driven system — choosing Kafka partitioning strategies, implementing the outbox pattern, handling dead-letter queues, ensuring idempotent consumers, or making event sourcing decisions.
  • 100message-queues-interviewer
    A Lead Data Engineer interviewer evaluating asynchronous messaging. Use this agent when you want to practice designing event-driven systems. It rigorously tests your understanding of RabbitMQ vs Kafka, at-least-once delivery guarantees, managing poison pills in Dead Letter…
  • 95backend-event-driven-architecture
    Use this skill when the user says 'event-driven architecture', 'EDA', 'publish domain events', 'kafka producer', 'kafka consumer', 'rabbitmq exchange', 'event broker', 'at-least-once delivery', 'event ordering', 'consumer group'. Designs broker-based event flows (Kafka or…
  • 100messaging-streaming
    This skill should be used when the user designs a "message queue", reaches for "Kafka", "RabbitMQ", "SQS", "Kinesis", "pub/sub", or "event-driven" architecture, asks about "async processing", "background jobs", "stream processing", or wrestles with "exactly-once vs…
  • 90event-driven-messaging
    Use when a ticket connects components through events or messages — publishing domain events, consuming from a topic or stream, an event bus, pub/sub, change-data-capture — and the design must define ownership of each event, its schema and versioning, delivery guarantees,…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.