modern-python
Modern Python: correct by construction
The throughline: push every check you can out of runtime and into the type
checker and linter, so a whole class of bug can't be constructed in the
first place, rather than being caught (or missed) later. cast(...),
# type: ignore, getattr/hasattr/setattr as a substitute for a real
type, and a defensive if guarding a state your own types already rule out
are all the same signal: a type is wrong or missing somewhere upstream. Fix
the type; don't paper over it.
This is a design philosophy, not a linter config — apply the reasoning behind each reference below to the situation in front of you rather than pattern-matching the examples literally.
How to use this skill
This file is a router, not the content. It stays small on purpose so it doesn't crowd out the actual task — read only the reference file(s) that match what you're doing right now: