Skip to content
Skill

Async python patterns

Guides async Python services: FastAPI handlers, AsyncSession DB access and event loop

Async python patterns is an open-source agent skill for developer tools. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

Scripts
None
Platforms
Claude Code, Codex, Cursor
GitHub stars
13
Last commit
License
MIT
Listing updated

Similar skills

About Async python patterns

This skill gives an agent a set of conventions for building high-throughput Python services with async/await. It covers how to structure FastAPI lifespan hooks, set up SQLAlchemy 2.0 async sessions on asyncpg with task-scoped session handling, run several workers and health checks together with asyncio.gather, and shut workers down cleanly on SIGTERM or SIGINT.

A large part of the guidance targets the sync-in-async trap. The skill shows how to offload blocking cloud clients to a thread with asyncio.to_thread or switch to an async client, and how to bridge a blocking Kafka consumer back onto the event loop with run_coroutine_threadsafe. It also lists common anti-patterns, such as omitting return_exceptions in gather or spinning up a second event loop inside a thread.

The examples are Python and assume FastAPI, SQLAlchemy with asyncpg, aiokafka or kafka-python, aiohttp, and optionally uvloop. The skill has no scripts and needs no special tools; it works through instructions and reference files that the agent reads when a task matches.

When your agent uses it

Async Python for high-performance services. Use when implementing FastAPI/Temporal/Kafka async handlers, AsyncSession database access, asyncio.gather concurrency, or diagnosing event loop blocking.

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 5 files (42 KB) on GitHub on 4 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

This skill ships in the claude-kit plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

/plugin marketplace add ajyadav013/claude-kit
/plugin install claude-kit@claude-kit

Or copy only this skill to ~/.claude/skills/async-python-patterns:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/async-python-patterns &&
cp -R "$tmp/providers/codex/claude-kit/skills/async-python-patterns" ~/.claude/skills/async-python-patterns &&
rm -rf "$tmp"

For one project only, put the folder in .claude/skills/async-python-patterns inside it instead.

Claude Code docs on skills

Copy the skill folder to ~/.agents/skills/async-python-patterns to use it in every repository:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/async-python-patterns &&
cp -R "$tmp/providers/codex/claude-kit/skills/async-python-patterns" ~/.agents/skills/async-python-patterns &&
rm -rf "$tmp"

For one repository only, put the folder in .agents/skills/async-python-patterns inside it instead.

Codex docs on skills

Copy the skill folder to ~/.cursor/skills/async-python-patterns to use it in every project:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/async-python-patterns &&
cp -R "$tmp/providers/codex/claude-kit/skills/async-python-patterns" ~/.cursor/skills/async-python-patterns &&
rm -rf "$tmp"

For one project only, put the folder in .cursor/skills/async-python-patterns inside it instead.

Cursor docs on skills

Run in a terminal (add --scope workspace to install it for the current workspace only):

gemini skills install https://github.com/ajyadav013/claude-kit.git --path providers/codex/claude-kit/skills/async-python-patterns

Or copy the folder to ~/.gemini/skills/async-python-patterns yourself.

Gemini CLI docs on skills

For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/async-python-patterns:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/async-python-patterns &&
cp -R "$tmp/providers/codex/claude-kit/skills/async-python-patterns" ~/.copilot/skills/async-python-patterns &&
rm -rf "$tmp"

For one project only, put the folder in .github/skills/async-python-patterns inside it instead.

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/ajyadav013/claude-kit.git

Then copy claude-kit/providers/codex/claude-kit/skills/async-python-patterns into your agent's skills folder as async-python-patterns. Agents that support SKILL.md read one folder per skill.

The SKILL.md format

What it does

FastAPI lifespan setup
Initializes connections on startup and closes them on shutdown using an async context manager.
Async database sessions
Configures SQLAlchemy 2.0 async engines and task-local scoped sessions on asyncpg.
Concurrent worker orchestration
Runs workers and health tasks together with asyncio.gather and graceful signal-based shutdown.
Sync-to-async bridging
Shows how to run a blocking Kafka consumer in a thread and dispatch handlers onto the main loop.
Event loop blocking fixes
Explains how to detect sync cloud client calls in async code and offload or replace them.
Async HTTP client wrapper
Provides an aiohttp-based client pattern with retry handling and clean session closure.

Good for

  • Write an async FastAPI endpoint that queries PostgreSQL through AsyncSession
  • Run several Kafka consumers and a health check concurrently with graceful shutdown
  • Find why my async service is stalling and whether a sync client is blocking the loop
  • Wrap a blocking Google Cloud client call inside a Temporal activity
  • Set up a reusable async HTTP client with retries for an API integration

Async python patterns FAQ

What does Async python patterns need to be installed or run?

It is a plain SKILL.md folder with reference files and no scripts, and it does not restrict allowed tools. It is also distributed as part of a Claude Code plugin marketplace called claude-kit.

When does the agent load Async python patterns?

When the task involves FastAPI, Temporal or Kafka async handlers, AsyncSession database access, asyncio.gather concurrency, or diagnosing event loop blocking.

Which libraries does the guidance assume?

It assumes FastAPI, SQLAlchemy 2.0 with asyncpg, aiokafka or kafka-python for Kafka, aiohttp for HTTP, and optionally uvloop.

Does Async python patterns cover Kerberos-authenticated Kafka?

Yes. It notes that aiokafka does not support GSSAPI/Kerberos as of version 0.7.x, so kafka-python with the sync-to-async bridge is recommended for that case.

How do I install Async python patterns in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/async-python-patterns to use it in all your projects, or to .claude/skills/async-python-patterns in one project. Or install the claude-kit plugin, which includes it: /plugin marketplace add ajyadav013/claude-kit, then /plugin install claude-kit@claude-kit.

Does Async python patterns run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

Which AI agents can use Async python patterns?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

What are the best alternatives to Async python patterns?

The closest alternatives to Async python patterns are Python backend, Testing conventions, Backend repo architecture, Auth and rbac and Azure cosmos db py.

Where this comes from

  • Description: from the skill's own SKILL.md.

More from ajyadav013/claude-kit

  1. Guides an agent through pytest, async fixtures and security-regression tests for FastAPI

    • Open source
    • 13 GitHub stars
    • Developer tools
  2. Lets your agent inspect and debug live browser pages via Chrome DevTools MCP

    • Open source
    • 13 GitHub stars
    • Browser automation
  3. Runs concurrent load and stress tests against API endpoints to find latency and throughput

    • Open source
    • 13 GitHub stars
    • Developer tools
  4. Lets an agent click through a feature in a real browser and check how it behaves

    • Open source
    • 13 GitHub stars
    • Developer tools
  5. Runs quick health checks on backend, frontend and login to catch obvious breakage

    • Open source
    • 13 GitHub stars
    • Developer tools
  6. Guides an agent through red-green-refactor, bug reproduction tests and test pyramid

    • Open source
    • 13 GitHub stars
    • Developer tools