python-idioms

python-idioms is a skill for Claude Code, Codex from irahardianto/awesome-agv. It costs 29 tokens per session (4,231 once invoked), scanned A, original, MIT.

A guide to Python coding practices using type hints, protocols, Pydantic, asynchronous code, pytest, Ruff, and mypy.

In plain words
What is it for?
Use it when building or reviewing Python projects, especially code involving input validation, asynchronous work, or file and network operations.
Why use it?
It helps make Python code clearer and catches style, typing, and test problems earlier.

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

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/irahardianto/awesome-agv/python-idioms.svg)](https://agentmods.dev/skills/irahardianto/awesome-agv/python-idioms)
Your own site
<a href="https://agentmods.dev/skills/irahardianto/awesome-agv/python-idioms"><img src="https://agentmods.dev/badge/skills/irahardianto/awesome-agv/python-idioms.svg" alt="Measured on agentmods" height="20"></a>
Per session 29 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,231 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.00029 $0.04231
Opus 5 $0.00015 $0.02116
Sonnet 5 $0.00006 $0.00846
Haiku 4.5 $0.00003 $0.00423

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

Security

Grade A, and why

python-idioms 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.

.agents/skills/python-idioms/SKILL.md · 444 lines

How it starts

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

Python Idioms and Patterns

Core Philosophy

Python rewards explicitness and readability over cleverness. Follow the Zen of Python. If it reads like plain English, it's probably idiomatic.

Scope: This skill covers Python-specific coding idioms. For file layout see references/project-structure.md. For safety/SAST/performance patterns see references/python-patterns-and-anti-patterns.md. For logging see logging-implementation skill. For quality commands see code-idioms-and-conventions rule.

Loading Guards

  • If no pyproject.toml or *.py files, this skill does not apply
  • If Django project (django in dependencies), co-load django-idioms skill alongside this one

When to Load References

Situation Reference to Load
Starting a new project or setting up file layout references/project-structure.md
Choosing packages, pyproject.toml setup, or ruff config references/recommended-dependencies.md
Writing code that handles user input, async operations, or I/O references/python-patterns-and-anti-patterns.md

Toolchain and Python Version

  • Default to latest stable Python. As of August 2026, Python 3.14. Minimum target: 3.13+.
  • Key version milestones:
    • 3.14+ — Deferred evaluation of annotations (PEP 649, no more from __future__ import annotations), template strings (PEP 750)
    • 3.13+ — Improved error messages, experimental free-threaded build, experimental JIT
    • 3.12+ — Type parameter syntax type X = ... (PEP 695), @override decorator, improved f-strings, itertools.batched
    • 3.11+StrEnum, ExceptionGroup + except*, asyncio.TaskGroup, tomllib, fine-grained error locations
    • 3.10+ — Pattern matching (match/case), X | Y union syntax, TypeAlias

Type Hints — Non-Negotiable

Type hints are required for all public APIs, class attributes, and function signatures.

  • Use standard collections (list, dict, set) for typing, not typing.List etc.
  • Use X | Y instead of Union[X, Y] or Optional[X].
  • Use PEP 695 type parameter syntax (3.12+) for generic types: type Vector[T] = list[T]
  • Use @override (3.12+) to ensure methods actually override a base class method.
  • Use TypeVar with constraints and bounds when necessary.
  • Use Never for functions that always raise an exception or never return.

Read the full file on GitHub · 444 lines

Files

What ships with it

3 files 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 · 444 lines · 29 tokens per session scan A 94455f90e0b3

Subscribe to this mod's changes

python-idioms is a skill published in the GitHub repository irahardianto/awesome-agv (156 stars, last pushed 14d ago), licensed MIT. It adds 29 tokens to every session and 4,231 once invoked, about $0.0001 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.