agentsclimarketplace

Saga

Skill G1Joshi/Agent-Skills/skills/architecture/saga

Saga pattern for distributed transactions. Use for microservices transactions.From its SKILL.md

Install
npx -y skills add G1Joshi/Agent-Skills --skill saga

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 12 stars12 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

1.9 KB, 405 tokens by cl100k_base, as published. Nobody here has run it

Saga Pattern

The Saga pattern manages data consistency across microservices in distributed transaction scenarios. A Saga is a sequence of local transactions. Each local transaction updates the database and publishes a message or event to trigger the next local transaction in the saga.

When to Use

  • Distributed Transactions: e.g., "Book Flight" + "Book Hotel" + "Charge Card".
  • Long-running processes where you can't hold a DB lock.
  • Ensuring eventual consistency across Services A, B, and C.

Core Concepts

Compensating Transactions

If a step fails (e.g., Card Declined), the Saga must execute compensating transactions to undo the changes made by the preceding steps (e.g., "Cancel Hotel", "Cancel Flight").

Choreography

Each service listens to events and decides what to do.

  • Order Service -> OrderCreated
  • Inventory Service -> listends to OrderCreated -> does work -> InventoryReserved

Orchestration

A central coordinator (Orchestrator) tells each service what to do.

  • Orchestrator -> Call Order Service
  • Orchestrator -> Call Inventory Service
  • Orchestrator -> Handle failure -> Call Compensation.

Best Practices

Do:

  • Prefer Orchestration for complex sagas (easier to visualize and trace).
  • Ensure all steps are Idempotent.
  • Design for failure (Everything that can fail, will fail).

Don't:

  • Don't rely on synchronous HTTP calls for Sagas (What if the network drops in the middle?). Use Message Queues or Persistent Orchestrators (Temporal).

Tools

  • Temporal.io: Workflow engine for code-based orchestration.
  • MassTransit (C#): Built-in Saga state machines.

References

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.