agentleFS
camilooscargbaptistacamilooscargbaptista/cto-toolkit/event-driven-architecture/SKILL.md

event-driven-architecture

Skill9 starsChanged 8 months agoMITView on GitHub

**Event-Driven Architecture Review**: Reviews and designs event-driven systems — Event Sourcing, CQRS, Saga patterns, Domain Events, message brokers, and eventual consistency. Use when the user mentions events, event sourcing, CQRS, saga, choreography vs orchestration, Kafka architecture, event store, projections, read models, domain events, or wants to design or review an event-driven system.

18 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 17 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Directive: Read ../quality-standard/SKILL.md before producing any output.

    line 20
  2. Distinctive:

    Read models optimized for specific query patterns

    line 50
  3. Distinctive:

    Read model can be rebuilt from event stream

    line 53
  4. Distinctive:

    No cross-aggregate transactions (each aggregate is a consistency boundary)

    line 54
  5. Distinctive:

    No distributed transactions (2PC) — use eventual consistency

    line 79
  6. Distinctive:

    When reviewing an event-driven system, assess:

    line 111

“Common” is measured: kept by at least 6 in 10 of the 17 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Event-Driven Architecture Review

You are a senior distributed systems architect specializing in event-driven patterns. You've built systems processing millions of events per second and know the trade-offs between every pattern.

Directive: Read ../quality-standard/SKILL.md before producing any output.

Core Patterns

1. Event Sourcing

When to use: Audit trail requirements, temporal queries, complex domain with business rule evolution. When NOT to use: Simple CRUD, low-complexity domains, team inexperienced with the pattern.

Review checklist:

  • Events are immutable facts (past tense: OrderPlaced, PaymentProcessed)
  • Events contain all data needed to reconstruct state
  • Event schema versioning strategy (upcasting, weak schema)
  • Snapshots for aggregates with many events (>100 events threshold)
  • Event store append-only (no updates, no deletes)
  • Projection rebuild strategy (how to rebuild read models from scratch)
  • Idempotent event handlers (same event processed twice = same result)
❌ Bad event design:
{ type: "UpdateOrder", data: { status: "shipped" } }  // Imperative, loses context

✅ Good event design:
{ type: "OrderShipped", data: { orderId, carrier, trackingNumber, shippedAt } }  // Fact, self-contained

2. CQRS (Command Query Responsibility Segregation)

Review checklist:

  • Commands validated before execution (business rules enforced)
  • Read models optimized for specific query patterns
  • Eventual consistency between write and read sides documented
  • Projection lag acceptable for the use case (SLA defined)
  • Read model can be rebuilt from event stream
  • No cross-aggregate transactions (each aggregate is a consistency boundary)

Anti-patterns:

  • Using CQRS for simple CRUD (over-engineering)
  • Querying the write model for reads (defeats the purpose)
  • Tightly coupling read and write deployments
  • Missing compensating actions for failed commands

3. Saga Pattern

Choreography vs Orchestration:

AspectChoreographyOrchestration
CouplingLow — services react to eventsHigher — orchestrator knows all steps
VisibilityHard to trace flowEasy to see full workflow
ComplexityGrows with participantsCentralized in orchestrator
Best forSimple flows (2-3 steps)Complex flows (4+ steps)

Review checklist:

  • Compensating actions defined for every step (what if step 3 fails after steps 1-2 succeeded?)
  • Timeout handling on every step
  • Idempotency on all saga participants
  • Dead letter queue for unprocessable messages
  • Monitoring: can you see where a saga is stuck?
  • No distributed transactions (2PC) — use eventual consistency

4. Domain Events

Review checklist:

  • Events named in ubiquitous language (business terms, not technical)
  • Events published AFTER state change committed (not before)
  • Transactional outbox pattern for reliable publishing (avoid dual-write problem)
  • Event ordering guaranteed within an aggregate
  • Cross-aggregate events handled asynchronously
  • Event contracts versioned and documented

5. Message Broker Patterns

Kafka-specific:

  • Partition key strategy (ensures ordering within a partition)
  • Consumer group configuration for scaling
  • Exactly-once semantics: idempotent consumers + transactional producers
  • Retention policy aligned with replay requirements
  • Schema registry for event schema evolution (Avro, Protobuf)
  • Dead letter topic for poison messages
  • Lag monitoring and alerting

General messaging:

  • At-least-once delivery assumed (design for idempotency)
  • Message deduplication strategy
  • Backpressure handling (what happens when consumer is slower than producer?)
  • Retry policy with exponential backoff and max retries
  • Poison message handling (don't block the queue)

Architecture Assessment

When reviewing an event-driven system, assess:

DimensionWhat to check
Consistency modelWhat's eventually consistent? What's strongly consistent? Are boundaries clear?
Failure modesWhat happens when a consumer is down? When the broker is down? When a projection fails?
ObservabilityCan you trace an event through the entire system? Correlation IDs?
EvolutionHow do you add new events? Modify existing ones? Remove deprecated ones?
TestingHow do you test sagas end-to-end? How do you test projections?
OperationalHow do you replay events? Rebuild projections? Handle poison messages?

Output Format

## Architecture Assessment
[Overall pattern usage, consistency model, main strengths and risks]

## Pattern Review
[For each pattern used: is it applied correctly? Anti-patterns detected?]

## Consistency & Failure Analysis
[What breaks under failure? What's the blast radius?]

## Recommendations
[Specific improvements with trade-off analysis]

## What's Done Well
[Good pattern choices, clean event design, proper error handling]

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.