Event-Driven Architecture Core Knowledge

SkillCommunication

Event-driven architecture patterns and best practices. Covers Saga, Outbox, CQRS, Event Sourcing, and messaging patterns for distributed systems.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Event-Driven Architecture Core Knowledge skill

What this skill tells your AI

The instructions your AI receives, as published by claude-dev-suite/claude-dev-suite in skills/best-practices/event-driven/SKILL.md and read by ahel’s review.

Full Reference: See 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

PatternPurposeComplexity
Pub/SubDecouple producers from consumersLow
Event SourcingStore state as event sequenceHigh
CQRSSeparate read/write modelsMedium-High
SagaDistributed transactionsHigh
OutboxReliable event publishingMedium

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

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-PatternWhy It's BadSolution
Event SoupToo many fine-grained eventsDesign coarse-grained domain events
Missing IdempotencyDuplicate processingAdd idempotency keys
No Compensation LogicFailed saga can't rollbackImplement compensating transactions
No Dead Letter QueueFailed events lostConfigure DLQ for error handling
Weak Event OrderingRace conditionsUse partitioning or ordered queues

Quick Troubleshooting

IssueDiagnosticSolution
Lost eventsCheck message brokerImplement Outbox pattern
Duplicate processingLogs show multiple executionsAdd idempotency checks
Saga stuckCompensation not triggeredAdd timeout handling
Growing DLQMany failed messagesAnalyze failures, fix consumers
Slow event processingHigh message lagScale 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

Signals

GitHub stars
33
Forks
6
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
event-driven
Source
github.com/claude-dev-suite/claude-dev-suite