Core Python development skill for scripts, utilities, and general Python code. Covers uv package management, script dependencies, project setup, and coding standards. Use for Python file creation, running scripts, dependency management, or general Python tasks. For web APIs and servers, see python-backend skill. For testing, see python-testing skill.
/plugin marketplace add btimothy-har/mycc-config/plugin install brian-claude-skills@brian-claudeThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Use Python 3.12+ with the uv package manager for all Python work.
Workflow
Code Quality
except:with for files, connections, locks, and any resource cleanup[] or {} as default argumentsDecision Making
Always execute Python scripts with uv run:
uv run script.py # Run script with inline dependencies
uv run python script.py # Alternative form
For standalone scripts, include inline metadata at the top of the file:
# /// script
# dependencies = [
# "httpx",
# "pandas",
# ]
# requires-python = ">=3.12"
# ///
uv run automatically installs these dependencies in an isolated environment.
For multi-file projects, use pyproject.toml:
uv init project-name # Create new project
uv add package-name # Add dependency
uv add --dev package # Add dev dependency
uv sync # Install all dependencies
uv run python main.py # Run within project
Follow Google Python Style Guide:
pathlib for file operationsexcept:)# /// script
# dependencies = ["typer"]
# requires-python = ">=3.12"
# ///
import typer
def main(name: str, count: int = 1) -> None:
"""Greet someone COUNT times."""
for _ in range(count):
typer.echo(f"Hello, {name}!")
if __name__ == "__main__":
typer.run(main)
# /// script
# dependencies = ["pandas", "httpx"]
# requires-python = ">=3.12"
# ///
import pandas as pd
import httpx
def fetch_and_process(url: str) -> pd.DataFrame:
"""Fetch JSON data and return as DataFrame."""
response = httpx.get(url)
response.raise_for_status()
return pd.DataFrame(response.json())
# /// script
# dependencies = ["httpx"]
# requires-python = ">=3.12"
# ///
import asyncio
import httpx
async def fetch_all(urls: list[str]) -> list[dict]:
"""Fetch multiple URLs concurrently."""
async with httpx.AsyncClient() as client:
tasks = [client.get(url) for url in urls]
responses = await asyncio.gather(*tasks)
return [r.json() for r in responses]
if __name__ == "__main__":
results = asyncio.run(fetch_all(["https://api.example.com/1"]))
| Use Case | Preferred Library |
|---|---|
| HTTP client | httpx |
| Data manipulation | pandas, polars |
| Data validation | pydantic |
| CLI tools | typer, click |
| File paths | pathlib (stdlib) |
| Date/time | datetime, zoneinfo (stdlib) |
| JSON/config | tomllib, json (stdlib) |
When scripts fail:
uv run --verbose for detailed outputuv run python -c "import package"