language-python
Installation
SKILL.md
Python
Type hints
- Annotate all function signatures;
Anyis a smell unless at a genuine boundary. - Use
dataclassfor data containers with behavior;TypedDictfor dict-shaped data at boundaries. - Prefer
Protocolover ABC when duck typing suffices — no inheritance required. from __future__ import annotationsfor forward refs in 3.9 and earlier.
from dataclasses import dataclass, field
@dataclass
class Order:
id: str
items: list[str] = field(default_factory=list)
total: float = 0.0