Agent skill

Python Backend

by yonatangross in yonatangross/orchestkit

Production Python async patterns including asyncio TaskGroup, FastAPI dependency injection and middleware, SQLAlchemy 2.0 async sessions, and database connection pool tuning.

MITAuto-check: notesBackend & APIs

Install Python Backend

skills CLI
$ npx skills add yonatangross/orchestkit --skill python-backend -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install yonatangross/orchestkit python-backend --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/yonatangross/orchestkit.git skills-src && mkdir -p .claude/skills && cp -r skills-src/src/skills/python-backend .claude/skills/python-backend && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
python-backend
GitHub stars
288
Token cost
~2.8k tokens
SKILL.md length
778 words
Files
26 (incl. scripts, references, assets)
Skills in repo
107
Repo updated
First seen
Licence
MIT

At a glance

Production Python async patterns including asyncio TaskGroup, FastAPI dependency injection and middleware, SQLAlchemy 2.0 async sessions, and database connection pool tuning.

  • Building async services
  • SKILL.md covers Quick Reference, Quick Start, Asyncio and FastAPI, plus 5 more sections
  • Runs Python scripts from its folder
  • Wiring FastAPI dependencies

What it does

Python Backend is an agent skill from yonatangross/orchestkit. Production Python async patterns including asyncio TaskGroup, FastAPI dependency injection and middleware, SQLAlchemy 2.0 async sessions, and database connection pool tuning. Python 3.11+ runtime concerns such as ExceptionGroup, cancellation semantics, and session rollback. Use when building async services, wiring FastAPI dependencies, or tuning database connection pools. Runtime implementation layer, not the API wire contract.

Its SKILL.md is about 2.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 28 other files, including scripts, reference files and assets (for example `assets/fastapi-app-template.py`, `metadata.json` and `references/eager-loading.md`). Compatibility notes: Claude Code 2.1.277+.

It sits in Backend & APIs, covering Backend development, ORMs and data access and Design patterns. It works with Python, FastAPI and SQLAlchemy. The repository describes itself as: The Complete AI Development Toolkit for Claude Code. 106 skills, 36 agents, 171 hooks. Install ork for stable (v9.x), or ork-alpha for the v10 line, which ships daily. The licence is MIT.

When your agent uses it

  • Building async services
  • Wiring FastAPI dependencies
  • Tuning database connection pools

Example prompts

  • “/python-backend”

Requirements

  • Python 3
  • Docker
  • Compatibility (from SKILL.md): Claude Code 2.1.277+.
  • Pre-approved tools (allowed-tools): Read, Glob, Grep, WebFetch, WebSearch

What it can do on your machine

Read from SKILL.md and the folder at commit 1f8d8f3. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Glob
    • Grep
    • WebFetch
    • WebSearch

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python, from the files we listed), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • docs.python.org
    • fastapi.tiangolo.com
    • docs.sqlalchemy.org
    • magicstack.github.io
    • docs.aiohttp.org
    • postgresql.org
    • pytest-asyncio.readthedocs.io
    • kubernetes.io

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Claude Code 2.1.277+.

    From compatibility in the SKILL.md frontmatter.

Context cost

Python Backend loads about 2.8k tokens when it runs, and up to ~6.5k if it reads all its reference files. Until then it costs about 112 tokens; SKILL.md has 778 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~112
When it runs · the whole SKILL.md, loaded when a task matches
~2.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~6.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:104
    - **Pydantic Settings** with `.env` and field validation
  • NoteMentions a .env fileSKILL.md:113
    | Settings | Pydantic Settings with .env |

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from yonatangross/orchestkit at commit 1f8d8f3, republished under its MIT licence (© yonatangross). 778 words, ~2,831 tokens.

