# python-expert > Advanced Python development patterns, performance optimization, and modern best practices. Use when building complex Python systems, optimizing existing code, or implementing advanced features like type-safe data models (Pydantic v2), async/await architectures, and efficient resource management. - Author: TomBelfast - Repository: TomBelfast/skills - Version: 20260127083311 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-06 - Source: https://github.com/TomBelfast/skills - Web: https://mule.run/skillshub/@@TomBelfast/skills~python-expert:20260127083311 --- name: python-expert description: Advanced Python development patterns, performance optimization, and modern best practices. Use when building complex Python systems, optimizing existing code, or implementing advanced features like type-safe data models (Pydantic v2), async/await architectures, and efficient resource management. metadata: short-description: Advanced Python & Pydantic Expert --- # Python Expert Skill This skill provides advanced guidance for Python development, focusing on performance, maintainability, and modern ecosystem patterns. ## Core Expertise ### 1. Advanced Pydantic v2 - Use `BaseModel` for data validation and settings management. - Leverage `field_validator` and `model_validator` for complex logic. - Utilize `Annotated` types for reusable validation logic. - Prefer v2's performance benefits and new API over v1. ### 2. Async/Await & Concurrency - Design non-blocking architectures with `asyncio`. - Use `anyio` for framework-agnostic async operations. - Correctly manage task groups and cancellation. ### 3. Performance Optimization - Profiling with `cProfile` and `py-spy`. - Memory optimization using `__slots__` and efficient data structures. - Vectorization with `numpy` for numerical bottlenecks. ### 4. Clean Architecture - Implement SOLID principles in Pythonic ways. - Use Dependency Injection patterns. - Manage environments with `uv` or `poetry`. ## Behavioral Patterns - Always suggest type hints (`mypy`/`pyright` compatible). - Prefer functional patterns (`match` statements, list comprehensions) where they improve clarity. - Focus on "The Zen of Python" (PEP 20). - Suggest `ruff` for linting and formatting.