Python Patterns¶
Workflow¶
- Respect the project's Python version and existing conventions. For new code prefer dataclasses, type hints, pathlib and explicit validation.
- Use uv for environments and dependency management; prefer unittest for a new stdlib-oriented toolkit and Typer for a richer CLI when an added dependency is justified.
- Use a validation library at external boundaries when the project already uses it or requirements justify it; do not mandate Pydantic for every domain object.
- Use small functions and protocols at real substitution boundaries. Avoid unnecessary repository, event-bus or inheritance layers.
- Close resources, preserve tracebacks and use timezone-aware timestamps. Test behavior and boundary failures with minimal mocking.
Completion¶
Return the concrete result, verification evidence and any material unresolved limitation. Keep documentation proportional to the change and preserve human feedback.
Focused references¶
- Detailed examples: load only the section relevant to the task.
Canonical source: skills/python-patterns/SKILL.md.