Download SKILL.mdSave it as .claude/skills/python-backend/SKILL.md (or your agent's skills folder). This skill also uses 25 other files; get the full folder from GitHub.
name
python-backend
description
Production Python async patterns including asyncio TaskGroup, FastAPI dependency injection and middleware, SQLAlchemy 2.0 async sessions, and database connection pool tuning. Python 3.11+ runtime concerns such as ExceptionGroup, cancellation semantics, and session rollback. Use when building async services, wiring FastAPI dependencies, or tuning database connection pools. Runtime implementation layer, not the API wire contract.
allowed-tools
Read, Glob, Grep, WebFetch, WebSearch
compatibility
Claude Code 2.1.277+.
license
MIT
context
fork
agent
backend-system-architect
user-invocable
false
disable-model-invocation
false
metadata.category
document-asset-creation
metadata.version
2.0.0
metadata.author
OrchestKit
metadata.complexity
medium
metadata.tags
python, asyncio, fastapi, sqlalchemy, connection-pooling, async, postgresql
<!-- directive-density: intentional (teaches asyncio/SQLAlchemy anti-patterns; NEVER markers describe real event-loop/race-condition bugs, not aspirational guidance) -->

Python Backend

Patterns for building production Python backends with asyncio, FastAPI, SQLAlchemy 2.0, and connection pooling. Each category has individual rule files in rules/ loaded on-demand.

Quick Reference

CategoryRulesImpactWhen to Use
Asyncio3HIGHTaskGroup, structured concurrency, cancellation handling
FastAPI3HIGHDependencies, middleware, background tasks
SQLAlchemy3HIGHAsync sessions, relationships, migrations
Pooling3MEDIUMDatabase pools, HTTP sessions, tuning

Total: 12 rules across 4 categories. House decisions rescued from thinned files live in references/ork-delta.md; vendor material is linked, not restated (see Upstream coverage).

Quick Start

python
# FastAPI + SQLAlchemy async session
async def get_db() -> AsyncGenerator[AsyncSession, None]:
    async with async_session_factory() as session:
        try:
            yield session
            await session.commit()
        except Exception:
            await session.rollback()
            raise

# Reusable dependency alias (FastAPI's recommended Annotated form)
SessionDep = Annotated[AsyncSession, Depends(get_db)]

@router.get("/users/{user_id}")
async def get_user(user_id: UUID, db: SessionDep):
    result = await db.execute(select(User).where(User.id == user_id))
    return result.scalar_one_or_none()
python
# Asyncio TaskGroup with timeout
async def fetch_all(urls: list[str]) -> list[dict]:
    async with asyncio.timeout(30):
        async with asyncio.TaskGroup() as tg:
            tasks = [tg.create_task(fetch_url(url)) for url in urls]
    return [t.result() for t in tasks]

Asyncio

Modern Python asyncio patterns using structured concurrency, TaskGroup, and Python 3.11+ features.

Key Patterns
  • TaskGroup replaces gather() with structured concurrency and auto-cancellation
  • asyncio.timeout() context manager for composable timeouts
  • Semaphore for concurrency limiting (rate-limit HTTP requests)
  • except* with ExceptionGroup for handling multiple task failures
  • asyncio.to_thread() for bridging sync code to async
Key Decisions
DecisionRecommendation
Task spawningTaskGroup not gather()
Timeoutsasyncio.timeout() context manager
Concurrency limitasyncio.Semaphore
Sync bridgeasyncio.to_thread()
CancellationAlways re-raise CancelledError

FastAPI

Production-ready FastAPI patterns for lifespan, dependencies, middleware, and settings.

Key Patterns
  • Lifespan with asynccontextmanager for startup/shutdown resource management
  • Dependency injection with class-based services and Depends()
  • Middleware stack: CORS -> RequestID -> Timing -> Logging
  • Pydantic Settings with .env and field validation
  • Exception handlers wired to RFC 9457 Problem Details bodies (the body format itself is ork:api-design)
Key Decisions
DecisionRecommendation
Lifespanasynccontextmanager (not events)
DependenciesClass-based services with DI
SettingsPydantic Settings with .env
ResponseORJSONResponse for performance
HealthCheck all critical dependencies

SQLAlchemy

Async database patterns with SQLAlchemy 2.0, AsyncSession, and FastAPI integration.

Key Patterns
  • One AsyncSession per request with expire_on_commit=False
  • lazy="raise" on relationships to prevent accidental N+1 queries
  • selectinload for eager loading collections
  • Repository pattern with generic async CRUD
  • Bulk inserts chunked 1000-10000 rows for memory management
Key Decisions
DecisionRecommendation
Session scopeOne AsyncSession per request
Lazy loadinglazy="raise" + explicit loads
Eager loadingselectinload for collections
expire_on_commitFalse (prevents lazy load errors)
Poolpool_pre_ping=True

Pooling

Database and HTTP connection pooling for high-performance async Python applications.

Key Patterns
  • SQLAlchemy pool with pool_size, max_overflow, pool_pre_ping
  • Direct asyncpg pool with min_size/max_size and connection lifecycle
  • aiohttp session with TCPConnector limits and DNS caching
  • FastAPI lifespan creating and closing pools at startup/shutdown
  • Pool monitoring with Prometheus metrics
Pool Sizing Formula
pool_size = (concurrent_requests / avg_queries_per_request) * 1.5

That formula sizes one process. The fleet-level cap against the server's max_connections, and the pool alert thresholds, are in references/ork-delta.md.

Anti-Patterns (FORBIDDEN)

python
# NEVER use gather() for new code - no structured concurrency
# NEVER swallow CancelledError - breaks TaskGroup and timeout
# NEVER block the event loop with sync calls (time.sleep, requests.get)
# NEVER use global mutable state for db sessions
# NEVER skip dependency injection (create sessions in routes)
# NEVER share AsyncSession across tasks (race condition)
# NEVER use sync Session in async code (blocks event loop)
# NEVER create engine/pool per request
# NEVER forget to close pools on shutdown
Show full SKILL.md (386 more words)Show less

Upstream coverage (do not restate)

Topics removed in the 2026-07-31 wrap-plus-delta thinning. Consult the first-party source; only the ork delta (house policy, scars, working config) belongs in this skill. Where a row says a house subset stays in a rules/ file, that file is still the authority for the OrchestKit position and the link only covers the vendor surface around it.

TopicFirst-party source
asyncio task API reference: TaskGroup vs gather(), asyncio.timeout(), ExceptionGroup and except*, to_thread(). House subset stays in rules/asyncio-taskgroup.md and rules/asyncio-cancellation.md.https://docs.python.org/3/library/asyncio-task.html
asyncio.Semaphore, Lock, Event, Queue semantics. House subset stays in rules/asyncio-structured.md; the create-once-plus-timeout rule is in references/ork-delta.md.https://docs.python.org/3/library/asyncio-sync.html
Event-loop debug mode, slow_callback_duration, detecting blocking calls (the house 100 ms threshold is in references/ork-delta.md)https://docs.python.org/3/library/asyncio-dev.html
FastAPI project scaffolding: app layout, APIRouter composition, Pydantic Settings wiring, uvicorn entry pointhttps://fastapi.tiangolo.com/tutorial/bigger-applications/
FastAPI lifespan API and startup/shutdown mechanics. House subset stays in rules/fastapi-background.md; the reverse-order teardown rule is in references/ork-delta.md.https://fastapi.tiangolo.com/advanced/events/
Starlette/FastAPI middleware API, BaseHTTPMiddleware, call_next, CORS options. House subset stays in rules/fastapi-middleware.md and references/fastapi-app-boilerplate.md; the middleware-vs-dependency split is in references/ork-delta.md.https://fastapi.tiangolo.com/tutorial/middleware/
SQLAlchemy 2.0 asyncio API: create_async_engine, async_sessionmaker, expire_on_commit, Mapped/mapped_column, with_for_update, bulk insert and update. House subset stays in rules/sqlalchemy-sessions.md, rules/sqlalchemy-relationships.md, rules/sqlalchemy-migrations.md, and references/eager-loading.md.https://docs.sqlalchemy.org/en/20/orm/extensions/asyncio.html
SQLAlchemy pool implementations and options (pool_size, max_overflow, pool_pre_ping, pool_recycle, pool_timeout). House subset stays in rules/pooling-database.md.https://docs.sqlalchemy.org/en/20/core/pooling.html
SQLAlchemy pool events (checkout, checkin, connect) for instrumentation. House subset stays in rules/pooling-tuning.md; the alert thresholds are in references/ork-delta.md.https://docs.sqlalchemy.org/en/20/core/events.html
asyncpg pool API: create_pool, min_size/max_size, max_inactive_connection_lifetime, setup hook, type codecshttps://magicstack.github.io/asyncpg/current/api/index.html
aiohttp client reference: ClientSession, TCPConnector limits, keep-alive, DNS caching, ClientTimeout. House subset stays in rules/pooling-http.md.https://docs.aiohttp.org/en/stable/client_reference.html
PostgreSQL server-side connection limits (max_connections, superuser_reserved_connections)https://www.postgresql.org/docs/current/runtime-config-connection.html
pytest-asyncio fixtures and async test setuphttps://pytest-asyncio.readthedocs.io/en/stable/reference/fixtures/index.html
Container and Kubernetes packaging, readiness/liveness probes, resource limitshttps://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
Auth flows, password hashing, token expiry policy, security headersOwned by ork:security-patterns (src/skills/security-patterns/); the FastAPI Depends() auth chain stays in rules/fastapi-dependencies.md
RFC 9457 problem-details body format, API versioning, SSE and WebSocket wire contractsOwned by ork:api-design (src/skills/api-design/); the FastAPI exception-handler wiring stays in rules/fastapi-background.md and references/fastapi-app-boilerplate.md
Production checklists for FastAPI, asyncio, SQLAlchemy, and poolingDerivable from the sources above; no checklist restatement kept
  • ork:architecture-patterns - Clean architecture and layer separation
  • ork:async-jobs - Celery/ARQ for background processing
  • ork:api-design - Wire contract, RFC 9457 errors, SSE/WebSocket streaming
  • ork:database-patterns - Database schema design
  • ork:security-patterns - Auth, password hashing, token policy
  • ork:testing-integration - pytest-asyncio and httpx ASGI test setup
  • ork:devops-deployment - Docker and Kubernetes packaging

© yonatangross, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 25 other files (scripts, references, assets) in src/skills/python-backend of yonatangross/orchestkit.

  • SKILL.md
  • assets/fastapi-app-template.py
  • metadata.json
  • references/eager-loading.md
  • references/fastapi-app-boilerplate.md
  • references/ork-delta.md
  • rules/_sections.md
  • rules/_template.md
  • rules/asyncio-cancellation.md
  • rules/asyncio-structured.md
  • rules/asyncio-taskgroup.md
  • rules/fastapi-background.md
  • rules/fastapi-dependencies.md
  • rules/fastapi-middleware.md
  • rules/pooling-database.md
  • rules/pooling-http.md
  • rules/pooling-tuning.md
  • rules/sqlalchemy-migrations.md
  • … and 8 more

Open the folder on GitHubat commit 1f8d8f3

Compare with similar skills

Python Backend next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Python Backend compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Python Backend this skillyonatangross/orchestkit288—~2.8kAutomated safety check: NotesMIT
Mastering Python SkillSpillwaveSolutions/agent-brain120—~1.4kAutomated safety check: NotesMIT
Fastcrudbenavlabs/fastcrud1.6k—~5kAutomated safety check: PassMIT
Backend Fastapi Pythonavibebuilder/claude-prime120—~997Automated safety check: PassMIT
Python Best Practicesc0x12c/ai-toolkit106—~676Automated safety check: PassNone
PythonMadAppGang/claude-code283—~2.8kAutomated safety check: NotesMIT

Similar skills

  • Mastering Python Skill

    SpillwaveSolutions/agent-brain

    Modern Python coaching covering language foundations through advanced production patterns.

    120 GitHub stars~1.4k tokensUpdated 17 days ago
    DevelopmentAuto-check: notes
  • Fastcrud

    benavlabs/fastcrud

    A skill your agent uses when building or modifying CRUD endpoints with FastCRUD (the fastcrud PyPI package) in a FastAPI project — covers FastCRUD, crudrouter, EndpointCreator, FilterConfig…

    1.6k GitHub stars~5k tokensUpdated 12 days ago
    Backend & APIsAuto-check passed
  • Backend Fastapi Python

    avibebuilder/claude-prime

    A skill your agent uses for any Python backend work in this project: building FastAPI endpoints, writing service functions, defining Pydantic/SQLModel schemas, running Alembic migrations, or…

    120 GitHub stars~997 tokensUpdated 4 mo ago
    Backend & APIsAuto-check passed
  • Python Best Practices

    c0x12c/ai-toolkit

    Python/FastAPI coding standards including async patterns, Pydantic v2, SQLAlchemy 2.0, and project structure.

    106 GitHub stars~676 tokensUpdated 3 mo ago
    Backend & APIsAuto-check passed
  • Python

    MadAppGang/claude-code

    A skill your agent uses when building FastAPI applications, implementing async endpoints, setting up Pydantic schemas, working with SQLAlchemy, or writing pytest tests for Python backend services.

    283 GitHub stars~2.8k tokensUpdated 6 mo ago
    Backend & APIsAuto-check: notes
  • Phoenix Server

    Arize-ai/phoenix

    Backend development guide for the Phoenix AI observability platform (Strawberry GraphQL, SQLAlchemy async, FastAPI).

    12k GitHub stars~1.6k tokensUpdated today
    Backend & APIsAuto-check passed

More from yonatangross/orchestkit

All 107 skills in this repo
  • API Design

    yonatangross/orchestkit

    API contract design for REST and GraphQL, covering resource shape, URL and header versioning with deprecation windows, RFC 9457 Problem Details error handling, and OpenAPI specs.

    288 GitHub stars~2.9k tokensUpdated yesterday
    Auto-check passed
  • Architecture Decision Record

    yonatangross/orchestkit

    ADR templates in the Nygard format with context, decision, consequences, and alternatives.

    288 GitHub stars~2k tokensUpdated yesterday
    Auto-check passed
  • Audit Full

    yonatangross/orchestkit

    Single-pass codebase analysis leveraging a 1M-token context window for comprehensive security scanning, architecture review, and dependency auditing.

    288 GitHub stars~3.5k tokensUpdated yesterday
    Auto-check: notes
  • Code Review Playbook

    yonatangross/orchestkit

    Structured review processes, conventional comments, language-specific checklists, and feedback templates.

    288 GitHub stars~2.2k tokensUpdated yesterday
    Auto-check passed
  • Create PR

    yonatangross/orchestkit

    Creates GitHub pull requests with pre-flight validation, conventional title formatting, and structured summary generation.

    288 GitHub stars~4.5k tokensUpdated yesterday
    Auto-check: notes
  • Explore

    yonatangross/orchestkit

    Multi-angle codebase exploration spawning 3-5 parallel agents for code structure, data flow, architecture patterns, and health assessment.

    288 GitHub stars~3.9k tokensUpdated yesterday
    Auto-check: notes

Questions about Python Backend

What does Python Backend do?

Production Python async patterns including asyncio TaskGroup, FastAPI dependency injection and middleware, SQLAlchemy 2.0 async sessions, and database connection pool tuning. Python Backend is an agent skill from yonatangross/orchestkit.0 async sessions, and database connection pool tuning.

When should I use Python Backend?

Python Backend fits situations like: building async services; wiring FastAPI dependencies; tuning database connection pools.

How do I install Python Backend in Claude Code?

Run `npx skills add yonatangross/orchestkit --skill python-backend -a claude-code`. Or copy the skill folder (src/skills/python-backend in yonatangross/orchestkit) into .claude/skills/python-backend in your project. Claude Code loads it when a task matches its description.

How do I install Python Backend in Codex?

Run `npx skills add yonatangross/orchestkit --skill python-backend -a codex`. Or copy the skill folder (src/skills/python-backend in yonatangross/orchestkit) into .agents/skills/python-backend in your project. Codex loads it when a task matches its description.

Can I use Python Backend in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add yonatangross/orchestkit --skill python-backend -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/python-backend, .gemini/skills/python-backend, .github/skills/python-backend and .opencode/skills/python-backend in your project.

What does Python Backend need to run?

Going by SKILL.md and its folder, Python Backend needs Python for the scripts in its folder. Our summary lists: Python 3; Docker. Its frontmatter pre-approves these tools: Read, Glob, Grep, WebFetch, WebSearch. Compatibility (from SKILL.md): Claude Code 2.1.277+..

Does Python Backend access the network?

SKILL.md names 8 domains. As links in the text: docs.python.org, fastapi.tiangolo.com, docs.sqlalchemy.org, magicstack.github.io, docs.aiohttp.org, postgresql.org, pytest-asyncio.readthedocs.io and kubernetes.io. This is read from the text; nothing was executed.

Is Python Backend safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Python Backend use?

Python Backend is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Python Backend use?

About 2.8k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.6k tokens, read only when the agent opens those files.

What are the alternatives to Python Backend?

Skills that share tags, products or a category with Python Backend: Mastering Python Skill (SpillwaveSolutions/agent-brain, 120 stars), Fastcrud (benavlabs/fastcrud, 1.6k stars), Backend Fastapi Python (avibebuilder/claude-prime, 120 stars) and Python Best Practices (c0x12c/ai-toolkit, 106 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Python Backend?

yonatangross (a GitHub user) maintains it in yonatangross/orchestkit, which has 288 GitHub stars. The repository holds 107 skills in this directory. The repository was last updated on October 6, 2026.

Source: yonatangross/orchestkit on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.