rust-idempotent-workflows
Use when designing, implementing, testing, or debugging Rust service workflows that must be safe under retries, duplicate requests, crashes, concurr…
它会碰到什么
这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。
技能内容
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.
想直接用这个技能?
本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。
它属于哪个仓库
plugins/LVTD-LLC/skills/skills/rust-idempotent-workflows/SKILL.md