Python Patterns

Python Patterns is a skill for Claude Code, Codex from AmariahAK/atlarix-skills. It costs 2 tokens per session (1,139 once invoked), scanned A, original, Apache-2.0.

A set of coding guidelines for modern Python programs, including services, command-line tools, scripts, and data tools. It covers type hints, input validation, asynchronous code, structure, packaging, and tests.

In plain words
What is it for?
Use it when writing or reviewing Python applications, APIs, command-line tools, automation scripts, or data-processing code.
Why use it?
It helps catch mistakes at system boundaries and keeps data, asynchronous operations, and internal code predictable.

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/amariahak/atlarix-skills/python
Any agent
npx skills add AmariahAK/atlarix-skills --skill python
Clone the repo
git clone --depth 1 https://github.com/AmariahAK/atlarix-skills

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/amariahak/atlarix-skills/python.svg)](https://agentmods.dev/skills/amariahak/atlarix-skills/python)
Your own site
<a href="https://agentmods.dev/skills/amariahak/atlarix-skills/python"><img src="https://agentmods.dev/badge/skills/amariahak/atlarix-skills/python.svg" alt="Measured on agentmods" height="20"></a>
Per session 2 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,139 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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 $0.00002 $0.01139
Opus 5 $0.00001 $0.00570
Sonnet 5 $0.00000 $0.00228
Haiku 4.5 $0.00000 $0.00114

Measured yesterday against content hash 9936bdc37500, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

Python Patterns 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 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.

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.

skills/python/SKILL.md · 155 lines

How it starts

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

Python Patterns

When to use this skill

Use this skill when writing or reviewing modern Python code and you want consistent patterns for typing, async, structure, packaging, and correctness (especially in services, scripts, CLIs, and data tooling).

Core patterns

Type hints everywhere (and no bare dict)

Rules:

  • Prefer precise types: dict[str, Any], Mapping[str, Any], Sequence[T]
  • Use Any only at boundaries, not internally
  • Prefer Protocol or TypedDict for structural contracts

Examples:

from typing import Any

def parse_payload(payload: dict[str, Any]) -> tuple[str, int]:
    user_id = str(payload["user_id"])
    count = int(payload.get("count", 0))
    return user_id, count

Dataclasses vs TypedDict vs Pydantic

Use:

  • dataclass: internal domain objects, immutable-ish value types
  • TypedDict: dict-shaped external payloads (JSON) when you want structural typing
  • pydantic (or similar): validation + parsing at boundaries (API inputs, configs)

Pattern:

  • Validate at boundaries, keep core logic on typed objects.

Async patterns (avoid mixing sync/async)

Rules:

  • If a call chain is async, keep it async.
  • Do not call blocking IO inside async def (use thread pool or async libs).
  • Prefer httpx.AsyncClient, async DB drivers, async queues.

Good:

import httpx

async def fetch_json(url: str) -> dict[str, object]:
    async with httpx.AsyncClient(timeout=10.0) as client:
        r = await client.get(url)
        r.raise_for_status()
        return r.json()

Avoid:

  • requests inside async def
  • time.sleep() inside async code (use await asyncio.sleep())

Project structure (src/ layout)

Prefer:

repo/
  pyproject.toml
  src/
    mypkg/
      __init__.py
      api.py
      services/
      cli/
  tests/

Benefits:

  • prevents accidental imports from repo root
  • clearer packaging boundaries

Virtual environments

Preferred:

  • uv for fast env + installs (if team agrees)

Fallback:

  • python -m venv .venv
  • pip install -r requirements.txt

Read the full file on GitHub · 155 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. yesterday First seen · 155 lines · 2 tokens per session scan A 9936bdc37500

Subscribe to this mod's changes

Python Patterns is a skill published in the GitHub repository AmariahAK/atlarix-skills (2 stars, last pushed 4d ago), licensed Apache-2.0. It adds 2 tokens to every session and 1,139 once invoked, about $0.0000 per session on Opus 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-09-03.

Related

Other skills, from other repositories

python

Use when the task is Python itself, in any framework or none: PEP 695 generics, mypy --strict typing, dataclass/Protocol/TypedDict/Enum choices, asyncio.TaskGroup, stdlib idioms, src/ layout + pyproject.toml with uv, ruff+mypy+pytest gate. NOT a FastAPI/ASGI service (that is fastapi), NOT a deep pytest suite (that is…

ericrisco/rsc-harness · 94 tokens

python-docs

Comprehensive Python 3.13 reference covering all language features: variables, built-in types, strings, control flow, functions, lambdas, decorators, classes, inheritance, dataclasses, enums, metaclasses, collections (list, dict, set, tuple, comprehensions), modules and packages, pip, venv, exceptions, context…

pledgeandgrow/pledge-skills · 251 tokens

python

Python programming patterns and best practices.

miles990/claude-software-skills · 8 tokens

quantum-qiskit

Reference qiskit 2.x patterns for variational quantum machine learning. Covers data-encoding feature maps, variational quantum classifier (VQC) training, variational quantum eigensolver (VQE) for chemistry, matrix-product-state circuits, and noise model integration. Use when writing Python code that imports qiskit…

aiming-lab/AutoResearchClaw · 102 tokens

biology-biopython

Bioinformatics with Biopython for sequence manipulation, file parsing, BLAST, and phylogenetics. Use when working with DNA/RNA/protein sequences or biological databases.

aiming-lab/AutoResearchClaw · 40 tokens

chemistry-rdkit

Computational chemistry with RDKit for molecular analysis, descriptors, fingerprints, and substructure search. Use when working with SMILES, drug discovery, or cheminformatics tasks.

aiming-lab/AutoResearchClaw · 41 tokens