uv — Claude Code skill: what it does, how to install
Directs AI coding assistants to manage Python projects and scripts with uv instead of pip or poetry. Handles lockfiles, dependencies, and tool execution.
npx skills add astral-sh/claude-code-plugins --skill uv -a claude-codeWhat uv does
This skill guides coding agents to run Python tasks through uv rather than tools like pip, virtualenv, pip-tools, or pyenv. When the agent sees a uv.lock file or uv headers in requirements files, it turns to uv run, uv add, and uv sync. It also replaces manual virtual environment management with direct script execution.
The instruction defines four specific workflows: standalone scripts, projects with pyproject.toml, command-line tools, and legacy setups with requirements.txt. For tools like ruff or pytest, the assistant runs uvx instead of installing them globally. The legacy uv pip interface is kept strictly for situations where a lockfile is absent.
The skill instructs the agent to leave projects with poetry.lock or pdm.lock alone to prevent breaking existing setups. Because uvx pulls packages directly from PyPI by name, the guide warns agents to run only familiar utilities.
What it helps with
- migrate existing pip, pyenv, and pipx workflows to uv commands
- execute standalone Python scripts with ad-hoc dependencies via
uv run - lock and sync Python dependencies in
pyproject.tomlwithout manual venv activation - run CLI utilities like ruff or pytest via
uvxwithout installing them
Example prompts for the agent
- Add requests to this project and sync dependencies using uv
- Run script.py with requests included without activating a virtualenv
- Run ruff check across the project using uvx
How to install uv
1Skills CLI (Vercel)
npx skills add astral-sh/claude-code-plugins --skill uv -a claude-code2Manually: put the files in place
~/.claude/skills/uv/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/uv/
1Skills CLI (Vercel)
npx skills add astral-sh/claude-code-plugins --skill uv -a codex2Manually: put the files in place
.agents/skills/uv/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add astral-sh/claude-code-plugins --skill uv -a cursor2Manually: put the files in place
.cursor/skills/uv/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install astral-sh/claude-code-plugins uv2Manually: put the files in place
.github/skills/uv/SKILL.md1Skills CLI (Vercel)
npx skills add astral-sh/claude-code-plugins --skill uv -a gemini-cli2Platform CLI
gemini skills install https://github.com/astral-sh/claude-code-plugins --path plugins/astral/skills/uvManually: put the files in place
.devin/skills/uv/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add astral-sh/claude-code-plugins --skill uv -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about uv
How to install uv in Claude Code?
Run npx skills add astral-sh/claude-code-plugins --skill uv -a claude-code in your terminal.
What does the uv skill do?
It provides guidelines for dependency resolution, project initialization, script execution, and running tools via uvx instead of pip or virtualenv.
When does the skill avoid using uv?
The guide instructs the agent to skip uv if it detects poetry.lock or pdm.lock in the repository, leaving those projects to their native package managers.
Source text
SKILL.md · Apache-2.0
--- name: uv description: Guide for using uv, the Python package and project manager. Use this when working with Python projects, scripts, packages, or tools. --- # uv uv is an extremely fast Python package and project manager. It replaces pip, pip-tools, pipx, pyenv, virtualenv, poetry, etc. ## When to use uv **Always use uv for Python work**, especially if you see: - The `uv.lock` file - uv headers in `requirements*` files, e.g., "This file was autogenerated by uv" Don't use uv in projects managed by other tools: - Poetry projects (identifiable by `poetry.lock` file) - PDM projects (identifiable by `pdm.lock` file) ## Choosing the right workflow ### Scripts **Use when:** Running single Python files and standalone scripts. **Key commands:** ```bash uv run script.py # Run a script uv run --with requests script.py # Run with additional packages uv add --script script.py requests # Add dependencies inline to the script ``` ### Projects **Use when:** There is a `pyproject.toml` or `uv.lock` **Key commands:** ```bash uv init # Create new project uv add requests # Add dependency uv remove requests # Remove dependency uv sync # Install from lockfile uv run <command> # Run commands in environment uv run python -c "" # Run Python in project environment uv run -p 3.12 <command> # Run with specific Python version ``` ### Tools **Use when:** Running command-line tools (e.g., ruff, ty, pytest) without installation. **Key commands:** ```bash uvx <tool> <args> # Run a tool without installation uvx <tool>@<version> <args> # Run a specific version of a tool ``` **Important:** - `uvx` runs tools from PyPI by package name. This can be unsafe - only run well-known tools. - Only use `uv tool install` only when specifically requested by the user. ### Pip interface **Use when:** Legacy workflows with `requirements.txt` or manual environment management, no `uv.lock` present. **Key commands:** ```bash uv venv uv pip install -r requirements.txt uv pip compile requirements.in -o requirements.txt uv pip sync requirements.txt # Platform independent resolution uv pip compile --universal requirements.in -o requirements.txt ``` **Important:** - Don't use the pip interface unless clearly needed. - Don't introduce new `requirements.txt` files. - Prefer `uv init` for new projects. ## Migrating from other tools ### pyenv → uv python ```bash pyenv install 3.12 → uv python install 3.12 pyenv versions → uv python list --only-installed pyenv local 3.12 → uv python pin 3.12 pyenv global 3.12 → uv python install 3.12 --default ``` ### pipx → uvx ```bash pipx run ruff → uvx ruff pipx install ruff → uv tool install ruff pipx upgrade ruff → uv tool upgrade ruff pipx list → uv tool list ``` ### pip and pip-tools → uv pip ```bash pip install package → uv pip install package pip install -r req.txt → uv pip install -r req.txt pip freeze → uv pip freeze pip-compile req.in → uv pip compile req.in pip-sync req.txt → uv pip sync req.txt virtualenv .venv → uv venv ``` ## Common patterns ### Don't use pip in uv projects ```bash # Bad pip install requests # Good uv add requests ``` ### Don't run python directly ```bash # Bad python script.py # Good uv run script.py ``` ```bash # Bad python -c "..." # Good uv run python -c "..." ``` ```bash # Bad python3.12 -c "..." # Good uvx [email protected] -c "..." ``` ### Don't manually manage environments in uv projects ```bash # Bad python -m venv .venv source .venv/bin/activate # Good uv run <command> ``` ## Documentation For detailed information, read the official documentation: - https://docs.astral.sh/uv/llms.txt The documentation links to specific pages for each of these workflows.
© astral-sh · Apache-2.0 · astral-sh/claude-code-plugins