Agent skill

Saga Orchestration

by wshobson in wshobson/agents

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

MITAuto-check passedBackend & APIs

Install Saga Orchestration

skills CLI
$ npx skills add wshobson/agents --skill saga-orchestration -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install wshobson/agents saga-orchestration --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/wshobson/agents.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/backend-development/skills/saga-orchestration .claude/skills/saga-orchestration && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
saga-orchestration
GitHub stars
40k
Token cost
~1.5k tokens
SKILL.md length
624 words
Files
3 (incl. references)
Skills in repo
142
Repo updated
First seen
Licence
MIT

At a glance

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

  • Implementing distributed transactions across microservices where 2PC is unavailable
  • SKILL.md covers Inputs and Outputs, When to Use This Skill, Detailed section: Core Concepts and Detailed section: Templates, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Designing compensating actions for failed order workflows that span inventory

What it does

Saga Orchestration is an agent skill from wshobson/agents. 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…

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/advanced-patterns.md` and `references/details.md`).

It sits in Backend & APIs, covering Microservices and Event-driven systems. The repository describes itself as: Multi-harness agentic plugin marketplace for Claude Code, Codex, Cursor, OpenCode, GitHub Copilot, Google Antigravity, and Pi. The licence is MIT.

When your agent uses it

  • Implementing distributed transactions across microservices where 2PC is unavailable
  • Designing compensating actions for failed order workflows that span inventory
  • Shipping services
  • Building event-driven saga coordinators for travel booking systems that must roll back hotel

Example prompts

  • “/saga-orchestration”

Requirements

  • Python 3

What it can do on your machine

Read from SKILL.md and the folder at commit 46891e7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Saga Orchestration loads about 1.5k tokens when it runs, and up to ~7.8k if it reads all its reference files. Until then it costs about 137 tokens; SKILL.md has 624 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~137
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~7.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from wshobson/agents at commit 46891e7, republished under its MIT licence (© wshobson). 624 words, ~1,502 tokens.

Download SKILL.mdSave it as .claude/skills/saga-orchestration/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
saga-orchestration
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.

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
  • Make every step idempotent — Commands may be replayed on broker reconnect
  • Design compensations carefully — They are the most critical code path
  • Use correlation IDs — The saga_id must flow through every event and log
  • Implement per-step timeouts — Never wait indefinitely for a participant reply
  • Log state transitions — saga_id, step_name, old_state → new_state on every change
  • Test compensation paths explicitly — Inject failures at each step index in integration tests
Don'ts
  • Don't assume instant completion — Sagas are async and may take minutes
  • Don't skip compensation testing — The rollback path is the hardest to get right
  • Don't couple services directly — Use async messaging, never synchronous calls inside a saga step
  • Don't ignore partial failures — A step that partially executed still needs compensation
  • Don't use a global timeout — Each step has different latency characteristics

Troubleshooting

Saga stuck in COMPENSATING state

A saga enters compensation but never reaches FAILED. This means a compensation handler is throwing an unhandled exception and never publishing SagaCompensationCompleted. Add dead-letter queue (DLQ) handling to compensation consumers and ensure every compensation action publishes a result event even when the underlying operation was already rolled back.

python
async def handle_release_reservation(self, command: Dict):
    try:
        await self.release_reservation(command["original_result"]["reservation_id"])
    except ReservationNotFoundError:
        pass  # Already released — treat as success
    # Always publish completion, regardless of outcome
    await self.event_publisher.publish("SagaCompensationCompleted", {
        "saga_id": command["saga_id"],
        "step_name": "reserve_inventory"
    })
Duplicate saga executions on restart

If your orchestrator service restarts mid-saga, it may replay events and re-execute already-completed steps. Guard every step action with an idempotency key — see Template 3 above.

Show full SKILL.md (238 more words)Show less
Choreography saga losing events

In a choreography-based saga, a downstream service may miss an event if it was offline when published. Use a durable message broker (Kafka with replication, RabbitMQ with persistence) and store the current saga state in a dedicated saga_log table so you can replay from the last known good step.

Timeout firing before a slow-but-valid step completes

A step like create_shipment might take up to 15 minutes during peak load but your global timeout is 5 minutes, causing spurious compensation. Make step timeouts configurable per step type — see references/advanced-patterns.md for the TimeoutSagaOrchestrator implementation and the STEP_TIMEOUTS dict pattern.

Compensation order not matching execution order

When two steps both complete before a failure is detected, compensation must run in strict reverse order or you leave data in an inconsistent state. Verify that _compensate() iterates from current_step - 1 down to 0, and add an integration test that deliberately fails at each step index to confirm correct rollback order.


Advanced Patterns

The references/ directory contains production-grade implementations not needed for most sagas:

  • references/advanced-patterns.md — Full SagaOrchestrator abstract base class, TimeoutSagaOrchestrator with per-step deadlines, detailed bank transfer compensating transaction chain, Prometheus instrumentation, stuck saga PromQL alerts, and DLQ recovery worker.

  • cqrs-implementation — Pair sagas with CQRS for read-model updates after each step completes
  • event-store-design — Store saga events in an event store for full audit trail and replay capability
  • workflow-orchestration-patterns — Higher-level workflow engines (Temporal, Conductor) that build on saga concepts

© wshobson, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in plugins/backend-development/skills/saga-orchestration of wshobson/agents.

  • SKILL.md
  • references/advanced-patterns.md
  • references/details.md

Open the folder on GitHubat commit 46891e7

Compare with similar skills

Saga Orchestration next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Saga Orchestration compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Saga Orchestration this skillwshobson/agents40k—~1.5kAutomated safety check: PassMIT
AWS Serverless Edazxkane/aws-skills3674 repos~3.2kAutomated safety check: PassMIT
NestJS Modular Monolith Architecttech-leads-club/agent-skills7k—~3.9kAutomated safety check: PassCC-BY-4.0
Microservice Patternsrevfactory/claude-code-harness120—~502Automated safety check: PassNone
Abp Microserviceabpframework/abp14k—~1.7kAutomated safety check: PassLGPL-3.0
Microservices ArchitectJeffallan/claude-skills12k—~1.8kAutomated safety check: PassMIT

Similar skills

  • AWS Serverless Eda

    zxkane/aws-skills

    AWS serverless and event-driven architecture expert based on Well-Architected Framework.

    367 GitHub starsUsed in 4 repos~3.2k tokens
    Backend & APIsAuto-check passed
  • NestJS Modular Monolith Architect

    tech-leads-club/agent-skills

    Designs scalable NestJS modular monoliths with domain-driven design, Clean Architecture layers and optional CQRS, defining bounded contexts and strict module boundaries.

    7k GitHub stars~3.9k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Microservice Patterns

    revfactory/claude-code-harness

    Event-driven microservice architecture patterns guide. An agent skill from revfactory/claude-code-harness.

    120 GitHub stars~502 tokensUpdated 7 mo ago
    Backend & APIsAuto-check passed
  • Abp Microservice

    abpframework/abp

    ABP Microservice solution template - service structure, Integration Services ([IntegrationService]), inter-service HTTP proxies, distributed events with Outbox/Inbox, Entity Cache…

    14k GitHub stars~1.7k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Microservices Architect

    Jeffallan/claude-skills

    Designs distributed systems: bounded-context service boundaries, sync and async communication, data ownership, resilience, tracing and rollout strategy.

    12k GitHub stars~1.8k tokensUpdated 7 days ago
    Backend & APIsAuto-check passed
  • Architecture Selection

    rsmdt/the-startup

    System architecture patterns including monolith, microservices, event-driven, and serverless, with C4 modeling, scalability strategies, and technology selection criteria.

    560 GitHub stars~1.2k tokensUpdated 2 mo ago
    Backend & APIsAuto-check passed

More from wshobson/agents

All 142 skills in this repo
  • Cuts cloud spend across AWS, Azure, GCP and OCI with cost tagging, rightsizing, commitment and spot pricing models, and architecture changes.

    40k GitHub starsUsed in 14 repos~1.7k tokens
    Auto-check passed
  • Billing Automation

    wshobson/agents

    Covers building subscription billing: billing cycles, subscription states, invoice generation, proration, tax handling and dunning for failed payments.

    40k GitHub starsUsed in 13 repos~473 tokens
    Auto-check passed
  • Profiles slow Python code with cProfile and memory profilers, then applies targeted fixes for CPU, memory, I/O and query bottlenecks.

    40k GitHub starsUsed in 13 repos~814 tokens
    Auto-check passed
  • Writes unit tests for shell scripts with Bats: error-condition tests, fixtures and mocks, cross-shell checks, parallel runs, helper files and CI integration.

    40k GitHub starsUsed in 12 repos~1.3k tokens
    Auto-check passed
  • Distributed Tracing

    wshobson/agents

    Implement distributed tracing with Jaeger and Tempo to track requests across microservices and identify performance bottlenecks.

    40k GitHub starsUsed in 12 repos~527 tokens
    Auto-check passed
  • Reference for designing and tuning production LLM prompts: few-shot examples, chain-of-thought, structured outputs, templates and system prompts.

    40k GitHub stars~1.3k tokensUpdated 6 days ago
    Auto-check passed

Categories

Questions about Saga Orchestration

What does Saga Orchestration do?

Implement saga patterns for distributed transactions and cross-aggregate workflows. Saga Orchestration is an agent skill from wshobson/agents. Implement saga patterns for distributed transactions and cross-aggregate workflows.

When should I use Saga Orchestration?

Saga Orchestration fits situations like: implementing distributed transactions across microservices where 2PC is unavailable; designing compensating actions for failed order workflows that span inventory; shipping services; building event-driven saga coordinators for travel booking systems that must roll back hotel.

How do I install Saga Orchestration in Claude Code?

Run `npx skills add wshobson/agents --skill saga-orchestration -a claude-code`. Or copy the skill folder (plugins/backend-development/skills/saga-orchestration in wshobson/agents) into .claude/skills/saga-orchestration in your project. Claude Code loads it when a task matches its description.

How do I install Saga Orchestration in Codex?

Run `npx skills add wshobson/agents --skill saga-orchestration -a codex`. Or copy the skill folder (plugins/backend-development/skills/saga-orchestration in wshobson/agents) into .agents/skills/saga-orchestration in your project. Codex loads it when a task matches its description.

Can I use Saga Orchestration in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add wshobson/agents --skill saga-orchestration -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/saga-orchestration, .gemini/skills/saga-orchestration, .github/skills/saga-orchestration and .opencode/skills/saga-orchestration in your project.

What does Saga Orchestration need to run?

SKILL.md names no scripts, command-line tools or credentials: Saga Orchestration is instructions for the agent only. Our summary lists: Python 3.

Does Saga Orchestration access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Saga Orchestration safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Saga Orchestration use?

Saga Orchestration is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Saga Orchestration use?

About 1.5k tokens (SKILL.md is roughly 6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 6.3k tokens, read only when the agent opens those files.

What are the alternatives to Saga Orchestration?

Skills that share tags, products or a category with Saga Orchestration: AWS Serverless Eda (zxkane/aws-skills, 367 stars), NestJS Modular Monolith Architect (tech-leads-club/agent-skills, 7k stars), Microservice Patterns (revfactory/claude-code-harness, 120 stars) and Abp Microservice (abpframework/abp, 14k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Saga Orchestration?

wshobson (a GitHub user) maintains it in wshobson/agents, which has 40,314 GitHub stars. The repository holds 142 skills in this directory. The repository was last updated on October 5, 2026.

Source: wshobson/agents on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.