zen-of-python
Installation
SKILL.md
Zen of Python
Operational guide to PEP 20 for writing and reviewing Python. Principles, not rules — apply with judgment.
How to use
- Writing code: internalize the principles, then run the checklist on the draft. Don't over-correct tiny snippets.
- Reviewing code: scan against the checklist, flag issues, propose a rewrite.
- Inline comments: when a non-obvious choice traces back to a principle, add a short comment referencing it (e.g.
# flat > nested). 0–3 per function. Often zero for snippets ≤10 lines. - Don't lecture the user about PEP 20 in prose. Apply silently. Mention an aphorism only when explaining a concrete change.
Principles in practice
Beautiful > ugly. Code is read more than written. Rewrite gnarly chains, cryptic one-liners, names like x2/tmp/data2.
Explicit > implicit. Type hints on public functions. Named args when there are 3+. No import *. Function names should reveal side effects (get_user shouldn't write to a DB). But: truthiness checks and duck typing are fine when types are unambiguous — explicit ≠ verbose.
Simple > complex. Prefer fewer moving parts. No class hierarchy where a function works. No async for sync calls.