Event-Driven Architecture Designer

    1

    Designs async messaging between services: event vs command, topology, delivery, ordering, retries, replay, recovery.

    $12

    Secure checkout via Stripe

    30-day refund guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI tools you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseOpenClawOpenClaw+21 more

    Event-Driven Architecture Designer

    Example session with this skill installed

    Design the event-driven architecture for our Order Fulfillment and Inventory systems.

    • System: Order Management (OMS) emitting order events to Inventory Service and Billing Service.
    • Context: Current synchronous REST calls fail during flash sales. Peak throughput is 1,200 orders/sec; sustained rate is 300 orders/sec.
    • Decider: Core Architecture Guild (Lead Architect: Marcus Vance).
    • Broker: Managed Kafka cluster (3 brokers, replication factor 3, min.insync.replicas=2).
    • Schema & Wire: CloudEvents v1.0 spec over JSON, registered in Confluent Schema Registry with BACKWARD compatibility.
    • Tension: Payments team wants billing to process synchronously before inventory holds, while inventory lead insists on immediate event-driven stock reservation; stock over-allocation happened 4 times during last promotion.
    • Reliability: Max allowable message processing latency is 500 ms at p95; zero event loss tolerance (at-least-once with transactional outbox).
    • Exclusions: Customer notification pipeline and data warehouse ETL are out of scope.

    Write the architecture under docs/architecture/eda/.

    • Read your context and instructions
    • Compiled the event-driven architecture designer

    Wrote docs/architecture/eda/eda-architecture.md. Complete event-driven architecture specification covering topic topology, delivery guarantees, transactional outbox mechanics, and partition-ordering strategy.

    Event-Driven Architecture: Order Fulfillment and Inventory

    1. Executive Summary

    This architecture establishes an asynchronous event-driven messaging boundary between Order Management System (OMS), Inventory Service, and Billing Service using Apache Kafka. It resolves flash-sale synchronous coupling and stock over-allocation by introducing transactional outbox publishing, partitioned order streams, and idempotent consumer workers.

    DimensionTarget SpecificationClassification
    Sustained Ingestion300 msg/secprovided
    Peak Ingestion1,200 msg/secprovided
    Latency Budget (p95)≤ 500 ms end-to-endprovided
    Delivery SemanticsAt-least-once with idempotent deduplicationdecided
    Broker InfrastructureKafka 3-node cluster (RF=3, min.insync.replicas=2)provided
    Message StandardCloudEvents v1.0 JSON formatprovided

    2. Context and Scope Boundary

    2.1 Boundary Definitions

    In-Scope: OMS event emission, Kafka cluster topic topology, Inventory allocation consumer, Billing transaction consumer, Dead Letter Queue (DLQ) routing, Schema Registry policies.

    Out-of-Scope (Excluded): Customer notification pipeline, data warehouse / BI ETL pipelines, and internal database migrations outside outbox tables.

    2.2 System Participants

    ServiceRoleData StoreInteraction Mode
    Order Management System (OMS)ProducerPostgreSQL 15Local ACID Transaction + Outbox Polling
    Inventory ServiceConsumer / ProducerPostgreSQL 15Idempotent Consumer + Event Emission
    Billing ServiceConsumerMySQL 8.0Idempotent Consumer

    3. Domain Event Catalog

    3.1 Event Classification

    OrderPlaced (Domain Event)
    ├── Producer: OMS
    ├── Key: order_id
    └── Routing: orders.lifecycle.v1
        ├── Subscriber: Inventory Service (reserves allocation)
        └── Subscriber: Billing Service (initiates payment hold)
    
    Event TypePurposePayload SummaryProducerMutability
    com.company.orders.placed.v1Signals customer confirmed order checkoutorder_id, customer_id, items[], total_amount_cents, currency, placed_atOMSImmutable fact
    com.company.inventory.allocated.v1Confirms stock reserved for itemsreservation_id, order_id, items[], allocated_atInventoryImmutable fact
    com.company.inventory.exhausted.v1Signals stock shortfall for orderorder_id, insufficient_skus[], failed_atInventoryImmutable fact

    Note: Order placement is an immutable past fact (domain event), not an RPC command.

    4. Channel and Topic Topology

    4.1 Topic Layout

    Topic NamePurposePartitionsRetentionCleanup Policy
    orders.lifecycle.v1Primary order events127 daysdelete
    inventory.events.v1Inventory stock status events127 daysdelete
    orders.lifecycle.v1.retryDelayed consumer retry topic63 daysdelete
    orders.lifecycle.v1.dlqPoison pill quarantine330 dayscompact,delete

    4.2 Sizing & Partition Calculation

    • Sustained rate: 300 msg/sec; Peak rate: 1,200 msg/sec.
    • Target per-partition throughput budget: 100 msg/sec maximum to guarantee latency ≤ 500 ms at p95 under standard single-thread consumer processing (processing budget ~10 ms per record).
    • Derived partition count: ceil(1200 / 100) = 12 partitions.

    5. Message Contract and Serialization

    5.1 CloudEvents Envelope

    {
      "specversion": "1.0",
      "id": "e4b2d106-69fc-4b57-9db1-35b86e09e1e2",
      "source": "/services/oms",
      "type": "com.company.orders.placed.v1",
      "datacontenttype": "application/json",
      "dataschema": "http://registry.internal/schemas/orders.placed.v1.json",
      "time": "2026-09-15T10:00:00Z",
      "traceparent": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
      "data": {
        "order_id": "ord_99281a",
        "customer_id": "cust_4812",
        "items": [
          { "sku": "SKU-BLK-M", "quantity": 1, "price_cents": 4500 }
        ],
        "total_amount_cents": 4500,
        "currency": "USD"
      }
    }
    

    6. Ordering and Partitioning Strategy

    6.1 Partition Key Assignment

    • orders.lifecycle.v1 is keyed by order_id.
    • Rationale: Ensures total strict ordering of all state transitions belonging to a specific order (placed -> allocated -> paid).
    • Flash Sale Hotspots: Popular products do NOT partition on sku at the ingress topic, preventing Kafka partition skew. Inventory service aggregates SKU stock levels internally using database row locks keyed on SKU.

    7. Delivery and Idempotency Architecture

    7.1 Producer: Transactional Outbox Pattern

    Direct dual-write to PostgreSQL and Kafka is prohibited to prevent dual-write divergence.

    1. OMS writes order record and an outbox event into outbox_events table in one local ACID transaction.
    2. A relay poller (CDC or scheduled de-queuer) reads unpublished outbox rows, writes to Kafka with acks=all, and marks rows processed.
    3. Producer idempotency enabled (enable.idempotence=true, max.in.flight.requests.per.connection=5).

    7.2 Consumer: Idempotent Deduplication

    • Natural business deduplication via unique constraint in consumer datastore:
      • Table: processed_events (event_id PRIMARY KEY, processed_at TIMESTAMP, consumer_group VARCHAR(64))
    • Processing steps:
      1. Consumer reads message containing event_id.
      2. Transaction begins: Check existence of event_id in processed_events.
      3. If exists, bypass processing and acknowledge Kafka offset.
      4. If absent, execute business logic (e.g. stock reservation), insert event_id, commit transaction, and acknowledge offset.

    8. Failure, Poison Message, and Replay Strategy

    8.1 Error Classification and Handling

    Error CategoryExampleImmediate ActionDestination
    Transient SystemDatabase deadlock, network timeoutRetry up to 3 times with exponential backoff (100ms, 200ms, 400ms)In-process
    Persistent TransientDownstream system unavailable > 30sPublish to orders.lifecycle.v1.retry with backoff headerRetry topic
    Poison PillDeserialization failure, schema mismatch, validation violationCapture error details in header, bypass main offset commitorders.lifecycle.v1.dlq

    8.2 DLQ Replay Mechanism

    • Replay from DLQ requires operator execution via administrative script after schema or bug resolution.
    • DLQ messages preserve original id, traceparent, and append x-retry-original-topic header.

    9. Governance, Evolution, and Schema Registry

    • Registry Mode: Confluent Schema Registry with BACKWARD compatibility mode.
    • Schema Evolution Rules:
      • Field removal: forbidden unless deprecated across two major versions.
      • Field addition: mandatory default values required for all new fields.
      • Enum expansion: new enum values treated as unknown variant on older consumers.

    10. Operational Observability and SLA Verification

    10.1 Metrics and Monitoring

    • Consumer Lag: Alert triggered if consumer lag on orders.lifecycle.v1 exceeds 5,000 records or consumer lead time exceeds 300 ms.
    • End-to-End Latency Metric: Measured via time field in CloudEvents envelope against consumer processing commit timestamp. SLA threshold: p95 <= 500 ms.

    Appendix A: Decision Register

    IDDecisionChosen AlternativeRejected AlternativesJustification
    DEC-EDA-01State PublishingTransactional OutboxDirect Dual-Write, 2PC / XADual-write risks data inconsistency on broker failure; 2PC unsupported by Kafka.
    DEC-EDA-02Partitioning Keyorder_idcustomer_id, skusku would create partition hotspots during flash promotions; order_id provides even balancing.
    DEC-EDA-03Message FormatCloudEvents v1.0 JSONCustom Avro, gRPCOpen interoperability across polyglot microservices without vendor-locked client bindings.

    Appendix B: Traceability Matrix

    Requirement / TensionSpecification SectionResolution & Coverage
    Peak 1,200 orders/secSection 4.212 Kafka partitions @ 100 msg/sec budget
    Stock over-allocationSection 6.1 & 7.2Keyed by order_id with idempotent DB transactions
    Latency p95 <= 500 msSection 4.2 & 10.1Partition distribution and consumer lag alerting at 300 ms
    Synchronous payment tensionSection 3.1 & 7.1Decoupled via OrderPlaced event; inventory & billing react concurrently

    Verification

    No external automated validator was supplied; manual structural self-check executed:

    • Adheres to standard 10-section EDA architectural template.
    • All technical limits derived from provided intake metrics (1,200 peak msg/sec, 12 partitions derived via 100 msg/sec per-partition limit).
    • Contains no self-granted approvals; recommendations submitted for Architecture Guild ratification.

    Next steps

    1. Present topic topology and partition plan (DEC-EDA-02) to Core Architecture Guild for formal sign-off.
    2. Align Payments and Inventory engineering leads on asynchronous compensation flows in case of payment rejection post-inventory reservation.
    3. Validate CDC / Outbox table schema with database administration team to verify WAL generation overhead under 1,200 msg/sec peak write bursts.

    Connects securely to your tools. The creator never sees your data.

    What you get

    Define event vs command semantics for microservicesDesign crash-safe outbox and idempotency mechanismsEstablish consistency contracts and consumer staleness limitsArchitect failure recovery, replay, and observability paths

    About this skill

    Event-Driven Architecture Designer: Full Description

    What it does

    This skill owns the application-architecture decision for asynchronous communication among independently executing components. It defines message intent, producer and consumer ownership, topology, publication and delivery semantics, ordering, compatibility, failure containment, replay, backpressure, projections, and operations while preserving domain-event meaning and workflow authority.

    Use it when

    • One accepted fact must trigger independent reactions without making the producer know or wait for all consumers
    • Work should survive producer/consumer downtime, absorb bursts, or execute asynchronously with explicit completion semantics
    • Point-to-point work distribution, publish/subscribe fan-out, retained event log, stream processing, or asynchronous request/reply must be selected
    • State commit and event/message publication need crash-safe atomic-intent semantics such as an outbox or another evidenced mechanism
    • At-most-once or at-least-once delivery, duplicate attempts, idempotent effects, acknowledgments, offsets/checkpoints, and uncertain commits need design
    • Ordering scope, partition/routing key, concurrency, late or missing events, event time, replay, or projection rebuild affect correctness

    For example: “Our warehouse system publishes 'inventory.changed' with the whole item record. Five consumers each diff it, two of them act twice, and a stock correction triggered 40,000 reprice jobs.”

    What you get

    • architecture/event-driven-architect/README.md
    • architecture/event-driven-architect/00-overview/event-driven-architect-overview.md
    • architecture/event-driven-architect/verification/fitness-self-check.md

    Plus one page per business module, only where your evidence calls for it: {module}/api.md, {module}/events.md, {module}/clients.md, {module}/data.md, {module}/security.md, {module}/observability.md, {module}/resilience.md.

    All paths are relative to the output folder you choose.

    What it will not do

    Do not use for one domain event definition, synchronous API calls, workflow orchestration, webhook implementation, stream analytics alone, broker provisioning, or choosing Kafka/RabbitMQ from keywords such as event-driven or real-time.

    How it works

    1. Check the scope is the application's event architecture.
    2. Distinguish events, commands and queries in the design.
    3. Fix the event granularity and its ownership.
    4. State the consistency contract per consumer.
    5. Design the failure and observability path.
    6. Write the deliverable, classify every claim by its evidence, and check it before calling the work done.

    What's in the package

    Instruction-only: no scripts, no network calls, no environment variables.

    • LICENSE.txt
    • SKILL.md
    • agents/openai.yaml
    • assets/output-template-artifact.md
    • assets/output-template-contract.md
    • assets/output-template-domain.md
    • assets/output-template-fitness.md
    • assets/output-template-mechanism.md
    • references/domain-rules.md
    • references/operating-rules.md
    • references/output-contract.md

    How to install

    Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.

    ~30 seconds
    1. 1

      Download the ZIP

      Free skills download straight away. Paid skills unlock right after purchase.

    2. 2

      Unzip into your skills folder

      Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.

    3. 3

      Ask your agent to use it

      Restart the agent if it was already running. It picks the skill up automatically - no config needed.

    Skills folder by agent

    Click the path to copy it. Create the folder if it does not exist yet.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean 13 days ago

    • Passed all security checks, Safe to install

    Listed13 days ago

    What's inside

    Frequently Asked Questions