← ClaudeAtlas

writing-pythonlisted

How Python is written in this repo — free functions over classes, structured returns instead of mutated arguments, comprehensions, no module state, and the stdlib-only, annotation-free, Python 3.8 dialect the AST lints enforce. Covers modular structure and the import-layer rule, DRY without copying a helper into a second file, what makes a function testable from a `--selftest`, readability rules (guard clauses, named predicates, why-not-what docstrings), and the anti-patterns that have actually bitten here. Use when planning, writing, reading, reviewing or refactoring any `.py` under plugins/audit/, when adding a helper or a new script, when deciding where a function belongs, or when the same logic is about to exist in two places.
AleksandarBisevac/claude-plugins · ★ 4 · Code & Development · score 77
Install: claude install-skill AleksandarBisevac/claude-plugins
# Writing Python here Not a general Python style guide. This repo bans things most guides mandate, and the bans are read out of the AST rather than trusted — `_output.house_style_violations()` fails the build, it does not warn. Everything below is either enforced or measured from the tree as it stands. ## The dialect, in one paragraph Stdlib only. Python 3.8 floor. **No `typing`, no `dataclasses`, no annotations, no walrus, no `from __future__`** — banned by AST, because hooks start on every tool call and the import and parse cost is real. `%`-style formatting; there is not one f-string in the tree. Reach for `os.path`, `json`, `re`, `subprocess` — not for a dependency. 3.8 also rules out things that read as ordinary today: no `X | Y` unions, no `match`, no `dict1 | dict2` merge, no `list[str]`. `vermin -t=3.8-` catches these; it will not catch the banned imports, which is why the AST lint exists alongside it. ## Free functions, structured returns The measured shape of this codebase: **734 top-level functions against 6 classes**, 227 comprehensions, and **6 `global` statements in ~42,000 lines**. That is the pattern to keep. - **Write a function, not a class.** A class here needs a reason you can say out loud — the six that exist are all genuine (a lock, a launcher). Grouping related functions is what a module prefix is for. - **Return a new value; do not mutate an argument.** 181 functions return a dict or tuple. A function that edits the caller's dict in place