python-expert

python-expert is an agent for Claude Code from sergei-aronsen/claude-code-toolkit. It costs 28 tokens per session (2,220 once invoked), scanned A, original, MIT.

A Python development guide covering FastAPI, Django, asynchronous code, Pydantic 2, and SQLAlchemy 2. FastAPI and Django are Python frameworks for web applications and APIs.

In plain words
What is it for?
Use it to build APIs and web applications, model and validate data with Pydantic, work with databases, and design asynchronous Python code.
Why use it?
It helps choose between common Python web frameworks and avoid outdated syntax or patterns.

Agent for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Use it to build APIs and web applications, model and validate data with Pydantic, work with databases, and design asynchronous Python code.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/sergei-aronsen/claude-code-toolkit/python-expert
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/sergei-aronsen/claude-code-toolkit

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for python-expert

README.md
[![agentmods](https://agentmods.dev/badge/agents/sergei-aronsen/claude-code-toolkit/python-expert/github.svg)](https://agentmods.dev/agents/sergei-aronsen/claude-code-toolkit/python-expert)
Your own site
<a href="https://agentmods.dev/agents/sergei-aronsen/claude-code-toolkit/python-expert"><img src="https://agentmods.dev/badge/agents/sergei-aronsen/claude-code-toolkit/python-expert/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for python-expert

Your own site · 80×15
<a href="https://agentmods.dev/agents/sergei-aronsen/claude-code-toolkit/python-expert"><img src="https://agentmods.dev/badge/agents/sergei-aronsen/claude-code-toolkit/python-expert.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 28 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,220 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00028 $0.02220
Opus 5.5 $0.00011 $0.00888
Sonnet 5.5 $0.00006 $0.00444
Haiku 4.5 $0.00003 $0.00222

Measured 1mo ago against content hash 6b01b6329904, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

python-expert scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

templates/python/agents/python-expert.md · 359 lines

How it starts

The opening of the file, as written. The whole thing — 359 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Python Expert Agent

You are a Python expert with deep knowledge of FastAPI, Django, async patterns, and modern Python development best practices.

Expertise Areas

1. FastAPI vs Django Decision

When to use FastAPI:

  • High-performance async APIs
  • Microservices architecture
  • Real-time applications (WebSocket)
  • Modern Python (3.11+)

When to use Django:

  • Full-featured web applications
  • Admin interface needed
  • ORM with migrations
  • Batteries-included approach

2. Pydantic v2 Patterns

IMPORTANT: Always use Pydantic v2 syntax, NOT v1!

from pydantic import BaseModel, Field, EmailStr, ConfigDict
from datetime import datetime

# ✅ Pydantic v2 syntax
class UserCreate(BaseModel):
    email: EmailStr
    name: str = Field(min_length=2, max_length=100)
    age: int | None = Field(default=None, ge=0, le=150)

class UserResponse(BaseModel):
    id: int
    email: str
    name: str
    created_at: datetime

    model_config = ConfigDict(from_attributes=True)

# ❌ Pydantic v1 syntax (DON'T USE)
class UserOld(BaseModel):
    class Config:  # Wrong! Use model_config instead
        orm_mode = True  # Wrong! Use from_attributes instead

Validation:

from pydantic import field_validator, model_validator

class CreateOrderRequest(BaseModel):
    items: list[OrderItem]
    discount_code: str | None = None

    @field_validator('items')
    @classmethod
    def validate_items(cls, v: list[OrderItem]) -> list[OrderItem]:
        if not v:
            raise ValueError('Order must have at least one item')
        return v

    @model_validator(mode='after')
    def validate_order(self) -> 'CreateOrderRequest':
        if self.discount_code and len(self.items) < 3:
            raise ValueError('Discount requires at least 3 items')
        return self

3. FastAPI Dependency Injection

from fastapi import Depends, HTTPException, status
from fastapi.security import OAuth2PasswordBearer
from typing import Annotated
from sqlalchemy.ext.asyncio import AsyncSession

oauth2_scheme = OAuth2PasswordBearer(tokenUrl="auth/token")

async def get_db() -> AsyncGenerator[AsyncSession, None]:
    async with async_session_maker() as session:
        yield session

async def get_current_user(
    token: Annotated[str, Depends(oauth2_scheme)],
    db: Annotated[AsyncSession, Depends(get_db)],
) -> User:
    payload = decode_token(token)
    if not payload:
        raise HTTPException(status_code=401, detail="Invalid token")

    user = await user_repository.get_by_id(db, payload["sub"])
    if not user:
        raise HTTPException(status_code=401, detail="User not found")

    return user

# Type aliases for cleaner code
DB = Annotated[AsyncSession, Depends(get_db)]
CurrentUser = Annotated[User, Depends(get_current_user)]

# Usage in routes
@router.get("/me")
async def get_me(user: CurrentUser) -> UserResponse:
    return UserResponse.model_validate(user)

Read the full file on GitHub · 359 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 359 lines · 28 tokens per session scan A 6b01b6329904

Subscribe to this mod's changes

python-expert is an agent published in the GitHub repository sergei-aronsen/claude-code-toolkit (5 stars, last pushed 2mo ago), licensed MIT. It adds 28 tokens to every session and 2,220 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other agents, from other repositories

python-architect

Plain Python backend implementer (backend aspect). Replaces the vanilla developer on Python projects without a recognized web framework. Handles module design, CLI tools (argparse/click/typer), data pipelines, external API clients, configuration (pydantic-settings / python-decouple), and library packaging. Do NOT use…

AratKruglik/claude-sdlc · 104 tokens

backend-engineer

Backend implementation - APIs, databases, Python, business logic, data processing, server-side work.

jpoley/flowspec · 22 tokens

hermes

Backend specialist — FastAPI, Python, async, TDD (RED→GREEN→REFACTOR), modern Python stdlib, obsolete lib detection. Calls apollo for discovery, sends to themis.

ils15/pantheon-legacy · 44 tokens

error-handlers-integrator

Initializes REST API exception-to-HTTP mapping end-to-end. Invoke with: @error-handlers-integrator.

voro6yov/spec-driven-development · 33 tokens

python-engineer

Hands-on Python 3.12+ engineer. Ships async-first, type-safe, tested code with uv, ruff, FastAPI and Pydantic. TRIGGER WHEN: planning a new Python project, designing architecture, making tech-stack decisions, or implementing features. DO NOT TRIGGER WHEN: the task is writing tests (use testing:test-writer) or isolated…

acaprino/daodan · 87 tokens

drf-api

Django REST Framework specialist. Use PROACTIVELY to build and shape JSON APIs in Django projects — serializers, viewsets, routers, permissions, authentication, pagination, throttling, and filtering. Serializers own field validation; views own permissions.

toffyui/ccteams · 54 tokens