Python patterns for typing, project layout, async, errors, logging, metrics, and packaging. Load before any edit to a .py file or pyproject.toml, however small, and for Python questions.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Python Patterns?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ku5ic-python-patterns)
---
name: python-patterns
description: Python patterns for typing, project layout, async, errors, logging, metrics, and packaging. Load before any edit to a .py file or pyproject.toml, however small, and for Python questions.
---
# Python patterns
Default assumption: Python 3.11, the oldest release the Python devguide still supports; 3.15 is current, per the Python release notes.
A Python row applies when the project's `requires-python` in `pyproject.toml`, or its `.python-version` or `.tool-versions`, is at least the row's version. A ruff, mypy, uv, Poetry, structlog, or prometheus-client row applies when the version of that tool the project pins, in `pyproject.toml`, a requirements file, or the lockfile, is at least the row's version, else when its installed `--version` is.
## Reference files
Loading this skill isn't enough. Before your next edit, read the file of every row that matches it. The rules live in those files, and this one only points at them.
| Before | Read |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| Writing Python code, or raising the Python version or a tool's | [reference/upgrades.md](reference/upgrades.md) |
| Writing, changing, or reviewing Python code | [reference/anti-patterns.md](reference/anti-patterns.md) |
| Writing types, async code, errors, standard-library idioms, Pydantic models, imports, packaging, logging or structlog config, or prometheus-client metrics | [reference/practices.md](reference/practices.md) |
| Editing `pyproject.toml`, or configuring ruff, mypy, or pyright | [reference/tooling.md](reference/tooling.md) |