# Saga Orchestration

Implement saga patterns for distributed transactions and cross-aggregate workflows.

- Repository: https://github.com/wshobson/agents (42077 stars)
- Category: Design
- License: MIT
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add wshobson/agents --skill saga-orchestration -g -a claude-code -y`
Codex: `npx skills add wshobson/agents --skill saga-orchestration -g -a codex -y`
Cursor: `npx skills add wshobson/agents --skill saga-orchestration -g -a cursor -y`
Gemini CLI: `npx skills add wshobson/agents --skill saga-orchestration -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add wshobson/agents`

## Description

Implement saga patterns for distributed transactions and cross-aggregate workflows. Use this skill when implementing distributed transactions across microservices where 2PC is unavailable, designing compensating actions for failed order workflows that span inventory, payment, and shipping services, building event-driven saga coordinators for travel booking systems that must roll back hotel, flight, and car rental reservations atomically, or debugging stuck saga states in production where compensation steps never complete.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Saga Orchestration

Patterns for managing distributed transactions and long-running business processes without two-phase commit.

## Inputs and Outputs

**What you provide:**
- Service boundaries and ownership (which service owns which step)
- Transaction requirements (which steps must be atomic, which can be eventual)
- Failure modes for each step (transient vs. permanent, retry policy)
- SLA requirements per step (informs timeout configuration)
- Existing event/messaging infrastructure (Kafka, RabbitMQ, SQS, etc.)

**What this skill produces:**
- Saga definition with ordered steps, action commands, and compensation commands
- Orchestrator or choreography implementation for your chosen pattern
- Compensation logic for each participant service (idempotent, always-succeeds)
- Step timeout configuration with per-step deadlines
- Monitoring setup: state machine metrics, stuck saga detection, DLQ recovery

---

## When to Use This Skill

- Coordinating multi-service transactions without distributed locks
- Implementing compensating transactions for partial failures
- Managing long-running business workflows (minutes to hours)
- Handling failures in distributed systems where atomicity is required
- Building order fulfillment, approval, or booking processes
- Replacing fragile two-phase commit with async compensation

---

## Detailed section: Core Concepts

Moved to `references/details.md`.

## Detailed section: Templates

Moved to `references/details.md`.

## Best Practices

### Do's

The rest: https://github.com/wshobson/agents/blob/HEAD/plugins/backend-development/skills/saga-orchestration/SKILL.md
