Skip to content
Skills Library
Programming · Learning & explanation

event-driven

/event-driven

Event-driven architecture patterns and best practices. Covers Saga, Outbox, CQRS, Event Sourcing, and messaging patterns for distributed systems. USE WHEN: user mentions "event-driven", "Saga", "Outbox pattern", "CQRS", "Event Sourcing", "distributed transactions", "eventual consistency", "message broker", "event bus", asks about "microservices communication", "async patterns", "compensating transactions" DO NOT USE FOR: Simple pub/sub - use messaging framework skills (Kafka, RabbitMQ), REST APIs - use API design skills, Real-time updates - use WebSocket skills, Basic async/await - use languag

Licence
MIT
Last repository change
21.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
2
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 21.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

Event-driven architecture patterns and best practices. Covers Saga, Outbox, CQRS, Event Sourcing, and messaging patterns for distributed systems. USE WHEN: user mentions "event-driven", "Saga", "Outbox pattern", "CQRS", "Event Sourcing", "distributed transactions", "eventual consistency", "message broker", "event bus", asks about "microservices communication", "async patterns", "compensating transactions" DO NOT USE FOR: Simple pub/sub - use messaging framework skills (Kafka, RabbitMQ), REST APIs - use API design skills, Real-time updates - use WebSocket skills, Basic async/await - use languag

Triggers from the description

event-drivenSagaOutbox patternCQRSEvent Sourcingdistributed transactionseventual consistencymessage broker
Original author description

Event-driven architecture patterns and best practices. Covers Saga, Outbox, CQRS, Event Sourcing, and messaging patterns for distributed systems. USE WHEN: user mentions "event-driven", "Saga", "Outbox pattern", "CQRS", "Event Sourcing", "distributed transactions", "eventual consistency", "message broker", "event bus", asks about "microservices communication", "async patterns", "compensating transactions" DO NOT USE FOR: Simple pub/sub - use messaging framework skills (Kafka, RabbitMQ), REST APIs - use API design skills, Real-time updates - use WebSocket skills, Basic async/await - use languag

How it works

  1. When NOT to Use This Skill
  2. Architecture Patterns Overview
  3. Saga Pattern
  4. Transactional Outbox Pattern
  5. CQRS Architecture
  6. Anti-Patterns
  7. Quick Troubleshooting
  8. Best Practices
  9. Reference Documentation
Original SKILL.md headings · 143 lines, 579 words
SKILL.md preview
---
name: event-driven
description: |
  Event-driven architecture patterns and best practices. Covers Saga,
  Outbox, CQRS, Event Sourcing, and messaging patterns for distributed systems.

  USE WHEN: user mentions "event-driven", "Saga", "Outbox pattern", "CQRS", "Event Sourcing",
  "distributed transactions", "eventual consistency", "message broker", "event bus",
  asks about "microservices communication", "async patterns", "compensating transactions"

  DO NOT USE FOR: Simple pub/sub - use messaging framework skills (Kafka, RabbitMQ),
  REST APIs - use API design skills,
  Real-time updates - use WebSocket skills,
  Basic async/await - use language-specific skills
allowed-tools: Read, Grep, Glob
---

# Event-Driven Architecture Core Knowledge

> **Full Reference**: See [advanced.md](advanced.md) for Saga implementations (Node.js, Java), Outbox pattern implementations, Event Sourcing, CQRS, and idempotency patterns.

> **Deep Knowledge**: Use `mcp__documentation__fetch_docs` with technology: `event-driven` for comprehensive documentation.

## When NOT to Use This Skill

- **Monolithic applications** - Use simple in-process events
- **Simple CRUD operations** - Use REST APIs or GraphQL
- **Real-time UI updates** - Use WebSockets or SSE
- **Synchronous workflows** - Use traditional transactions

## Architecture Patterns Overview

| Pattern | Purpose | Complexity |
|---------|---------|------------|
| **Pub/Sub** | Decouple producers from consumers | Low |
| **Event Sourcing** | Store state as event sequence | High |
| **CQRS** | Separate read/write models | Medium-High |
| **Saga** | Distributed transactions | High |
| **Outbox** | Reliable event publishing | Medium |

## Saga Pattern

Manages distributed transactions across services without 2PC.

### Choreography Saga
```
┌─────────┐    event    ┌─────────┐    event    ┌─────────┐
│Order Svc│────────────▶│Payment  │────────────▶│Inventory│
└─────────┘             │   Svc   │             │   Svc   │
     ▲                  └─────────┘             └─────────┘
     │    compensate         │    compensate         │
     └───────────────────────┴───────────────────────┘
```

### Orchestration Saga
```
                    ┌─────────────┐
                    │    Saga     │
                    │Orchestrator │
                    └─────────────┘
                    /      |      \
                   ▼       ▼       ▼
            ┌───────┐ ┌───────┐ ┌───────┐
            │Order  │ │Payment│ │Invent.│
            └───────┘ └───────┘ └───────┘
```

## Transactional Outbox Pattern

Ensures reliable event publishing with database transactions.

