rust-idempotent-workflows
Use when designing, implementing, testing, or debugging Rust service workflows that must be safe under retries, duplicate requests, crashes, concurrent submissions, background workers, queues, email/payment/notification side effects, idempotency keys, transaction isolation, or save-and-replay API behavior.
- License 许可
- MIT
- 最近更新
- 2026-06-26
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- rust-idempotent-workflows
- license
- MIT
- metadata
- { "tags": "rust,idempotency,retries,background-jobs,concurrency", "version": "0.1.0", "category": "Rust", "displayName": "Rust Idempotent Workflows" }
- description
- Use when designing, implementing, testing, or debugging Rust service workflows that must be safe under retries, duplicate requests, crashes, concurrent submissions, background workers, queues, email/payment/notification side effects, idempotency keys, transaction isolation, or save-and-replay API behavior.
- compatibility
- Codex, Claude Code, and other Agent Skills-compatible clients.
02 资源文件 4
- 参考文档agents/openai.yaml194 B
- 参考文档references/background-workers.md1.3 KB
- 参考文档references/concurrency.md1.2 KB
- 参考文档references/idempotency.md1.3 KB
03 SKILL.md 正文
Rust Idempotent Workflows
Use this skill to make Rust workflows reliable when clients retry, workers crash, requests race, and external side effects cannot be rolled back.
Core Workflow
- Write the failure story before writing code. List what happens if the process crashes after each database write and after each external side effect.
- Identify the idempotency boundary: HTTP endpoint, command handler, queue job, webhook, or external callback.
- Choose the idempotency strategy:
- Natural idempotency from a unique business key.
- Client-provided idempotency key with save-and-replay.
- Server-generated deduplication key.
- Outbox or queue table for side effects.
- Put state transitions and idempotency records in the same transaction when they must agree.
- Make duplicate concurrent requests deterministic. Use unique constraints, locks, serializable transactions, or explicit conflict handling.
- Treat external side effects as at-least-once unless the provider guarantees more. Store enough state to retry or reconcile.
- Add tests for duplicate requests, retry after timeout, concurrent requests, crash windows when practical, and worker retry behavior.
Idempotency Key Rules
Read references/idempotency.md before adding idempotency keys or save-and-
replay behavior.
- Bind the key to the authenticated user or tenant.
- Store a hash of the request payload when replaying responses.
- Return the original response for exact replays.
- Reject reuse of the same key with a different payload.
- Expire records only after product and provider retry windows have passed.
Background Work Rules
Read references/background-workers.md when adding queue tables, polling
workers, retries, or external side effects.
- Commit durable intent before sending external effects.
- Use
pending,in_progress,succeeded, andfailedstates deliberately. - Keep retry counts, next-attempt timestamps, and last error summaries.
- Make workers safe to run in multiple processes.
Concurrency Rules
Read references/concurrency.md when duplicate requests, locks, isolation
levels, or unique constraints are part of the fix.
Use the database as the source of truth for deduplication when multiple app instances can process the same workflow.
Reference Files
references/idempotency.md: idempotency keys, save-and-replay, and request payload binding.references/background-workers.md: queue tables, worker loops, retry boundaries, and outbox behavior.references/concurrency.md: lock choices, transaction isolation, and duplicate request tests.
04 同仓库更多 Skills
android-emulator-qa
Use when validating Android feature flows in an emulator with adb-driven launch, input, UI-tree inspection, screenshots, and logcat capture.
supabase-postgres-best-practices
Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.
sentry
Use when the user asks to inspect Sentry issues or events, summarize recent production errors, or pull basic Sentry health data via the Sentry API; perform read-only queries with the bundled script and require `SENTRY_AUTH_TOKEN`.
render-workflows
Sets up, develops, tests, and deploys Render Workflows. Covers first-time scaffolding (via CLI or manual), SDK installation (Python or TypeScript), task patterns (retries, subtasks, fan-out), local development, Dashboard deployment, and troubleshooting. Use when a user wants to set up Render Workflows for the first time, scaffold a workflow service, add or modify workflow tasks, test workflows locally, or deploy workflows to Render.
render-web-services
Configures Render web services—port binding, TLS, health checks, custom domains, auto-deploy, PR previews, persistent disks, and deploy lifecycle. Use when the user needs to set up a web service, fix health check failures, add a custom domain, configure zero-downtime deploys, or troubleshoot port binding issues.
render-static-sites
Deploys and configures static sites on Render's global CDN—build commands, publish paths, SPA routing, redirects, custom headers, and PR previews. Use when the user needs to deploy a static site, set up a React/Vue/Hugo/Gatsby frontend, configure SPA fallback routing, add redirect rules, customize response headers, or choose between a static site and a web service for their frontend. Trigger terms: static site, CDN, SPA, single-page app, React deploy, Vue deploy, Hugo, Gatsby, Docusaurus, Jekyll, staticPublishPath.