ork-assess
Assess a code change, design, architecture, workflow, or competing options against explicit criteria and evidence. Use when a…
Async Python: asyncio TaskGroup, FastAPI dependencies and middleware, SQLAlchemy 2.0 async sessions, pool tuning. Not for the API contract (use api-design).
Claude Code
$ npx -y skills add yonatangross/orchestkit --skill python-backend --agent claude-code
Codex
$ npx skills add yonatangross/orchestkit --skill python-backend -a codex -y
Cursor
$ npx skills add yonatangross/orchestkit --skill python-backend -a cursor -y
Gemini CLI
$ npx skills add yonatangross/orchestkit --skill python-backend -a gemini-cli -y
GitHub Copilot
$ npx skills add yonatangross/orchestkit --skill python-backend -a github-copilot -y
OpenCode
$ npx skills add yonatangross/orchestkit --skill python-backend -a opencode -y
Windsurf
$ npx skills add yonatangross/orchestkit --skill python-backend -a windsurf -y
name: python-backend
license: MIT
compatibility: "Claude Code 2.1.277+."
description: "Async Python: asyncio TaskGroup, FastAPI dependencies and middleware, SQLAlchemy 2.0 async sessions, pool tuning. Not for the API contract (use api-design)."
user-invocable: false
disable-model-invocation: false
targets:
- library: fastapi
version: ">=0.142.2"
- library: sqlalchemy
version: ">=2.1.1"
metadata:
owner-agent: "backend-system-architect"
category: document-asset-creation
version: "2.0.0"
author: "OrchestKit"
complexity: "medium"
tags: "python, asyncio, fastapi, sqlalchemy, connection-pooling, async, postgresql"
allowed-tools: "Read Glob Grep WebFetch WebSearch"
path_patterns: ["*.py", "**/requirements*.txt", "**/pyproject.toml", "**/Pipfile"]<!-- directive-density: intentional (teaches asyncio/SQLAlchemy anti-patterns; NEVER markers describe real event-loop/race-condition bugs, not aspirational guidance) -->
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.
| Category | Rules | Impact | When to Use | |----------|-------|--------|-------------| | [Asyncio](#asyncio) | 3 | HIGH | TaskGroup, structured concurrency, cancellation handling | | [FastAPI](#fastapi) | 3 | HIGH | Dependencies, middleware, background tasks | | [SQLAlchemy](#sqlalchemy) | 3 | HIGH | Async sessions, relationships, migrations | | [Pooling](#pooling) | 3 | MEDIUM | Database 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](#upstream-coverage-do-not-restate)).
# 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()# 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]Modern Python asyncio patterns using structured concurrency, TaskGroup, and Python 3.11+ features.
| Decision | Recommendation | |----------|----------------| | Task spawning | TaskGroup not gather() | | Timeouts | asyncio.timeout() context manager | | Concurrency limit | asyncio.Semaphore | | Sync bridge | asyncio.to_thread() | | Cancellation | Always re-raise CancelledError |
Production-ready FastAPI patterns for lifespan, dependencies, middleware, and settings.
| Decision | Recommendation | |----------|----------------| | Lifespan | asynccontextmanager (not events) | | Dependencies | Class-based services with DI | | Settings | Pydantic Settings with .env | | Response | ORJSONResponse for performance | | Health | Check all critical dependencies |
Async database patterns with SQLAlchemy 2.0, AsyncSession, and FastAPI integration.
| Decision | Recommendation | |----------|----------------| | Session scope | One AsyncSession per request | | Lazy loading | lazy="raise" + explicit loads | | Eager loading | selectinload for collections | | expire_on_commit | False (prevents lazy load errors) | | Pool | pool_pre_ping=True |
Database and HTTP connection pooling for high-performance async Python applications.
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`.
# NEVER use gather() for new code - no structured concurrency # NEVER swallow CancelledError - breaks TaskGroup and timeout # NEVER block the event loop with sync
The Complete AI Development Toolkit for Claude Code. 115 skills, 36 agents, 163 hooks. Install `ork` for stable (v10.x).
Assess a code change, design, architecture, workflow, or competing options against explicit criteria and evidence. Use when a…
Compare plausible implementation, architecture, product, or operational approaches before committing to one. Use when a request…
Map an unfamiliar codebase, feature, architecture, data flow, or operational path with file-backed evidence. Use when a request…
Render an answer inline as compact ASCII or box-drawing art with semantic status icons. Use for status, inventories, budgets,…
Make an approved, scoped change and prove the affected behavior. Use when a request asks to implement, build, add, or land a…
Review a pull request or branch for correctness, regressions, security, operational risk, and missing evidence. Use when a…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.