Use when reviewing UI for accessibility — WCAG 2.2 AA, keyboard nav, focus, ARIA, contrast, screen-reader semantics — even on 'is this a11y-OK?' or 'mach das barrierefrei'.
日本語の概要は準備中です。原文の説明を表示しています。
When writing Python asyncio code — picking between gather / TaskGroup / wait, structured concurrency, timeouts, cancellation, sync-bridging — decision framework only, cookbook externalized.
インストール方法を見るインストールする前に、エージェントに与えられる指示の中身を確認できます。
Decision framework for picking the right Python asyncio primitive. The pattern cookbook lives upstream (links in § Provenance) — this skill is the predicate, not the recipe library. Sunset-policy compliant: the 600+ lines of language-specific cookbook stay in authoritative Python docs.
asyncio.gather, asyncio.create_task, TaskGroup, as_completed, or wait_for.Do NOT use when:
await — read the upstream tutorial directly.Workload is:
I/O-bound, many concurrent waits → async fits (network, disk, IPC).
CPU-bound (parsing, math, crypto) → async is wrong; use ProcessPoolExecutor.
Mixed → async shell + run_in_executor for CPU bursts.
Single sequential call → don't introduce async; sync is simpler.
Run N independent coroutines, ALL must complete:
Same trust level, exceptions cancel siblings → asyncio.TaskGroup (3.11+; preferred).
Pre-3.11 OR exceptions must NOT cancel peers → asyncio.gather(*, return_exceptions=...).
Run N coroutines, react to results as they finish:
→ asyncio.as_completed (yields completed futures in finish order).
Run N coroutines, race to first success / failure:
→ asyncio.wait(..., return_when=FIRST_COMPLETED) + cancel pending.
Schedule fire-and-forget background work:
→ asyncio.create_task + keep a strong reference (else GC eats it).
Forgetting the reference is the #1 silent-failure source.
Bound the wait time:
→ asyncio.wait_for(coro, timeout=...) → raises TimeoutError on expiry.
→ asyncio.timeout(...) context manager (3.11+; preferred when many awaits share a deadline).
Bound concurrency (rate-limit, connection pool):
→ asyncio.Semaphore(n); acquire around the awaitable.
Async code calls sync, blocking, function:
Short pure-CPU → fine, accept the block (microseconds).
Long, blocking, or I/O-sync → await loop.run_in_executor(None, fn, *args).
Library has async sibling → switch the library (httpx vs requests, aiosqlite vs sqlite3).
Sync code calls async function:
Top-level entrypoint → asyncio.run(coro()).
Inside running loop → never asyncio.run; create_task + await it.
Test suite → pytest-asyncio fixture; never raw run() in tests.
Every long-running coroutine MUST be cancellation-safe:
asyncio.CancelledError, perform cleanup, re-raise. Swallowing it silently breaks the propagation chain.try / finally (or async with) around resource acquisition so cancellation cannot leak file handles, DB connections, locks.create_task without a strong reference is undefined behavior; either store the task or use a TaskGroup.A single blocking call (sync I/O, time.sleep, CPU-heavy parse, large JSON load) freezes every coroutine. Audit every leaf function under async def:
await asyncio.sleep, never time.sleep.httpx.AsyncClient / aiohttp, never requests.asyncpg / aiosqlite / motor, never the sync driver.aiofiles for hot-paths, or run_in_executor for one-shots.await site, sync↔async boundary, and any blocking leaf calls before touching code.await site with its primitive (Step 2).asyncio.run inside an already-running loop (Jupyter, FastAPI startup) raises RuntimeError. Use await directly or nest_asyncio (last resort).asyncio.gather swallows the second exception silently; use return_exceptions=True and inspect, or use TaskGroup (cancels all on first error, surfaces the group).create_task results that nobody awaits look fine until the program exits and Python prints Task was destroyed but it is pending!. Always await or use a TaskGroup.wait_for on a non-cancellation-safe coroutine leaks resources; the timeout cancels the task but cleanup never runs.requests-async) often re-block the loop under load; verify with the cited upstream library docs, not the README.asyncio.run from a running loop.CancelledError without re-raising.run_in_executor.create_task without storing the reference (or using TaskGroup).error-handling-patterns, mcp-builder, api-design, performance.agents/settings/contexts/skills-provenance.yml (entry: async-python-patterns).verify-before-complete, skill-quality, non-destructive-by-default.まだレビューはありません。使ってみた感想をお寄せください。
概要と使いどころ
Use when reviewing UI for accessibility — WCAG 2.2 AA, keyboard nav, focus, ARIA, contrast, screen-reader semantics — even on 'is this a11y-OK?' or 'mach das barrierefrei'.
日本語の概要は準備中です。原文の説明を表示しています。
Use when defining or auditing the activation event — aha-moment selection, retention correlation, falsifiable definition. Triggers on 'what is our aha moment', 'redefine activation'.
日本語の概要は準備中です。原文の説明を表示しています。
Use when capturing an architectural decision — file naming, next ADR number, Status / Context / Decision / Consequences, index regen; fires even without saying 'ADR'.
日本語の概要は準備中です。原文の説明を表示しています。
Adversarial critique — devil's advocate, stress-test, honest teardown ('poke holes', 'be brutal', 'was hältst du davon'); explicit request only. Routine code or design review → code-review.
日本語の概要は準備中です。原文の説明を表示しています。
Use when reading, creating, or updating agent documentation, module docs, roadmaps, or AGENTS.md. Understands the full .augment/, agents/, and copilot-instructions structure.
日本語の概要は準備中です。原文の説明を表示しています。
Use for an adversarial red-team / blue-team / auditor review of an AI agent's CONFIG + behaviour (rules, skills, MCP, hooks, permissions) — attack-chain → defensive-gap list, not a code audit.
日本語の概要は準備中です。原文の説明を表示しています。