python
Use when the user asks about Python with uv, pyproject.toml, packaging, type hints and mypy, pytest, asyncio, virtual environments or Python performance…
от j4flmao★ 47 звёзд на GitHub
Установить python в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Python
Purpose
Guide for Python build tools, package management, virtual environments, type annotations, async patterns, testing, and production deployment.
Agent Protocol
Trigger
Keywords: python build, pip, poetry, uv, pyproject.toml, venv, mypy, pytest, async python, celery, fastapi, django.
Input Context
- Project type (CLI tool, web API, data pipeline, library)
- Build system (setuptools, poetry, pdm, uv)
- Python version requirements
- Deployment target (serverless, container, VPS)
Output Artifact
Build configuration, dependency management setup, project structure, test configuration, and deployment config tailored to project type.
Response Format
Python: {3.x} Tooling: uv
Change: {what and why}
Code/config: {snippet}
Verify: uv run ruff check . && uv run mypy src && uv run pytest -q
Decision Trees
Build Tool Selection
Project type?
├── Library (distributed on PyPI)
│ ├── Simple → setuptools + pyproject.toml (built-in, no extra deps)
│ └── Modern → hatchling / flit (fast, standards-compliant)
├── Application (web API, CLI tool, service)
│ ├── Any supported Python → uv (default for this org: fast, unified, lockfile, manages interpreters)
│ ├── Monorepo → uv workspaces (one lockfile, many packages)
│ └── Team standard → Poetry (lock file, dependency resolution, publish)
└── Data science / ML → conda / mamba (binary packages, CUDA support)
Virtual Environment Strategy
Deployment context?
├── Containerized (Docker) → single venv in container, no system Python
├── Local development → uv (manages Python versions and the project venv; pyenv + venv is the legacy route)
├── CI/CD → fresh venv per run (cache pip/uv between runs)
└── Monorepo → PDM workspace / hatch.env per project
Async Framework Selection
Web API needed?
├── High-performance async API → FastAPI (async-native, Pydantic, OpenAPI)
├── Full-featured web app → Django (sync, async-capable since 3.0, ORM, admin)
├── Lightweight async → Starlette (minimal, FastAPI foundation)
├── Real-time / WebSocket → FastAPI + WebSocket / Socket.IO
└── Background tasks → Celery + Redis/RabbitMQ or FastAPI BackgroundTasks
Build & Package Management
pyproject.toml (Modern Standard)
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "myproject"
version = "0.1.0"
requires-python = ">=3.11"
dependencies = [
"fastapi>=0.100",
"pydantic>=2.0",
"sqlalchemy>=2.0",
]
[project.optional-dependencies]
dev = ["pytest>=8", "mypy>=1.0", "ruff>=0.1"]
prod = ["uvicorn[standard]", "gunicorn"]
[tool.ruff]
line-length = 100
select = ["E", "F", "I", "N", "W", "UP", "B"]
ignore = ["E501"]
[tool.mypy]
strict = true
python_version = "3.11"
Poetry
[tool.poetry]
name = "myproject"
version = "0.1.0"
python = "^3.11"
[tool.poetry.dependencies]
fastapi = "^0.100"
pydantic = "^2.0"
[tool.poetry.group.dev.dependencies]
pytest = "^8.0"
ruff = "^0.1"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
poetry new myproject
poetry add fastapi
poetry add --group dev pytest
poetry run python -m myproject
poetry build
poetry publish
uv (Fastest, Rust-based)
# Install (prefer a package manager; if you use the installer script,
# download it, review it, then run it)
brew install uv # or: winget install --id=astral-sh.uv -e / pipx install uv
# Commands
uv init myproject
uv add fastapi
uv add --dev pytest
uv sync
uv run python -m myproject
uv pip install -r requirements.txt # pip-compatible
Language-Specific Patterns
Type Annotations (PEP 484+)
from collections.abc import Sequence
from typing import assert_never, Literal, Never, TypeAlias, override
UserID: TypeAlias = int
Status: TypeAlias = Literal["active", "inactive", "banned"]
class User:
id: UserID
status: Status
@override # PEP 698 (Python 3.12+)
def __str__(self) -> str: ...
def process_users(users: Sequence[User]) -> list[User]:
...
# Narrowing with TypeGuard
def is_active(user: User) -> TypeGuard[User]:
return user.status == "active"
# Never type for exhaustive matching
def assert_exhaustive(x: Never) -> Never:
raise RuntimeError(f"Unexpected: {x}")
Async/Await Patterns
import asyncio
from asyncio import TaskGroup, Semaphore
# Structured concurrency (Python 3.11+)
async def process_all():
async with TaskGroup() as tg:
for item in items:
tg.create_task(process(item))
# Semaphore for rate limiting
sem = Semaphore(10)
async def rate_limited_fetch(url: str) -> bytes:
async with sem:
return await fetch(url)
# Async context manager
class DatabaseConnection:
async def __aenter__(self): ...
async def __aexit__(self, *args): ...
# Task timeout
async def fetch_with_timeout():
try:
async with asyncio.timeout(5.0):
return await fetch(
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/design-patterns-generics.md
- references/generics-advanced-hints.md
- references/generics-runtime-validation.md
- references/generics-typevar-protocols.md
- references/packaging-dependency.md
- references/python-advanced.md
- references/python-fastapi.md
- references/python-fundamentals.md
- references/type-annotations.md
FAQ
Что делает скилл python?
Use when the user asks about Python with uv, pyproject.toml, packaging, type hints and mypy, pytest, asyncio, virtual environments or Python performance. Produces a uv-managed project, typed code and tests. Not for FastAPI or Django architecture (use python-fastapi-architecture or python-django-architecture) or ML training (use ml-deep-learning).
Как установить скилл python?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл python запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…