rust-async-internals

Explain Rust async internals and diagnose misbehaving async code.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/awfixers-stuff/opencode-config --skill rust-async-internals-awfixers-stuff
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: rust-async-internals
Source: https://github.com/awfixers-stuff/opencode-config/tree/main/skills/rust-async-internals
Command: npx skills add https://github.com/awfixers-stuff/opencode-config --skill rust-async-internals-awfixers-stuff

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps engineers understand the Rust async/await execution model and diagnose runtime issues such as stuck or slow tasks, waker leaks, incorrect Pin/Unpin usage, and accidental blocking in asynchronous contexts.

Core Features & Use Cases

  • Explains the Future trait and poll loop, how .await drives polling, and what Ready vs Pending means for task scheduling.
  • Clarifies Pin and Unpin semantics for self-referential state machines and shows safe patterns for pinning on heap or stack.
  • Guides tokio task usage including spawn, spawn_blocking, LocalSet, and cooperative yielding; explains common blocking pitfalls.
  • Shows how to use tokio-console to inspect async tasks, interpret poll times and wake counts, and locate blocking or long-running tasks.
  • Diagnoses select! and join! concurrency semantics and typical surprises like dropped futures, biased select behavior, and when to fuse futures.
  • Use cases: debugging a task that never completes, fixing waker leaks, migrating blocking code to spawn_blocking or async equivalents, and improving latency in a tokio-based service.

Quick Start

Ask the skill to analyze why a specific async function blocks or wakes excessively and provide code-level fixes plus steps to inspect the behavior with tokio-console.

Frequently Asked Questions about rust-async-internals

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How does the Rust Future poll model work and why does my async task never complete?▼

The Rust Future poll model drives async tasks by repeatedly calling poll until it returns Ready, scheduling them again when Pending. This skill diagnoses why a tokio task never completes by explaining the poll loop, waker mechanics, and providing code-level fixes for stuck futures.

How do I debug async stack traces and find blocking tasks in tokio?▼

Debug async stack traces and find blocking tokio tasks by using tokio-console to inspect poll times and wake counts. This skill guides you through interpreting tokio-console output to locate long-running tasks and migrate blocking code to spawn_blocking.

What is the correct way to use Pin and Unpin for self-referential state machines in Rust async code?▼

Pin and Unpin manage self-referential state machines in Rust async code by preventing moved references after polling starts. This skill clarifies Pin semantics and shows safe patterns for pinning futures on the heap or stack without causing undefined behavior.

Why does my tokio select! macro drop futures and how can I fix biased behavior?▼

The tokio select! macro drops pending futures when one branch completes and evaluates branches in declaration order when biased. This skill diagnoses select! and join! concurrency surprises, showing when to fuse futures to prevent losing in-progress task state.

How do I fix a waker leak causing excessive wake-ups in my Rust async runtime?▼

Fix a waker leak causing excessive wake-ups in Rust async code by tracing how the Waker is stored and invoked during the poll cycle. This skill provides reproduction steps and remediation examples to correct waker handling and improve tokio task latency.

When should I use spawn_blocking instead of regular async functions in tokio?▼

Use spawn_blocking in tokio when running synchronous CPU-bound or I/O operations that would otherwise stall the async runtime. This skill explains cooperative yielding, LocalSet usage, and how to migrate blocking code without starving other async tasks.