resonate-saga-pattern-typescript
Installation
SKILL.md
Resonate Saga Pattern (TypeScript)
Overview
The Saga pattern coordinates long-running distributed transactions by breaking them into smaller, isolated steps with compensating actions. If any step fails, the saga executes compensation logic to undo completed steps, maintaining eventual consistency without distributed locks or two-phase commits.
Core principle: Each step has a forward action (transaction) and a compensating action (rollback). On failure, compensations execute in reverse order to restore consistency.
Mental Model
Forward Execution (Happy Path):
Step 1 → Step 2 → Step 3 → Success
Failure with Compensation:
Step 1 ✓ → Step 2 ✓ → Step 3 ✗
↓
Compensate 2 → Compensate 1 → Saga Failed (Consistent)