python-patterns

python-patterns is a skill for Claude Code, Codex from DDS-Solutions/AI-TadPole-OS. It costs 30 tokens per session (825 once invoked), scanned A, original, MIT.

A guide to making sound choices when developing Python applications, including frameworks, asynchronous code, type hints, and project structure. Python is a general-purpose programming language.

In plain words
What is it for?
Use it when selecting between FastAPI, Django, Flask, or simpler tools, and when planning APIs, workers, background tasks, and database access.
Why use it?
It helps avoid choosing an unsuitable framework or architecture for the kind of application being built.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/dds-solutions/ai-tadpole-os/python-patterns
Any agent
npx skills add DDS-Solutions/AI-TadPole-OS --skill python-patterns
Clone the repo
git clone --depth 1 https://github.com/DDS-Solutions/AI-TadPole-OS

Made for: Claude Code, Codex.

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-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/dds-solutions/ai-tadpole-os/python-patterns.svg)](https://agentmods.dev/skills/dds-solutions/ai-tadpole-os/python-patterns)
Your own site
<a href="https://agentmods.dev/skills/dds-solutions/ai-tadpole-os/python-patterns"><img src="https://agentmods.dev/badge/skills/dds-solutions/ai-tadpole-os/python-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 30 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 825 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
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.00030 $0.00825
Opus 5 $0.00015 $0.00413
Sonnet 5 $0.00006 $0.00165
Haiku 4.5 $0.00003 $0.00082

Measured yesterday against content hash 7d73e74704dc, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

python-patterns scanned grade A with 1 finding 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 yesterday.

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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- **Golden Rule**: Never execute blocking sync calls (`requests.get`, `time.sleep`) inside an async event loop.
.agent/skills/python-patterns/SKILL.md · 82 lines

How it starts

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

[!IMPORTANT] AI Context & Knowledge Heritage

  • Subsystem: Agent Skills Registry / python-patterns
  • Architecture: @docs ARCHITECTURE:Documentation
  • Failure Path: Information drift, legacy terminology, or documentation mismatch.
  • Observability: Traceability via execution/parity_guard.py ([SKILL])

Python Patterns

Python development principles and decision-making for modern production systems. Learn to THINK, not memorize patterns.


🎯 Progressive Disclosure & L3 Reference Index

Read REQUIRED core logic below; consult deep L3 Reference Guides on demand:

L3 Reference Guide Purpose Trigger / When to Load
references/framework_cheatsheets.md FastAPI vs Django vs Flask, async drivers, test fixtures Framework selection & database setup

1. Core Decision Trees

🏗️ Framework & Concurrency Selection

What are you building?
├── High-concurrency API / ML Serving ➔ FastAPI (Async, Pydantic v2, ASGI)
├── Full-Stack / Admin Backoffice      ➔ Django 5.0+ (Batteries-included, ORM)
├── Lightweight CLI / Script / Worker ➔ Python Standard Library / Click / Typer
└── Background Distributed Tasks       ➔ Celery / ARQ (Redis backend)

⚡ Async vs Sync Rules

  • Use async def for: I/O-bound operations (Database queries, REST API requests, WebSockets, File streams).
  • Use def (Sync) for: CPU-bound computation, image processing, or blocking legacy libraries (run via threadpools).
  • Golden Rule: Never execute blocking sync calls (requests.get, time.sleep) inside an async event loop.

2. Type Hinting & Validation Standards

from typing import Optional, Union, Callable
from pydantic import BaseModel, Field

# 1. Strict Typing for All Public Interfaces
def process_record(record_id: str, handler: Callable[[dict], bool]) -> Optional[dict]:
    ...

# 2. Pydantic v2 for Domain Validation & Serialized Contracts
class AgentExecutionRequest(BaseModel):
    agent_id: str = Field(..., description="Unique agent identifier")
    budget_usd: float = Field(default=1.0, ge=0.01, le=100.0)
    strict_sandbox: bool = True

Read the full file on GitHub · 82 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. yesterday First seen · 82 lines · 30 tokens per session scan A 7d73e74704dc

Subscribe to this mod's changes

python-patterns is a skill published in the GitHub repository DDS-Solutions/AI-TadPole-OS (8 stars, last pushed today), licensed MIT. It adds 30 tokens to every session and 825 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

dd-code-generation

Use pup CLI for immediate Datadog operations or generate code for integration into applications.

DataDog/pup · 16 tokens

adding-personhog-rpc

Guide for adding a new RPC to personhog-replica and personhog-router. Covers eligibility checks, proto definition, code generation for Python and Node.js clients, Rust implementation (storage trait, postgres queries, service handler, router wiring), and index compatibility validation. Use when adding a new gRPC…

PostHog/posthog · 88 tokens

splitting-oversized-modules

Split an oversized Python module (a thousand-plus-line logic.py, models.py, api.py, or its test file) into a package of one module per concern, mechanically and provably without changing behavior. Use on a request to split / break up / decompose a god module or move functions out of one, once a human has agreed to…

PostHog/posthog · 197 tokens

writing-dataclasses

House rules for Python dataclasses in PostHog: when to reach for one instead of a tuple or dict[str, Any], which decorator to use (@frozen from posthog.dataclasses), how to name, construct, consume and evolve them, how to keep secrets out of repr, and when a function should accept a dataclass instead of its unpacked…

PostHog/posthog · 157 tokens

extending-personhog-test-harness

When and how to add scenarios, chaos events, and invariants to the personhog e2e test harness (rust/personhog-test-harness). Use after fixing a bug or regression in the personhog leader path (leader, router, writer, replica, coordination protocol) so the fix gets a permanent regression scenario; when adding a new…

PostHog/posthog · 134 tokens

migrating-llm-gateway-callers

Migrates an LLM caller from services/llm-gateway to PostHog/ai-gateway. Use when adding a gateway caller, converting an existing Python gateway integration, adopting shared Go-capable client builders, changing gateway URLs or headers for a caller, or removing a Python fallback. Inventories the caller's contract…

PostHog/posthog · 102 tokens