```
┌────────────────────────────────────────────┐
│            Database Transaction            │
│  ┌──────────────┐    ┌──────────────────┐  │
│  │   Business   │    │   Outbox Table   │  │
│  │    Table     │    │   (messages)     │  │
│  └──────────────┘    └──────────────────┘  │
└────────────────────────────────────────────┘
                             │
                    Polling Relay / CDC
                             │
                    ┌─────────────────┐
                    │  Message Broker │
                    └─────────────────┘
```

### Outbox Table Schema
```sql
CREATE TABLE outbox (
    id UUID PRIMARY KEY,
    aggregate_type VARCHAR(255) NOT NULL,
    aggregate_id VARCHAR(255) NOT NULL,
    event_type VARCHAR(255) NOT NULL,
    payload JSONB NOT NULL,
    status VARCHAR(50) DEFAULT 'PENDING',
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
```

## CQRS Architecture

```
        Commands                          Queries
            │                                 │
            ▼                                 ▼
    ┌───────────────┐                ┌───────────────┐
    │ Command Model │                │  Query Model  │
    │   (Write)     │                │   (Read)      │
    └───────────────┘                └───────────────┘
            │                                 ▲
            ▼                                 │
    ┌───────────────┐     Events     ┌───────────────┐
    │  Write Store  │───────────────▶│  Read Store   │
    └───────────────┘                └───────────────┘
```

## Anti-Patterns

| Anti-Pattern | Why It's Bad | Solution |
|--------------|--------------|----------|
| **Event Soup** | Too many fine-grained events | Design coarse-grained domain events |
| **Missing Idempotency** | Duplicate processing | Add idempotency keys |
| **No Compensation Logic** | Failed saga can't rollback | Implement compensating transactions |
| **No Dead Letter Queue** | Failed events lost | Configure DLQ for error handling |
| **Weak Event Ordering** | Race conditions | Use partitioning or ordered queues |

## Quick Troubleshooting

| Issue | Diagnostic | Solution |
|-------|------------|----------|
| **Lost events** | Check message broker | Implement Outbox pattern |
| **Duplicate processing** | Logs show multiple executions | Add idempotency checks |
| **Saga stuck** | Compensation not triggered | Add timeout handling |
| **Growing DLQ** | Many failed messages | Analyze failures, fix consumers |
| **Slow event processing** | High message lag | Scale consumers, optimize handlers |

## Best Practices

### Message Design
- Include correlation ID for tracing
- Version your events for evolution
- Keep payloads small, reference large data

### Error Handling
- Implement retry with exponential backoff
- Use Dead Letter Queues for failed messages
- Set up alerting on DLQ growth

### Monitoring
- Track message lag
- Monitor consumer group health
- Alert on processing errors
- Trace message flow across services

## Reference Documentation

Available topics: `patterns`, `saga`, `outbox`, `cqrs`
Files in this package (2)
  • SKILL.md 7 KB
  • advanced.md 8 KB

Versions

RepositoryScoreLicence
This page · claude-dev-suite/claude-dev-suite100MIT
G1Joshi/Agent-Skills100MIT
MARUCIE/openclaw-foundry100MIT
Tyler-R-Kendrick/agent-skills100MIT
Tyler-R-Kendrick/agent-skills100MIT
kid-sid/codex-spellbook100MIT
TheBeardedBearSAS/claude-craft95MIT

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

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 95microservice-design-patterns
    Use this skill when the user says 'saga pattern', 'distributed transaction', 'compensating transaction', 'choreography vs orchestration', 'CQRS with event sourcing', 'cross-service consistency', 'two-phase commit microservices'. Explains and designs the data-consistency patterns…
  • 90event-driven-architecture
    Event-driven architecture patterns with event sourcing, CQRS, and message-driven communication. Use when designing distributed systems, microservices communication, or systems requiring eventual consistency and scalability.
  • 90backend-event-driven
    Use this skill when the user says 'event-driven', 'message queue', 'Kafka', 'RabbitMQ', 'pub/sub', 'domain event', 'event sourcing', 'CQRS', 'async messaging', 'event bus', or when designing asynchronous communication between services. This skill enforces: domain vs integration…
  • 90event-driven-architecture
    Guides event-driven systems—pub/sub, point-to-point, event sourcing, CQRS, schema versioning (Avro/JSON Schema), ordering, partitioning, delivery guarantees, idempotency, exactly-once tradeoffs, transactional outbox/inbox, choreography vs orchestration, sagas, dead-letter…
  • 90event-sourcing-architect
    Expert in event sourcing, CQRS, and event-driven architecture patterns. Masters event store design, projection building, saga orchestration, and eventual consistency patterns. Use for event-sourced systems, audit trails, or temporal queries.
  • 100event-driven-architecture-saga-patterns
    Designing resilient, eventual-consistency distributed transactions using the Saga Pattern (Choreography and Orchestration). Includes Outbox Pattern, Change Data Capture (CDC), idempotent consumers, compensating transactions, dual-write prevention, and saga recovery mechanisms.…

Feedback and reports

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