From python-idioms
Use when writing or reviewing Python (3.10+) — modern idioms for typing, data modeling, control flow, and standard-library use, plus the anti-patterns to avoid (mutable default args, bare except, manual index loops, string-built paths).
How this skill is triggered — by the user, by Claude, or both
Slash command
/python-idioms:writing-idiomatic-pythonThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Idiomatic Python is readable, explicit where it counts, and leans on the standard library and
Idiomatic Python is readable, explicit where it counts, and leans on the standard library and the language's protocols rather than reinventing them. Target 3.10+.
list[int],
dict[str, int]), X | None over Optional[X], and from __future__ import annotations
only when you need forward refs.@dataclass (or typing.NamedTuple) over hand-written __init__/__eq__.typing.Protocol for structural typing instead of forcing inheritance.try/except around the operation rather than pre-checking, when the
happy path dominates.match for structural dispatch over long isinstance chains.return over deep nesting.pathlib.Path for filesystem paths, never string concatenation or os.path for new code.enumerate / zip instead of range(len(...)) index gymnastics.with (context managers) for files, locks, and any acquire/release pair.collections (defaultdict, Counter), itertools, and functools (cache, reduce)
before hand-rolling.f"…" for formatting; logging, not print, for diagnostics.def f(x=[])) — use None and create inside.except: or except Exception that swallows — catch specific types, re-raise or log.None/True with == instead of is.with.import *; deep wildcard imports.Run a formatter and linter (Black/Ruff) — idioms are about the patterns above, not whitespace. American English in identifiers and comments.
Searches MemPalace before answering questions about past work, people, projects, or prior decisions. Returns verbatim stored content instead of guessing from model memory.
Guides Payload CMS config (payload.config.ts), collections, fields, hooks, access control, APIs. Debugs validation errors, security, relationships, queries, transactions, hook behavior.
Implements vector databases with Pinecone, Weaviate, Qdrant, Milvus, pgvector for semantic search, RAG, recommendations, and similarity systems. Optimizes embeddings, indexing, and hybrid search.
npx claudepluginhub meaganewaller/rosetta --plugin python-idioms