agentleFS
lgzarturolgzarturo/codeconductor/.agents/skills/rust-async/SKILL.md

rust-async

Skill0 starsChanged 26 days agoMITView on GitHub

Rust async with tokio or async-std: guards across await, detached tasks, blocking work, cancellation and shutdown. Trigger: When writing or reviewing async Rust in a package that declares tokio or async-std.

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do not change runtime flavor or add features without a Task Card line.

    line 50

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Rust async

Activation

Apply when the owning package declares tokio or async-std as a normal dependency and the change touches async fn, .await, spawn or channels.

Inputs

  • Declared runtime, its features (rt, rt-multi-thread, sync, time).
  • Existing shutdown path (CancellationToken, signal handler, JoinSet).

Procedure

  1. Guards across await (rust.guard-across-await). Condition: a std::sync::MutexGuard/RwLock guard or RefCell borrow is live at an .await. Action: scope the guard in a block that ends before the await, or copy out the data. Use tokio::sync::Mutex only when the lock must be held across the await. Exception: none for std guards (the future becomes !Send or can deadlock). Verify: cargo check; a Send bound compile error on spawn is the signal.
  2. Detached tasks (rust.detached-task). Condition: spawn result is dropped. Action: dropping a JoinHandle detaches the task; keep the handle or use a JoinSet, and decide who observes panics and errors. Exception: fire-and-forget with logged failure and no shutdown dependency. Verify: each spawn has an owner that is awaited or aborted at shutdown.
  3. Blocking work. Condition: CPU-heavy or blocking I/O inside async code. Action: tokio::task::spawn_blocking. Exception: work shorter than a scheduling quantum. Verify: no std::thread::sleep or blocking std::fs/std::net call in an async fn.
  4. Cancellation. Condition: a future may be dropped at any .await. Action: keep state consistent at every await; use cancel-safe operations in select!. abort() does not stop a spawn_blocking task that already started. Exception: none. Verify: a test that drops the future mid-operation.
  5. Shutdown. Condition: the service owns tasks. Action: signal, then await handles with a timeout. Started spawn_blocking tasks run to completion, so bound their runtime. Verify: a test or run that shuts down without hanging.

Decisions and exceptions

  • Do not change runtime flavor or add features without a Task Card line.
  • async-std and tokio APIs differ; follow the declared runtime only.
  • Unbounded channels need a stated reason; default to bounded.

Evidence

cargo test -p <package> with the exit code, plus the named test that drops or aborts the future. Report unverified cancellation paths as unverified.

References

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.