Python Native

STRICT: stdlib idioms are mandatory — reinventing a stdlib feature is a defect, not a style choice. Apply whenever the user writes, refactors, optimizes, or reviews Python, including one-liners and code-review feedback. MANDATORY: check references/ locally first, then WebFetch docs.python.org for every non-trivial stdlib API before using it — memory alone is a defect. Replaces common reinventions: manual dict counters with `Counter`, `dict.setdefault` loops with `defaultdict`, `isinstance` chains with `singledispatch` or `match`/`case`, hand-rolled memoization with `functools.cache`, `os.path.join` with `pathlib.Path`, `sorted(...)[:k]` with `heapq.nlargest`, manual class boilerplate with `dataclass(slots=True, frozen=True)`, `zip(lst, lst[1:])` with `itertools.pairwise`. Covers Python 3.9-3.14 via references/python-3.X.md. Trigger phrases: "write a Python function", "refactor this Python", "Pythonic way to X", "optimize Python code", "implement X in Python", or any task whose answer involves Python source.

crag666 88115c4 9 files · 90.1 KB Updated

File contents

crag666/dotfiles/tree/main/skills/python-native commit 88115c4cbf

Frequently asked questions

npx skillmds@latest add crag666/python-native