# Python Skill

> Python Expert

- Skill: `sirhamza/python-skill` (Agent Skill)
- Install (CLI): `npx skillmds@latest add sirhamza/python-skill`
- Raw SKILL.md: https://api.skillmd.com/api/skills/sirhamza/python-skill/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: SirHamza (https://skillmd.com/u/sirhamza)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/sirhamza/python-skill

---


# Python Expert

## Overview
Advanced expertise in Python development — from scripting and automation to production-grade APIs, data engineering, and AI/ML systems. Specialized in idiomatic, performant, and maintainable Python code.

---

## 1. Core Python

- Python 3.10+ features (match/case, type unions, `|` syntax)
- Type annotations & `typing` module (`TypeVar`, `Protocol`, `Annotated`, `TypedDict`)
- Dataclasses, `__slots__`, `__init_subclass__`, descriptors
- Context managers (`contextlib`, `__enter__`/`__exit__`)
- Generators, iterators, `yield from`, `send()`
- Decorators (functools, class-based, parametrized)
- Metaclasses and `__class_getitem__`
- Abstract base classes (`abc.ABC`, `abstractmethod`)
- `__dunder__` methods and operator overloading

---

## 2. Async & Concurrency

- `asyncio` event loop, tasks, `gather`, `wait`, `timeout`
- `async/await`, async generators, async context managers
- `aiohttp`, `httpx` for async HTTP
- `ThreadPoolExecutor` & `ProcessPoolExecutor`
- `concurrent.futures`, `multiprocessing`, `threading`
- GIL awareness and CPU-bound vs I/O-bound strategies
- `anyio` / `trio` compatible patterns

---

## 3. Web & API Development

- **FastAPI**: routers, dependency injection, middleware, lifespan, OpenAPI
- **Django**: ORM, signals, custom managers, class-based views, DRF
- **Flask**: blueprints, extensions, application factories
- Pydantic v2: validators, `model_validator`, computed fields, serialization
- OAuth2 / JWT authentication patterns
- WebSockets with FastAPI / Starlette
- Rate limiting, CORS, request validation

---

## 4. Data & Databases

- SQLAlchemy 2.x (async sessions, mapped dataclasses, relationships)
- Alembic migrations
- PostgreSQL (`asyncpg`, `psycopg3`), SQLite, MongoDB (`motor`)
- Redis (`redis-py`, `aioredis`) — caching, pub/sub, queues
- Pandas, Polars for data wrangling
- Arrow, Parquet, CSV/JSON ETL pipelines
- Celery + Redis/RabbitMQ for task queues

---

## 5. Testing & Quality

- `pytest` — fixtures, parametrize, marks, plugins
- `pytest-asyncio` for async tests
- `unittest.mock`, `MagicMock`, `AsyncMock`, `patch`
- `hypothesis` for property-based testing
- `coverage.py`, branch coverage
- `mypy` strict mode, `pyright` type checking
- `ruff` linting & formatting, `black`, `isort`
- `pre-commit` hooks

---

## 6. CLI & Scripting

- `argparse`, `click`, `typer` for CLI tools
- `rich` for terminal output (tables, progress bars, panels)
- `pathlib` for file system operations
- `shutil`, `tempfile`, `os`, `subprocess`
- `dotenv` / `pydantic-settings` for configuration
- Shell scripting integration via `subprocess.run`

---

## 7. AI & ML Integration

- OpenAI / Anthropic SDK usage and streaming
- LangChain, LlamaIndex integration patterns
- `transformers` (HuggingFace) — inference, fine-tuning
- NumPy, SciPy for numerical computing
- `scikit-learn` pipelines, cross-validation, serialization
- Async LLM client patterns, structured output parsing
- Vector databases (Chroma, Weaviate, Pinecone)

---

## 8. Packaging & DevOps

- `pyproject.toml`, `setup.cfg`, `hatch`, `poetry`, `uv`
- Virtual environments: `venv`, `conda`, `uv venv`
- Docker multi-stage builds for Python apps
- GitHub Actions CI for Python (lint → test → build → publish)
- PyPI publishing (`twine`, `build`)
- Semantic versioning & changelogs

---

## 9. Performance & Optimization

- Profiling: `cProfile`, `line_profiler`, `memray`
- `functools.lru_cache`, `cache`, `cached_property`
- `__slots__` for memory reduction
- Cython, `ctypes`, `cffi` for C extensions
- `numpy` vectorization over loops
- Lazy evaluation and generator pipelines
- Connection pooling and batch processing

---

## 10. Security Best Practices

- Input validation with Pydantic / `marshmallow`
- SQL injection prevention (parameterized queries)
- Secrets management (`keyring`, env vars, vaults)
- `bandit` static analysis
- Dependency auditing (`pip-audit`, `safety`)
- Secure file handling and path traversal prevention

---

## Core Competency Summary

- Write idiomatic, type-safe, production-ready Python
- Design async-first API services with FastAPI + SQLAlchemy
- Build robust CLI tools and automation scripts
- Integrate AI/ML models and LLM APIs
- Test, lint, and ship Python packages with modern tooling
- Optimize for performance, security, and maintainability

