resonatehq/resonate-skills/resonate-saga-pattern-rust
Claude Code and agent skill by resonatehq/resonate-skills
- community
Checking that the SKILL.md file is still in the repository.
Implement saga patterns for distributed transactions in Rust with Resonate — forward steps with compensating actions that unwind on failure using Result<T> and match-based compensation dispatch. Use when coordinating multi-step Rust workflows that need consistency across failures. SDK in active development (0.6.0 on crates.io); API surface may change between releases.
Install
npx vskill@latest install resonatehq/resonate-skills/resonate-saga-pattern-rustSKILL.md
Resonate Saga Pattern — Rust
SDK note (0.6.0). The Rust SDK is in active development. The saga pattern below uses only documented surface (ctx.run,Result<T>,?propagation). Verify against the current SDK source before shipping.
Overview
A saga is a long-running transaction split into smaller steps, each with a compensating action. Forward steps run top-to-bottom; on failure, compensations run bottom-to-top. Rust expresses this naturally via Result<T> + ? for forward propagation and a tracked "completed" list for compensation dispatch.
For the language-agnostic mental model, see resonate-saga-pattern-typescript.
When to use
- Multi-step workflow where intermediate state is visible to other systems
- Each step is idempotent or inexpensive to retry individually
- Compensation logic exists for every committed step
- You need "all or nothing" consistency without a distributed transaction
Basic shape
Each forward step is a durable checkpoint. If the worker crashes mid-saga, Resonate resumes from the last successful yield (in Rust, the last successful .await?).
Compensation must be retryable
A compensation that fails stalls the saga in an inconsistent state:
If a compensation exhausts its timeout/retry, you have a real inconsistency — log and alert.
Explicit step objects via enum dispatch
Rust's enum + match is idiomatic for a small, closed set of saga steps:
For large sets of dynamic steps, prefer Vec<Box<dyn StepTrait>> — but that adds dyn-trait complexity beyond the basic pattern.
Distinct Rust idioms
- `Result<T>` + `?` handles forward-path propagation naturally — no
try/exceptneeded for "raise on first error" - Explicit `let result = ... .await` + `match` for the catch-and-compensate branch, since
?would bail before compensation runs - `completed.iter().rev()` for reverse iteration — idiomatic Rust, no
reversed()builtin needed - `enum` + `match` for compensation dispatch — cleaner than string-based switches
- `(Step, String)` tuple parameter to bundle args into a single serializable input for
ctx.run— the SDK serializes the whole argument, so tuples work naturally - `Clone` derive on step enums — needed because
iter().rev()borrows and compensation needs owned values
Avoid
- Panicking inside a durable function (
panic!,unreachable!,assert!) — panics don't compensate; useResultexplicitly - Non-idempotent compensations — each compensation may retry
- Compensations that read the SoR without a fresh
ctx.run— the read happens inside a leaf for checkpointing
Related skills
resonate-basic-durable-world-usage-rust—ctx.run, builder options, function kindsresonate-recursive-fan-out-pattern-rust— parallel fan-out, can be combined with sagasdurable-execution— foundational replay semanticsresonate-saga-pattern-typescript/-python— sibling SDKs for comparison
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingresonate-saga-pattern-rust/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/resonatehq/resonate-skills/resonate-saga-pattern-rust)