Skip to content

ComeOnOliver/skillshub / skills/aiskillstore/marketplace/0xdarkmatter/python-async-patterns

python-async-patterns

Verified

Python asyncio patterns for concurrent programming. Triggers on: asyncio, async, await, coroutine, gather, semaphore, TaskGroup, event loop, aiohttp, concurrent.

skill-report.json

View on GitHub
{
  "schema_version": "2.0",
  "meta": {
    "generated_at": "2026-01-16T13:55:25.125Z",
    "slug": "0xdarkmatter-python-async-patterns",
    "source_url": "https://github.com/0xDarkMatter/claude-mods/tree/main/skills/python-async-patterns",
    "source_ref": "main",
    "model": "claude",
    "analysis_version": "3.0.0",
    "source_type": "community",
    "content_hash": "2046b512720ba3f4bfc3b901554ae2098fd560b8830dd2dec26720797de38a5c",
    "tree_hash": "940876cfe0c560c749179e4b8267bcb3cc000f3ab93abba6bdb2fba68a8b947c"
  },
  "skill": {
    "name": "python-async-patterns",
    "description": "Python asyncio patterns for concurrent programming. Triggers on: asyncio, async, await, coroutine, gather, semaphore, TaskGroup, event loop, aiohttp, concurrent.",
    "summary": "Python asyncio patterns for concurrent programming. Triggers on: asyncio, async, await, coroutine, g...",
    "icon": "⚡",
    "version": "1.0.0",
    "author": "0xDarkMatter",
    "license": "MIT",
    "category": "coding",
    "tags": [
      "asyncio",
      "concurrency",
      "python",
      "async",
      "performance"
    ],
    "supported_tools": [
      "claude",
      "codex",
      "claude-code"
    ],
    "risk_factors": [
      "scripts",
      "filesystem",
      "network",
      "external_commands"
    ]
  },
  "security_audit": {
    "risk_level": "low",
    "is_blocked": false,
    "safe_to_publish": true,
    "summary": "This is an educational documentation skill containing Python asyncio patterns and examples. All static findings are false positives: SHA-256 hash strings were misidentified as C2 keywords, Python async constructs (asyncio.gather, aiohttp.ClientSession) were misidentified as weak crypto, markdown code blocks with backticks were flagged as shell execution, and a developer static analysis script was misidentified as reconnaissance. No malicious code, data exfiltration, or harmful capabilities detected.",
    "risk_factor_evidence": [
      {
        "factor": "scripts",
        "evidence": [
          {
            "file": "scripts/find-blocking-calls.sh",
            "line_start": 1,
            "line_end": 47
          }
        ]
      },
      {
        "factor": "filesystem",
        "evidence": [
          {
            "file": "references/mixing-sync-async.md",
            "line_start": 240,
            "line_end": 248
          },
          {
            "file": "references/production-patterns.md",
            "line_start": 108,
            "line_end": 116
          }
        ]
      },
      {
        "factor": "network",
        "evidence": [
          {
            "file": "SKILL.md",
            "line_start": 19,
            "line_end": 27
          },
          {
            "file": "references/aiohttp-patterns.md",
            "line_start": 10,
            "line_end": 25
          }
        ]
      },
      {
        "factor": "external_commands",
        "evidence": [
          {
            "file": "SKILL.md",
            "line_start": 16,
            "line_end": 160
          }
        ]
      }
    ],
    "critical_findings": [],
    "high_findings": [],
    "medium_findings": [],
    "low_findings": [],
    "dangerous_patterns": [],
    "files_scanned": 11,
    "total_lines": 2911,
    "audit_model": "claude",
    "audited_at": "2026-01-16T13:55:25.125Z"
  },
  "content": {
    "user_title": "Master Python async patterns",
    "value_statement": "Writing concurrent Python code requires understanding specific patterns and avoiding common pitfalls. This skill provides production-ready asyncio patterns for building high-performance applications with proper error handling, graceful shutdown, and optimized resource management.",
    "seo_keywords": [
      "python asyncio",
      "async programming",
      "python concurrency",
      "asyncio patterns",
      "aiohttp",
      "python async await",
      "coroutine",
      "TaskGroup",
      "concurrent programming",
      "claude code"
    ],
    "actual_capabilities": [
      "Show concurrent patterns using asyncio.gather, TaskGroup, and semaphores",
      "Implement bounded concurrency to prevent resource exhaustion",
      "Create production-ready HTTP clients and servers with aiohttp",
      "Handle errors with retry patterns, circuit breakers, and fallbacks",
      "Bridge synchronous and async code using run_in_executor",
      "Debug async code with profiling, task introspection, and slow callback detection"
    ],
    "limitations": [
      "Python 3.10+ required; some patterns need Python 3.11+",
      "Does not provide runtime execution or code generation",
      "Does not include database driver patterns (see python-database-patterns)",
      "Requires understanding of basic async concepts"
    ],
    "use_cases": [
      {
        "target_user": "Backend developers",
        "title": "Build async web services",
        "description": "Create high-concurrency web APIs using aiohttp with proper connection pooling and graceful shutdown"
      },
      {
        "target_user": "System programmers",
        "title": "Handle concurrent tasks",
        "description": "Implement producer-consumer queues, rate limiting, and background task management for scalable systems"
      },
      {
        "target_user": "API integrators",
        "title": "Fetch multiple APIs",
        "description": "Make concurrent HTTP requests with retry logic, circuit breakers, and partial failure handling"
      }
    ],
    "prompt_templates": [
      {
        "title": "Basic async pattern",
        "scenario": "Getting started with asyncio",
        "prompt": "Show me how to use asyncio.gather to fetch multiple URLs concurrently with proper error handling"
      },
      {
        "title": "Rate limiting",
        "scenario": "Controlling concurrency",
        "prompt": "How do I limit concurrent API calls using asyncio.Semaphore to avoid rate limits"
      },
      {
        "title": "Error resilience",
        "scenario": "Building fault-tolerant systems",
        "prompt": "Implement a circuit breaker pattern for async operations with exponential backoff retry"
      },
      {
        "title": "Production deployment",
        "scenario": "Running in production",
        "prompt": "Create a production-ready async application with graceful shutdown, health checks, and signal handling"
      }
    ],
    "output_examples": [
      {
        "input": "Fetch multiple URLs concurrently with rate limiting",
        "output": [
          "Concurrent URLs: 3",
          "Success: 3",
          "Failed: 0",
          "Total time: 0.45s",
          "Pattern used: asyncio.gather with Semaphore(5)"
        ]
      },
      {
        "input": "Handle async operation timeout",
        "output": [
          "Timeout set: 5.0 seconds",
          "Result: None (timed out)",
          "Pattern used: asyncio.timeout context manager"
        ]
      }
    ],
    "best_practices": [
      "Always use async libraries (aiohttp, aiosqlite) instead of blocking sync libraries",
      "Keep references to created tasks to prevent garbage collection",
      "Configure timeouts and connection pools for all external service calls"
    ],
    "anti_patterns": [
      "Using time.sleep() instead of asyncio.sleep() blocks the entire event loop",
      "Creating new aiohttp.ClientSession per request wastes resources",
      "Using blocking I/O (open, requests) directly in async functions stalls concurrency"
    ],
    "faq": [
      {
        "question": "What Python version do I need?",
        "answer": "Python 3.10+ recommended. TaskGroup, asyncio.timeout, and ExceptionGroup require Python 3.11+."
      },
      {
        "question": "How many concurrent requests can I make?",
        "answer": "Limit depends on target service rate limits. Use Semaphore for control; start with 10 concurrent and adjust."
      },
      {
        "question": "Can I mix sync and async code?",
        "answer": "Yes, use run_in_executor for blocking operations. Never block the event loop with time.sleep or sync I/O."
      },
      {
        "question": "Is my data safe?",
        "answer": "This skill contains only pattern documentation. No code execution, file access, or network calls occur."
      },
      {
        "question": "Why is my async code slow?",
        "answer": "Common causes: blocking calls, too few concurrent tasks, missing connection pooling, or slow external services."
      },
      {
        "question": "How is this different from threading?",
        "answer": "Async uses cooperative multitasking with one thread, avoiding GIL limits. Better for I/O-bound workloads with many connections."
      }
    ]
  },
  "file_structure": [
    {
      "name": "assets",
      "type": "dir",
      "path": "assets",
      "children": [
        {
          "name": "async-project-template.py",
          "type": "file",
          "path": "assets/async-project-template.py",
          "lines": 140
        }
      ]
    },
    {
      "name": "references",
      "type": "dir",
      "path": "references",
      "children": [
        {
          "name": "aiohttp-patterns.md",
          "type": "file",
          "path": "references/aiohttp-patterns.md",
          "lines": 260
        },
        {
          "name": "concurrency-patterns.md",
          "type": "file",
          "path": "references/concurrency-patterns.md",
          "lines": 278
        },
        {
          "name": "debugging-async.md",
          "type": "file",
          "path": "references/debugging-async.md",
          "lines": 302
        },
        {
          "name": "error-handling.md",
          "type": "file",
          "path": "references/error-handling.md",
          "lines": 427
        },
        {
          "name": "mixing-sync-async.md",
          "type": "file",
          "path": "references/mixing-sync-async.md",
          "lines": 272
        },
        {
          "name": "performance.md",
          "type": "file",
          "path": "references/performance.md",
          "lines": 396
        },
        {
          "name": "production-patterns.md",
          "type": "file",
          "path": "references/production-patterns.md",
          "lines": 371
        }
      ]
    },
    {
      "name": "scripts",
      "type": "dir",
      "path": "scripts",
      "children": [
        {
          "name": "find-blocking-calls.sh",
          "type": "file",
          "path": "scripts/find-blocking-calls.sh",
          "lines": 47
        }
      ]
    },
    {
      "name": "SKILL.md",
      "type": "file",
      "path": "SKILL.md",
      "lines": 161
    }
  ]
}
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 319kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 319kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 319kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 319kUpdated Claude CodeCodexVerifiedInstall