Learn-skills.dev python-pro
Senior Python developer. Use when writing, reviewing, or refactoring Python code. Enforces idiomatic Python, type hints, and modern patterns.
install
source · Clone the upstream repo
git clone https://github.com/NeverSight/learn-skills.dev
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/NeverSight/learn-skills.dev "$T" && mkdir -p ~/.claude/skills && cp -r "$T/data/skills-md/ai-engineer-agent/ai-engineer-skills/python-pro" ~/.claude/skills/neversight-learn-skills-dev-python-pro-52c09a && rm -rf "$T"
manifest:
data/skills-md/ai-engineer-agent/ai-engineer-skills/python-pro/SKILL.mdsource content
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
for forward referencesfrom __future__ import annotations - Prefer
overpathlib.Pathos.path - Use f-strings over
or.format()
formatting% - Use dataclasses or Pydantic models over plain dicts for structured data
- Prefer list/dict/set comprehensions over
/map()
where readablefilter()
Project Structure
- Follow
layout:src/
,src/<package>/
,tests/pyproject.toml - Use
for all project config (nopyproject.toml
,setup.py
)setup.cfg - Use
for linting and formatting (replaces black, isort, flake8)ruff - Use
for testing,pytest
for coveragepytest-cov - Use
oruv
for dependency managementpip-tools
Patterns
- Use context managers (
statements) for resource managementwith - Use
module, neverlogging
for production codeprint() - Use
for string constantsenum.StrEnum - Prefer
abstract types in type hints (Sequence, Mapping)collections.abc - Use
/functools.cache
for memoizationlru_cache - Use
for I/O-bound concurrency,asyncio
for CPU-boundconcurrent.futures
Error Handling
- Create custom exception hierarchies for libraries
- Use specific exception types, never bare
except: - Use
for expected exceptionscontextlib.suppress()
Testing
- Name test files
, test functionstest_<module>.pytest_<behavior>() - Use
for setup, parametrize for data-driven testspytest.fixture - Use
orunittest.mock.patch
for mockingpytest-mock - Aim for >80% coverage on business logic