rust-async-conventions
Installation
SKILL.md
Rust Async Conventions
Apply these conventions in async Rust projects. These rules are written for any coding agent, including Claude Code, Codex, Cursor, and Copilot.
Async Fundamentals
- An
async fnreturns aFuture; it does nothing until awaited or driven by an executor. - Do not call an async function without awaiting or spawning it.
- Use
.await, notblock_on, inside async contexts. - Use
async moveblocks when a future must own captured values and outlive the current scope.
Lifetimes in Async
- A future returned by an
async fnborrows its non-'staticarguments. - Await such futures while their borrowed arguments remain valid.
- When lifetime issues arise, move owned arguments into an
asyncblock. - Futures passed to
tokio::spawnor similar APIs must be'static; move owned data in or useArc.