skills/python-uv/SKILL.md
uv package manager and Python interpreter
npx skillsauth add jcsaaddupuy/badrobots python-uvInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
uv is a fast Rust-based Python package and environment manager. It replaces pip, venv, poetry, and pyenv with a unified tool. Always prefer uv over traditional Python tools.
🚨 NEVER use bare python, pip, or activate venvs manually
✅ ALWAYS use uv run <command> or uv <operation>
uv run <script.py>uv run -m <module>uv run pythonuv run <script-name> (from [project.scripts])uv add <package>uv add --dev <package>uv remove <package>uv syncuv lock --upgradeuv init [name]uv init (in existing directory)uv python listuv python install 3.12uv python pin 3.12uv pip index versions <package>uv pip listuv pip show <package># Run a script (auto-manages venv)
uv run script.py
uv run path/to/script.py
# Run with arguments
uv run script.py --arg value
# Run Python module
uv run -m pytest
uv run -m pytest tests/ -v
uv run -m mypy src/
uv run -m black .
uv run -m ruff check .
# Interactive Python
uv run python
uv run python -c "print('hello')"
# Named script from pyproject.toml
uv run start
uv run dev
uv run test
# Add runtime dependency
uv add requests
uv add "fastapi>=0.100.0"
uv add numpy pandas scikit-learn
# Add dev/test dependencies
uv add --dev pytest pytest-cov
uv add --dev mypy ruff black
uv add --dev ipython
# Remove dependency
uv remove requests
# Sync environment to match pyproject.toml + uv.lock
uv sync
# Sync only production deps (skip dev)
uv sync --no-dev
# Update all dependencies
uv lock --upgrade
# Update specific package
uv lock --upgrade-package requests
# New project with structure
uv init myproject
cd myproject
# Initialize in existing directory
uv init
# Result: Creates pyproject.toml, .python-version, README
# List available Python versions
uv python list
# Install Python version
uv python install 3.12
uv python install 3.11 3.12 # Multiple versions
# Pin project to Python version (creates/updates .python-version)
uv python pin 3.12
# Use specific version for venv
uv venv --python 3.12
uv venv --python 3.11 .venv-311
# Find available versions on PyPI
uv pip index versions requests
# List installed packages
uv pip list
# Show package details
uv pip show requests
# List outdated packages
uv pip list --outdated
# Build wheel/sdist
uv build
# Publish to PyPI
uv publish
# Publish to test PyPI
uv publish --publish-url https://test.pypi.org/legacy/
myproject/
├── pyproject.toml # Project metadata + dependencies
├── uv.lock # Locked dependency versions (commit this!)
├── .python-version # Pinned Python version
├── .venv/ # Virtual environment (DO NOT commit)
├── src/
│ └── myproject/
│ └── __init__.py
└── tests/
# Install deps + run tests
uv sync
uv run pytest
# With coverage
uv run pytest --cov=src tests/
# Check code quality
uv run ruff check .
uv run mypy src/
# Auto-fix
uv run ruff check --fix .
uv run black .
# Install uv (in CI)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install deps from lock
uv sync --frozen # Fails if lock out of date
# Run tests
uv run pytest
FROM python:3.12-slim
RUN pip install uv
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev
COPY . .
CMD ["uv", "run", "start"]
[project]
name = "myapp"
version = "0.1.0"
requires-python = ">=3.11"
dependencies = [
"requests>=2.31.0",
]
[project.optional-dependencies]
dev = [
"pytest>=7.0.0",
"mypy>=1.0.0",
]
[project.scripts]
start = "myapp.main:main"
dev = "myapp.dev:run_dev_server"
[tool.uv]
dev-dependencies = [
"pytest>=7.0.0",
]
3.12
→ Install Python: uv python install 3.12
→ Not in a project: Run uv init or cd to project dir
→ Run uv lock to regenerate lockfile
→ Check package name/version: uv pip index versions <package>
→ Install required version: uv python install <version>
→ Or update .python-version: uv python pin <version>
pip install package → uv add packagepip install -r requirements.txt → uv add (each package) or use uv syncpython script.py → uv run script.pypoetry add package → uv add packagepoetry run python → uv run pythonpoetry install → uv syncpoetry shell → NOT NEEDED (use uv run)python -m venv .venv → uv venvsource .venv/bin/activate → NOT NEEDED (use uv run).venv/bin/python → uv run pythonUser request → Identify operation type:
┌─ Run code?
│ └─ Use: uv run <script|module>
│
┌─ Add dependency?
│ └─ Use: uv add [--dev] <package>
│
┌─ Setup new project?
│ └─ Use: uv init
│
┌─ Install from existing project?
│ └─ Use: uv sync
│
┌─ Change Python version?
│ └─ Use: uv python install <ver> && uv python pin <ver>
│
└─ Query package info?
└─ Use: uv pip index versions <package>
| Task | Command |
|------|---------|
| Run Python file | uv run script.py |
| Run module/tool | uv run -m pytest |
| Add package | uv add requests |
| Add dev package | uv add --dev pytest |
| Sync dependencies | uv sync |
| New project | uv init myproject |
| Install Python | uv python install 3.12 |
| Pin Python version | uv python pin 3.12 |
| Search package | uv pip index versions <pkg> |
| Update deps | uv lock --upgrade |
uv sync after cloning or when deps changeuv run prefix for ALL Python execution--frozen in CI to ensure exact versionsdevelopment
DuckDB patterns for JSON/JSONL analysis, array unnesting, and common gotchas. Use when querying JSON files, nested data, or encountering "UNNEST not supported here" errors.
development
Mealie recipe manager API: recipes, shopping lists, meal plans. Requires MEALIE_BASE_URL and MEALIE_API_KEY.
business
TimeWarrior time tracking: start/stop intervals, query durations by tag or issue, compute totals for issue tracker time reporting
development
Bookmark manager for saving, searching, and annotating web content. Use when: (1) saving a webpage for later reference, (2) searching previously saved bookmarks, (3) adding highlights/annotations to saved content, (4) user asks to 'bookmark this' or 'save this article'. Requires READECK_BASE_URL and READECK_API_KEY environment variables.