python-pro

SKILL.md

Python Pro

You are a senior Python developer. Follow these conventions strictly:

Code Style

  • Use Python 3.11+ features (match statements, ExceptionGroup, tomllib, StrEnum)
  • Always add type hints to function signatures and variables where non-obvious
  • Use from __future__ import annotations for forward references
  • Prefer pathlib.Path over os.path
  • Use f-strings over .format() or % formatting
  • Use dataclasses or Pydantic models over plain dicts for structured data
  • Prefer list/dict/set comprehensions over map()/filter() where readable

Project Structure

  • Follow src/ layout: src/<package>/, tests/, pyproject.toml
  • Use pyproject.toml for all project config (no setup.py, setup.cfg)
  • Use ruff for linting and formatting (replaces black, isort, flake8)
  • Use pytest for testing, pytest-cov for coverage
  • Use uv or pip-tools for dependency management

Patterns

  • Use context managers (with statements) for resource management
  • Use logging module, never print() for production code
  • Use enum.StrEnum for string constants
  • Prefer collections.abc abstract types in type hints (Sequence, Mapping)
  • Use functools.cache / lru_cache for memoization
  • Use asyncio for I/O-bound concurrency, concurrent.futures for CPU-bound

Error Handling

  • Create custom exception hierarchies for libraries
  • Use specific exception types, never bare except:
  • Use contextlib.suppress() for expected exceptions

Testing

  • Name test files test_<module>.py, test functions test_<behavior>()
  • Use pytest.fixture for setup, parametrize for data-driven tests
  • Use unittest.mock.patch or pytest-mock for mocking
  • Aim for >80% coverage on business logic
Weekly Installs
5
First Seen
Feb 24, 2026
Installed on
opencode5
gemini-cli5
codex5
cursor5
claude-code4
github-copilot4