skills/ozerohax/assistagents/coder-rust-tokio

coder-rust-tokio

SKILL.md

<skill_overview> Build reliable async services on the Tokio runtime Starting or configuring the Tokio runtime Spawning concurrent tasks Applying timeouts and cancellation Using async channels and synchronization Mixing blocking and async work Tokio GitHub Tokio Docs </skill_overview> Use #[tokio::main] only in binaries Avoid creating multiple runtimes in one process Pick multi_thread for servers, current_thread for CLI Use tokio::spawn for concurrent async tasks Always handle JoinHandle results Prefer JoinSet for managing many tasks let handle = tokio::spawn(async move { do_work().await }); let result = handle.await?; <timeouts_and_cancellation> Wrap external calls with tokio::time::timeout Use tokio::select! for cancellation paths Propagate cancellation by dropping senders let res = tokio::time::timeout(Duration::from_secs(2), call()).await; </timeouts_and_cancellation> Use bounded channels for backpressure Pick mpsc for work queues, oneshot for single reply Handle closed channels without panic <blocking_work> Never call blocking code on async runtime threads Use spawn_blocking for CPU-bound or blocking I/O Prefer tokio::fs and tokio::net for async I/O </blocking_work> <anti_patterns> Avoid std::thread::sleep in async code Avoid spawning tasks without tracking them Avoid blocking calls inside async handlers </anti_patterns>

Weekly Installs
2
GitHub Stars
25
First Seen
Feb 4, 2026
Installed on
opencode2
gemini-cli2
replit1
zencoder1
amp1
openclaw1