# Saga And Distributed Transactions

> Coordinate multi-step business processes across services using sagas or other distributed transaction patterns. Use when a single business action requires consistent updates in multiple systems or services.

- Skill: `itsual/saga-and-distributed-transactions` (Agent Skill)
- Install (CLI): `npx skillmds@latest add itsual/saga-and-distributed-transactions`
- Raw SKILL.md: https://api.skillmd.com/api/skills/itsual/saga-and-distributed-transactions/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: itsual (https://skillmd.com/u/itsual)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/itsual/saga-and-distributed-transactions

---


# Saga and Distributed Transactions

## Overview

Classic ACID transactions do not scale across services. Sagas and related patterns provide a practical way to manage long-running, multi-step processes with eventual consistency.

## When to Use

- Business processes that span multiple services or data stores
- Need for compensation logic when a later step fails
- Replacing distributed 2PC with more resilient approaches

## Core Ideas

- Break the process into local transactions + compensating actions
- Choreography (events) vs Orchestration (central coordinator)
- Idempotency and timeout handling are essential
- Make the current state of the saga visible and recoverable

## Principles

- Prefer orchestration when the process is complex or needs clear visibility
- Design compensating actions carefully — they are also business logic
- Surface failures and allow manual intervention when automatic compensation is insufficient

## Verification

- Failure at each step has a defined recovery or compensation path
- Saga state can be inspected and recovered
- Duplicate messages do not corrupt the process

