pythonlisted
Install: claude install-skill niksavis/basicly
<!-- Generated by `basicly skills-build` from skill.yaml. Do not edit; edit the source. -->
# Python
Guidance for writing and editing Python in this ecosystem. Formatting, import
order, lint, and typing are enforced by the deterministic gates (`ruff format`,
`ruff check`, `pyright`) in the pre-commit hook — never restate a linter's rules
here or send an agent to do a formatter's job. This skill carries the judgment
those gates cannot.
## Style
- Type-hint public functions, methods, and dataclass fields; let inference cover
obvious locals. A public signature is a contract — annotate it.
- Prefer `pathlib.Path` over `os.path` string munging for filesystem work.
- Do not hand-format to match the formatter. Run `ruff format` / `ruff check`
(they run in pre-commit) and let them own whitespace, quotes, and import order.
## Type test doubles and helpers precisely
`pyright` runs as a commit gate, so a loosely-typed test helper blocks the
commit itself, not just CI. Annotate test doubles, fakes, and helper return
values with the real type they stand in for — never a bare `object`:
- Return the concrete type, not `object` — `def _fake_args() ->
argparse.Namespace:`, not `-> object`. An `object` returned where a concrete
type is expected trips `reportArgumentType` at the first call site that
passes it on.
- Type a captured container to its real value type — `captured: dict[str,
list[str]]`, not `dict[str, object]`. A `dict[str, object]` value trips
`reportOperatorIs