スキル async-python-patterns

async-python-patterns

安全 ⚙️ 外部コマンド🌐 ネットワークアクセス📁 ファイルシステムへのアクセス

Python-Async-Patterns meistern

こちらからも入手できます: sickn33,wshobson

Der Aufbau von Async-Anwendungen in Python erfordert das Verständnis komplexer Muster für parallele Ausführung, Aufgabenverwaltung und Leistungsoptimierung. Diese Skill bietet umfassende Anleitung zu asyncio-Grundlagen, praxisnahen Mustern und Best Practices für den Aufbau leistungsstarker nicht blockierender Systeme.

対応: Claude Codex Code(CC)
📊 69 十分
1

スキルZIPをダウンロード

2

Claudeでアップロード

設定 → 機能 → スキル → スキルをアップロードへ移動

3

オンにして利用開始

テストする

「async-python-patterns」を使用しています。 How do I prevent blocking the event loop when running CPU-intensive tasks in async Python code?

期待される結果:

  • Use asyncio.to_thread() (Python 3.9+) or loop.run_in_executor() to offload blocking CPU work to a thread pool
  • Never use time.sleep() in async code - use await asyncio.sleep() instead
  • Example pattern: wrap CPU-intensive functions with run_in_executor to keep the event loop responsive

「async-python-patterns」を使用しています。 What is the difference between asyncio.create_task() and asyncio.gather()?

期待される結果:

  • create_task() schedules a single coroutine to run soon, returning a Task object you can await later
  • gather() runs multiple coroutines concurrently and waits for all to complete, returning results as a list
  • Use create_task() when you need to manage individual tasks; use gather() for fire-and-forget concurrent execution

「async-python-patterns」を使用しています。 How do I implement a timeout for an async function that might hang?

期待される結果:

  • Use asyncio.wait_for() to wrap your async call with a timeout value
  • Catch asyncio.TimeoutError to handle timeout scenarios gracefully
  • Example: result = await asyncio.wait_for(async_operation(), timeout=5.0)

セキュリティ監査

安全
v5 • 1/16/2026

Pure educational documentation containing Python asyncio code examples. All static findings are false positives from the analyzer misinterpreting markdown code blocks and documentation text. No executable code, scripts, network calls, file operations, or external commands exist in this skill.

2
スキャンされたファイル
871
解析された行数
3
検出結果
5
総監査数
監査者: claude 監査履歴を表示 →

品質スコア

38
アーキテクチャ
100
保守性
85
コンテンツ
21
コミュニティ
100
セキュリティ
87
仕様準拠

作れるもの

Async-Web-APIs bauen

Lerne Muster für die Erstellung leistungsstarker Async-APIs mit FastAPI, aiohttp oder Sanic

Parallele I/O-Operationen

Implementiere effiziente parallele Datenbank-, Datei- und Netzwerkoperationen ohne Blockierung

Echtzeit-Anwendungen

Entwickle WebSocket-Server, Chat-Systeme und ereignisgesteuerte Anwendungen

これらのプロンプトを試す

Grundlegendes Async-Muster
Show me how to use asyncio.gather() to run multiple async functions concurrently in Python
Fehlerbehandlung
How do I properly handle errors and timeouts when using asyncio.wait_for() in Python
Rate Limiting
Explain how to use asyncio.Semaphore to rate limit concurrent API calls in Python
Producer-Consumer
Show me an example of the producer-consumer pattern using asyncio.Queue for processing items concurrently

ベストプラクティス

  • Verwende immer asyncio.run() als Einstiegspunkt für Async-Programme (Python 3.7+)
  • Nutze asyncio.gather() für die parallele Ausführung unabhängiger Async-Operationen
  • Implementiere korrektes Timeout-Handling mit asyncio.wait_for(), um hängende Operationen zu verhindern

回避

  • Async-Funktionen ohne await aufrufen – das gibt ein Coroutine-Objekt zurück, statt die Funktion auszuführen
  • Blockierende Operationen wie time.sleep() oder CPU-intensive Arbeit direkt im Async-Code verwenden
  • Synchronen und asynchronen Code ohne korrekte Übersetzung mit asyncio.run() mischen

よくある質問

Welche Python-Version ist für asyncio erforderlich?
Python 3.7+ bietet asyncio.run() für einfache Einstiegspunkte. Neuere Versionen fügen Funktionen wie asyncio.to_thread() hinzu.
Was ist die maximale Anzahl gleichzeitiger Tasks?
Die Event Loop kann Tausende von Tasks handhaben. Verwende Semaphoren, um die tatsächliche Parallelität basierend auf Systemressourcen zu begrenzen.
Kann ich asyncio mit FastAPI verwenden?
Ja. FastAPI basiert auf Starlette und unterstützt nativ async/await-Muster für maximale Performance.
Sendet diese Skill Daten an externe Dienste?
Nein. Dies ist eine prompt-basierte Skill, die nur Dokumentation bereitstellt. Es werden keine Daten irgendwohin gesendet.
Warum läuft mein Async-Code langsam?
Häufige Ursachen sind blockierende Operationen, nicht awaited Coroutines oder zu viel sequenzielle statt parallele Ausführung.
Wie vergleicht sich asyncio mit Threading?
Asyncio verwendet kooperatives Multitasking in einem Single-Thread, was für I/O-gebundene Arbeit effizienter ist als Threading.

開発者の詳細

ファイル構成

📄 SKILL.md