No slash command · from fuse-rust
Guides writing async Rust on tokio: spawning/supervising tasks, choosing channels vs mutexes, shared-state primitives, and fixing Send-bound errors with async traits.
Ships in fuse-rust. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
It also covers the async-fn-in-traits Send problem — why async fn in traits does not give
Send futures by default and how to work around it.
Out of scope: HTTP service structure (routing, extractors, middleware) is owned by rust-web-backend; sync-only ownership and borrowing questions belong to rust-core-language.
Before writing async code, spawn in parallel:
After writing, run fuse-ai-pilot:sniper.
| Runtime | Reality |
|---|---|
| tokio | The de-facto standard. Almost every async crate (axum, sqlx, reqwest, tonic) targets it. Default choice. |
| async-std | Niche, effectively in maintenance mode. Do not pick for new work. |
| smol | Niche, small/embeddable. Only for constrained or embedded contexts. |
Default to tokio unless a hard constraint says otherwise.
std::sync::Mutex first — it is faster. Reach for tokio::sync::Mutex ONLY when the guard must be held across an .await. Otherwise scope the guard so its destructor runs before the await.Arc<Mutex<T>> is not the default — analyze contention first. Read-dominated → RwLock; a simple counter → atomics; work that is itself async → a task + message passing.JoinHandle you care about — a dropped tokio::spawn handle silently swallows the task's panic/error. .await it, or use JoinSet/tracing to surface failures.spawn_blocking for heavy sync work — CPU-bound loops or blocking I/O (std file, blocking DB driver) starve the runtime if run on an async worker. Offload them.Send across .await — everything held across an await point must be Send for tokio::spawn. A std::sync::MutexGuard is NOT Send; holding one across an await is a compile error (and async-mutex guards that are Send deadlock instead).| Topic | Reference | When to Consult |
|---|---|---|
| Runtime & tasks | runtime-and-tasks.md | spawn, JoinHandle, JoinSet, spawn_blocking, 'static bound |
| Shared state | shared-state.md | Choosing Mutex vs RwLock vs atomics vs actor task |
| Channels | channels.md | Picking mpsc / oneshot / broadcast / watch |
| Async traits | async-traits.md | async fn in traits + the Send-bound problem |
| Template | When to Use |
|---|---|
| task-patterns.md | Concurrent tasks, JoinSet, actor pattern, spawn_blocking |
| graceful-shutdown.md | Cancellation, shutdown signal, draining tasks |
.await// GOOD: lock released before the await
{
let mut db = state.lock().unwrap();
db.insert(key, value);
} // guard dropped here
do_async_work().await;
→ See shared-state.md
// one value back to a caller → oneshot
// many producers, one consumer → mpsc
// fan-out same value to all → broadcast
// latest-value-only state → watch
→ See channels.md
.await handles, or collect them with JoinSet.spawn_blocking.tokio::sync::Mutex by reflex — it wraps a sync mutex internally and rarely helps throughput.tokio::spawn whose result or panic matters.async fn in traits gives you Send futures — it does not (see async-traits.md).references/async-traits.md (opens in a new tab)references/channels.md (opens in a new tab)references/runtime-and-tasks.md (opens in a new tab)references/shared-state.md (opens in a new tab)references/templates/graceful-shutdown.md (opens in a new tab)references/templates/task-patterns.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
7 skills in this plugin
/rust-core-languageUse when writing or reviewing idiomatic Rust — edition 2024 ownership/borrowing design, or fixing LLM pitfalls (clone tax, unwrap infestation, indexed loops). Not for error-type design (rust-error-handling) or SOLID layout (solid-rust)./rust-ecosystem-cratesUse when choosing crates for a Rust project — serialization, CLI, async runtime, web, database, HTTP client, error handling, observability. Not for API usage details of an already-chosen crate./rust-error-handlingUse when designing Rust error handling — thiserror vs anyhow, typed error enums,npx claudepluginhub fusengine/claude-plugins --plugin fuse-rustOther plugins' skills for the same job