Audits async and concurrent code across C#, JavaScript/TypeScript, Python, Java/Kotlin, Go, and Rust for deadlocks, blocking calls, leaks, and cancellation bugs. Applies a fixed checklist and rewrites code with explanations.
Ships in AI for Developers Toolkit. 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.
Find async and concurrency bugs (deadlocks, blocked threads or event loops, lost errors, leaks, missing cancellation), then return corrected code with a one-line reason for each fix.
Work directly from whatever target the user gives: a file, a folder, a whole project/repo, or a GitHub URL (clone first: git clone --depth 1 <url> /tmp/repo). Find the async code yourself with Glob/Grep/Bash. Always report which files you scanned; if it's clean, say so plainly instead of inventing issues. Group findings by file.
| Manifest | Stack | What "async" means there |
|---|---|---|
*.csproj / *.sln | C# / .NET | Task, async/await, thread pool, sync context |
package.json | JS / TS (Node, Bun, Deno, browser) | Promises on a single-threaded event loop |
pyproject.toml / requirements*.txt | Python | asyncio event loop (or trio/anyio), plus threads |
pom.xml / build.gradle(.kts) | Java / Kotlin | CompletableFuture, executors, virtual threads, coroutines, Reactor |
go.mod | Go | goroutines, channels, context.Context |
Cargo.toml | Rust | async fn on an executor (usually tokio) |
Also establish where the code runs (web request, background worker, library, UI, CLI). Deadlock and blocking risk depend on it. Ask only if you can't tell from the code.
Sweep: grep -rn "\.Result\b\|\.Wait()\|GetAwaiter().GetResult()\|async void\|Task.Run\|Thread.Sleep" --include=*.cs <target> | grep -v "/obj/\|/bin/"
.Result, .Wait(), .GetAwaiter().GetResult()) - deadlocks under a sync context, starves the thread pool otherwise. Fix: async all the way and await. At a sync boundary you truly can't change, isolate it and document why.async void - exceptions crash the process and can't be awaited. Fix: return Task. Event handlers are the only exception; keep them thin with try/catch._ = DoAsync();) in request scope - exceptions vanish and work dies with the request. Fix: await, or hand off to BackgroundService / Channel<T> / a queue.CancellationToken - accept it and pass it to the deepest call (EF, HttpClient, etc.). ASP.NET Core binds the action's CancellationToken to request abort.ConfigureAwait(false) - use it in library code; don't litter it through ASP.NET Core app code (no sync context there).return SomeAsync(); is fine for a one-liner, but NOT inside using/try, where it changes when disposal and exception handling happen.await Task.WhenAll(...). A single DbContext is NOT thread-safe: never parallelize queries on one context.Task.Run to "make it async" - wastes a pool thread on the server. Call the async API directly; reserve Task.Run for CPU-bound work off a UI thread.Action is expected (list.ForEach(async x => ...)) - silently becomes async void. Use a loop with await or Task.WhenAll(list.Select(async x => ...)); bound concurrency with Parallel.ForEachAsync or SemaphoreSlim.Thread.Sleep -> await Task.Delay; lock around an await is a compile error, so use SemaphoreSlim.WaitAsync().ValueTask misuse - await it exactly once, immediately; never store or double-await. Use only on proven hot paths that often complete synchronously.Sweep: grep -rnE "forEach\(async|\.then\(|new Promise\(|readFileSync|execSync" --include=*.{ts,js} <target> | grep -v node_modules. Recommend @typescript-eslint/no-floating-promises and no-misused-promises to catch these permanently.
await, return, or .catch. Errors become unhandled rejections (Node terminates the process on them by default since v15).array.forEach(async ...) - forEach ignores the returned promises; nothing is awaited. Use for...of with await (sequential) or await Promise.all(items.map(async ...)) (concurrent).await in a loop for independent work - use Promise.all; use Promise.allSettled when one failure shouldn't discard the rest. Bound large fan-outs (e.g. p-limit or chunking).*Sync fs/crypto/child_process calls, huge JSON.parse, tight CPU loops on a request path. Move to async APIs or a worker_threads worker.AbortSignal (AbortController, AbortSignal.timeout(ms)) to fetch and other abortable APIs, and propagate it through your own functions.new Promise; a throw inside an async executor is lost. Return the promise directly..then() chains and await in one function - pick one; return await inside try is needed to catch the rejection there.Sweep: grep -rnE "time\.sleep|requests\.|open\(|create_task|run_until_complete|asyncio\.run" --include=*.py <target>
async def - time.sleep, requests, sync DB drivers, heavy CPU. They freeze the whole loop. Use await asyncio.sleep, httpx.AsyncClient/aiohttp, async drivers, or await asyncio.to_thread(fn, ...) for unavoidable sync calls.await - the coroutine never runs ("coroutine was never awaited" warning). Run tests with warnings as errors to catch it.asyncio.create_task(...) result - the loop keeps only a weak reference, so the task can be garbage-collected mid-flight and its exception is never seen. Keep a reference, or use asyncio.TaskGroup (3.11+).gather without error strategy - by default the first exception propagates but the other tasks keep running. Prefer TaskGroup (cancels siblings on failure) or handle return_exceptions=True results explicitly.except Exception is fine, but catching BaseException/bare except: or not re-raising asyncio.CancelledError breaks shutdown and timeouts. Use asyncio.timeout() (3.11+) or asyncio.wait_for for deadlines.gather(*[fetch(u) for u in urls]) over thousands of URLs. Limit with asyncio.Semaphore.Session inside FastAPI async def) - use the async session, or make the endpoint a plain def so the framework runs it in a threadpool.Sweep: grep -rnE "\.join\(\)|\.get\(\)|supplyAsync|runAsync|synchronized|newVirtualThreadPerTaskExecutor|runBlocking|GlobalScope" <target>/src
CompletableFuture.join()/get() inside another async stage or on a small pool can deadlock and starves the pool. Compose with thenCompose/thenCombine/allOf, and block only at the outermost edge, with a timeout (get(timeout, unit) or orTimeout).supplyAsync(task) without an executor runs blocking I/O on ForkJoinPool.commonPool(). Pass a dedicated executor for I/O.exceptionally/handle/whenComplete or make sure the result is observed.synchronized (or native frames) pins the carrier thread; replace with ReentrantLock on hot paths. JDK 24 (JEP 491) removed most synchronized pinning. Diagnose with the jdk.VirtualThreadPinned JFR event. Don't pool virtual threads; limit concurrency with a Semaphore instead.ThreadLocal caches multiply with millions of virtual threads; MDC/security context must be propagated to async stages explicitly.GlobalScope.launch leaks work outside structured concurrency; runBlocking inside a coroutine or request thread blocks it; blocking calls belong in withContext(Dispatchers.IO); don't swallow CancellationException.block(), JDBC) stalls the event loop; offload with subscribeOn(Schedulers.boundedElastic()). BlockHound can detect it in tests.Sweep: grep -rnE "go func|context\.Background\(\)|WaitGroup|time\.Sleep|make\(chan" --include=*.go <target>. Run tests with go test -race; consider go.uber.org/goleak for leak checks.
select on ctx.Done(), and make every goroutine's exit path explicit.-race finds them.context.Context - context.Background()/TODO() deep in request code, or a ctx parameter never passed to DB/HTTP calls. Thread the request context through; set deadlines with context.WithTimeout and always defer cancel().WaitGroup misuse - wg.Add inside the goroutine (race with Wait), missing defer wg.Done(), or errors dropped. Prefer golang.org/x/sync/errgroup (errgroup.WithContext, g.SetLimit(n)) for fan-out with errors and cancellation.errgroup.SetLimit, a worker pool, or a semaphore channel.go directive in go.mod.std::thread::sleep, std::fs, sync HTTP clients, or heavy CPU inside async fn blocks an executor worker. Use tokio::time::sleep, tokio::fs, async clients, or tokio::task::spawn_blocking.std::sync::Mutex guard across .await - can deadlock and makes the future !Send. Drop the guard before awaiting (scope it), or use tokio::sync::Mutex when the lock must span an await.tokio::spawn - a dropped JoinHandle hides panics and errors. Keep handles or use JoinSet.tokio::select! branches can be dropped mid-way; make sure the dropped branch doesn't lose data. Use tokio::time::timeout for deadlines.## Summary
<stack + runtime detected; headline issues and the deadlock / starvation / leak risk, if any>
## Findings
🔴 [Sync-over-async] <file:line> - <why it's a bug> -> <fix>
🟡 [Missing cancellation] ... -> ...
## Corrected code
<rewritten, ready to paste>
## Notes
<behavior changes, anything the caller must also update>
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
TypeScript, JavaScript, Python, Go, Rust, Java, Kotlin, C#
/ai-dev-toolkit:async-await-auditorfrom AI for Developers Toolkit
npx claudepluginhub stefanthecode/ai-for-developers --plugin ai-dev-toolkit45 skills in this plugin
/api-endpoint-scaffolderScaffold HTTP API endpoints in any stack - ASP.NET Core Minimal APIs or controllers, Express, Fastify, NestJS, FastAPI, Django REST Framework, Spring Boot controllers, Go net/http, chi, Gin - one feature per endpoint (REPR style) with request validation, typed responses, route grouping, auth, and OpenAPI metadata. Use this skill whenever the user wants to add an endpoint or route, convert controllers to minimal APIs, structure routes or routers, set up endpoint groups, TypedResults, route handlers, request DTOs/schemas (zod, Pydantic, Bean Validation, binding tags), or asks "how do I add an endpoint / structure my API routes". Always use this skill for endpoint scaffolding; it generates a complete, validated endpoint that matches the project's conventions./architecture-test-generatorGenerate architecture tests / fitness functions that fail the build when architectural rules are violated - layer dependencies, module boundaries, cycles, naming, and visibility conventions - in any stack: NetArchTest or ArchUnitNET (.NET), ArchUnit or Konsist (Java/Kotlin), dependency-cruiser or eslint-plugin-boundaries (TypeScript/JavaScript), import-linter (Python), go-arch-lint or depguard (Go). Use this skill whenever the user wants architecture tests, to enforce layering or the dependency rule, dependency rules as tests, import rules, forbidden imports, no circular dependencies, naming conventions, fitness functions, or asks "how do I stop people breaking the architecture / enforce my layers / keep modules from importing each other". Always use this skill for architecture-test requests; it generates rules matching the project's real structure.Other plugins' skills for the same job