async-python-patterns
非同期Pythonパターンのマスター
こちらからも入手できます: ActiveInferenceInstitute
async/awaitパターンで高性能Pythonアプリケーションを構築します。スケーラブルなI/Oバウンドシステムのための並行プログラミング技術を習得できます。
スキルZIPをダウンロード
Claudeでアップロード
設定 → 機能 → スキル → スキルをアップロードへ移動
オンにして利用開始
テストする
「async-python-patterns」を使用しています。 Show me how to fetch multiple URLs concurrently with timeout handling
期待される結果:
- asyncio.wait_for()と共にasyncio.gather()を使用してタイムアウト制御
- connectionプールを使用したaiohttp ClientSessionの作成
- 正常なレスポンスとタイムアウトの両方を適切に処理
- ステータスコードとエラー情報を含む結果を返却
「async-python-patterns」を使用しています。 How do I implement a rate limiter for API calls
期待される結果:
- asyncio.Semaphoreを使用して同時リクエストを制限
- 非同期コンテキストマネージャーパターンでセマフォを適用
- API制限に基づいて適切なmax_concurrent値を設定
- 堅牢性のためにリトライロジックと組み合わせる
「async-python-patterns」を使用しています。 What are common mistakes when writing async Python code
期待される結果:
- コルーチンのawaitを忘れる - 結果は返らずコルーチンオブジェクトが返される
- time.sleep()をasyncio.sleep()の代わりに使用 - イベントループをブロック
- try/except CancelledErrorでタスクキャンセルを処理していない
- syncコードとasyncコードを適切にラップせずに混合
セキュリティ監査
安全Documentation-only skill containing Python async programming patterns. Static analyzer flagged 77 findings, all confirmed as false positives. Markdown code fences were misidentified as shell backticks. Documentation text was misidentified as cryptographic algorithms. Example URLs are standard placeholders. No executable code, network access, or security risks exist.
リスク要因
🌐 ネットワークアクセス (10)
⚙️ 外部コマンド (48)
品質スコア
作れるもの
非同期Web APIの構築
FastAPIとaiohttpアプリケーションを適切な非同期パターンで作成し、同時リクエストを処理
同時データ処理
データベースクエリ、ファイル処理、API呼び出しのために並列I/O処理を実装
非同期オートメーションスクリプト
複数のネットワーク操作を同時に処理する効率的な自動化ツールを作成
これらのプロンプトを試す
Show me how to create a simple async function that fetches data with asyncio.sleep() to simulate network delay
Demonstrate how to make 10 HTTP requests concurrently using asyncio.gather() with proper error handling
Create a producer-consumer pattern using asyncio.Queue for processing 100 items with 5 workers
Design an async WebSocket server that handles multiple clients and broadcasts messages to all connected users
ベストプラクティス
- 常にasyncio.run()を非同期アプリケーションのエントリポイントとして使用
- 非同期関数内でtry/exceptブロックで適切なエラー処理を実装
- connectionプールとセマフォを使用して同時操作を制限
回避
- 非同期コードでtime.sleep()を使用しない - 常にasyncio.sleep()を使用
- コルーチンをawaitし忘れないように - 実行されない
- ブロックI/O操作を非同期コードと混合しない
よくある質問
どのPythonバージョンがasyncioをサポートしていますか?
非同期とスレッドはいつ使用すべきですか?
Djangoで非同期を使用できますか?
非同期コードをデバッグするにはどうすればよいですか?
create_taskとgatherの違いは何ですか?
このスキルはJupyterノートブックと互換性がありますか?
開発者の詳細
作成者
wshobsonライセンス
MIT
リポジトリ
https://github.com/wshobson/agents/tree/main/plugins/python-development/skills/async-python-patterns参照
main
ファイル構成
📄 SKILL.md