event-driven-architecture-saga-patterns

event-driven-architecture-saga-patterns is a skill for Claude Code, Codex from hamzabellouch/agent-skills. It costs 75 tokens per session (2,906 once invoked), scanned A, original, MIT.

A guide to the Saga Pattern, a way to coordinate a business operation across services that each have their own database. It uses local steps and corrective actions when a later step fails.

In plain words
What is it for?
Use it when designing microservice workflows, payment or order processes, event-driven transactions, recovery logic, or change-data pipelines.
Why use it?
It helps keep distributed operations consistent when one shared database transaction cannot safely cover every service.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when designing microservice workflows, payment or order processes, event-driven transactions, recovery logic, or change-data pipelines.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hamzabellouch/agent-skills/event-driven-architecture-saga-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add hamzabellouch/agent-skills --skill event-driven-architecture-saga-patterns
Clone the repo
git clone --depth 1 https://github.com/hamzabellouch/agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for event-driven-architecture-saga-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/hamzabellouch/agent-skills/event-driven-architecture-saga-patterns/github.svg)](https://agentmods.dev/skills/hamzabellouch/agent-skills/event-driven-architecture-saga-patterns)
Your own site
<a href="https://agentmods.dev/skills/hamzabellouch/agent-skills/event-driven-architecture-saga-patterns"><img src="https://agentmods.dev/badge/skills/hamzabellouch/agent-skills/event-driven-architecture-saga-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for event-driven-architecture-saga-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/hamzabellouch/agent-skills/event-driven-architecture-saga-patterns"><img src="https://agentmods.dev/badge/skills/hamzabellouch/agent-skills/event-driven-architecture-saga-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 75 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,906 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00075 $0.02906
Opus 5 $0.00037 $0.01453
Sonnet 5 $0.00015 $0.00581
Haiku 4.5 $0.00007 $0.00291

Measured 8d ago against content hash 240fa4c2c82f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

event-driven-architecture-saga-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Event Driven Systems/event-driven-architecture-saga-patterns/SKILL.md · 308 lines

How it starts

The opening of the file, as written. The whole thing — 308 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Event-Driven Architecture: Saga Patterns & Eventual Consistency Guide

1. Architectural Foundations: BASE over ACID

In microservices architectures, each service maintains its own private database to ensure loose coupling and independent scalability. This renders distributed ACID transactions impossible without two-phase commit (2PC). However, 2PC introduces high latency, synchronous blocking, single points of failure, and deadlocks across service boundaries.

The Saga Pattern manages distributed transactions as a sequence of local transactions. Each local transaction updates a single service's database and emits an event or message to trigger the next step. If a step fails, the Saga executes compensating transactions in reverse order to undo changes and restore data consistency.

1.1 Transaction Classification

[ Local Tx 1: Compensable ] ──► [ Local Tx 2: Pivot ] ──► [ Local Tx 3: Retryable ]
        │                             │                         │
   (Rollbackable)              (Point of No Return)       (Guaranteed Success)
  • Compensable Transactions: Transactions that can be undone by running an explicit compensating transaction.
  • Pivot Transaction: The critical decision point of the Saga. Once the pivot transaction succeeds, the Saga MUST go to completion. It cannot be compensated.
  • Retryable Transactions: Transactions that follow the pivot point and are guaranteed to eventually succeed through retries.

2. Saga Execution Models: Choreography vs. Orchestration

CHOREOGRAPHY:
[ Order Service ] ── OrderCreated ──► [ Payment Service ] ── PaymentProcessed ──► [ Inventory Service ]

ORCHESTRATION:
                        ┌──► [ Payment Service ]
                        │
[ Saga Orchestrator ] ──┼──► [ Inventory Service ]
                        │
                        └──► [ Shipping Service ]

2.1 Comparative Analysis

Dimension Choreography Saga Orchestration Saga
Control Model Decentralized; services react to domain events. Centralized; dedicated orchestrator directs participants.
Coupling Loosely coupled; services know events, not handlers. Moderate coupling; orchestrator knows participant APIs.
State Visibility Distributed across service logs; hard to query global status. Centralized state store; easy to track saga status.
Complexity Simple for small flows (2-3 steps); cyclic dependencies in large flows. High initial setup; manages complex branching & parallel paths easily.
Failure Handling Complex cascading compensation logic across events. Explicit compensation routines directed by orchestrator.

Read the full file on GitHub · 308 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 308 lines · 75 tokens per session scan A 240fa4c2c82f

Subscribe to this mod's changes

event-driven-architecture-saga-patterns is a skill published in the GitHub repository hamzabellouch/agent-skills (4 stars, last pushed 1mo ago), licensed MIT. It adds 75 tokens to every session and 2,906 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.