← ClaudeAtlas

standards-pythonlisted

Python coding standards — strict type annotations, frozen dataclasses and immutability, Protocol-based interfaces, pydantic at boundaries, pytest with 80% coverage, bandit scanning, black/isort/ruff. Use when writing, reviewing, or testing Python code.
axrmxv/claude-config · ★ 1 · AI & Automation · score 70
Install: claude install-skill axrmxv/claude-config
# Python Standards The Python delta over the always-loaded rules in `.claude/rules/common/`. Nothing here restates a rule from `common/` — read this alongside it, not instead of it. ## What applies immediately - **Annotate every public signature**, parameters and return type. No bare `Any` to appease the type checker — use a precise type, a `Protocol`, or a generic. - **PEP 8 naming**: `snake_case` for functions and modules, `PascalCase` for classes, `UPPER_SNAKE_CASE` for constants. The naming section in `common/coding-style.md` is JS/TS-flavored and does **not** apply here. - **Frozen dataclasses** for values you pass around or expose. - **Fail fast on missing secrets** — `os.environ["KEY"]` raises at startup; beyond a small script use a typed settings object. - **Formatting is not your job**: `black`, `isort`, and `ruff` own it. Configure them in `pyproject.toml`; do not hand-maintain PEP 8 details. ## Reference files Read the one that matches what you are doing: | File | Covers | |------|--------| | [coding-style.md](coding-style.md) | Type annotations, naming, immutability, formatting/lint ownership | | [patterns.md](patterns.md) | `Protocol` duck typing, dataclass vs pydantic DTOs, context managers, generators | | [security.md](security.md) | Secret management from the environment, `bandit` scanning | | [testing.md](testing.md) | pytest, pytest-asyncio, coverage command, `pytest.mark` categorisation | | [hooks.md](hooks.md) | PostToolUse formatting and t