dev/skills/csa-async-debug/SKILL.md
Expert diagnosis for Tokio/async Rust issues including deadlocks, task leaks, performance bottlenecks, and cancellation safety
npx skillsauth add ryderfreeman4logos/cli-sub-agent csa-async-debugInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Expert diagnosis for Tokio/async Rust issues: deadlocks, task leaks, performance bottlenecks, and cancellation safety.
// WRONG: Blocking in async context
async fn bad() {
std::thread::sleep(Duration::from_secs(1)); // Blocks entire thread
std::fs::read_to_string("file"); // Sync I/O blocks
}
// CORRECT
async fn good() {
tokio::time::sleep(Duration::from_secs(1)).await;
tokio::fs::read_to_string("file").await;
tokio::task::spawn_blocking(|| expensive_cpu_work()).await;
}
// WRONG: Holding lock across await
async fn deadlock() {
let lock = mutex.lock().await;
some_async_fn().await; // Holding lock!
drop(lock);
}
// CORRECT: Release lock before await
async fn safe() {
let data = {
let lock = mutex.lock().await;
lock.clone()
}; // Lock released here
some_async_fn().await;
}
// WRONG: Spawned task not tracked
fn leak() {
tokio::spawn(async { ... }); // Lost handle = leak
}
// CORRECT: Use JoinSet for multiple tasks
let mut set = JoinSet::new();
set.spawn(task1());
set.spawn(task2());
while let Some(result) = set.join_next().await { ... }
// WRONG: Cancellation corrupts state
async fn unsafe_cancel() {
file.write_all(header).await?;
// If cancelled here, file is incomplete!
file.write_all(body).await?;
}
// CORRECT: Use atomic operations
async fn safe_cancel() {
let temp = create_temp_file().await?;
temp.write_all(data).await?;
temp.rename(target).await?; // Atomic rename
}
# Cargo.toml: console-subscriber = "0.2"
# main.rs: console_subscriber::init();
# Run: RUSTFLAGS="--cfg tokio_unstable" cargo run
# Monitor: tokio-console
let metrics = tokio::runtime::Handle::current().metrics();
println!("Active tasks: {}", metrics.active_tasks_count());
println!("Blocking threads: {}", metrics.num_blocking_threads());
std::thread::sleep() (use tokio::time::sleep().await).awaitJoinHandles tracked and awaitedselect! branches are cancellation-safespawn_blocking()tools
--- name = "csa-setup" version = "0.1.0" description = "Install CSA, Weave, and coding workflow patterns for AI agent bots" homepage = "https://github.com/RyderFreeman4Logos/cli-sub-agent" target = "agent-bots" --- # CSA Setup > Installation guide for AI agent bots (openclaw, Moltis, etc.) to set up > CSA and Weave with optional coding workflow patterns. ## Skill Files | File | Description | |------|-------------| | **skill.md** (this file) | Installation and setup guide | | **skills/AGENTS.
testing
Use when: converting TODO plan or open GitHub issues into deterministic execution checklist
development
Use when: full dev cycle branch->plan->implement->review->PR->merge
development
Use when: running CSA-driven code review, independent model selection