Skip to content
Agent Orchestration
Skill

/uv

Use this skill when using UV (Python package manager), needs to set up Python virtual environments, install/manage Python CLI tools, migrate from pip/pipx to UV, Python version management, or troubleshoot UV-related issues.

BOOST
From plugin
dotfiles-opencode
10845 skills
Install
$ npx -y skills add archibate/dotfiles-opencode --skill uv --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/uv

Context preview

The summary Claude sees to decide when to auto-load this skill.

Use this skill when using UV (Python package manager), needs to set up Python virtual environments, install/manage Python CLI tools, migrate from pip/pipx to UV, Python version management, or troubleshoot UV-related issues.

SKILL.md

uv.SKILL.md
name: uv
description: Use this skill when using UV (Python package manager), needs to set up Python virtual environments, install/manage Python CLI tools, migrate from pip/pipx to UV, Python version management, or troubleshoot UV-related issues.

UV - Python Package Manager Skill

Overview

UV is an extremely fast Python package and project manager written in Rust. This skill provides guidance on using UV for Python development, with particular focus on MCP (Model Context Protocol) server integration and modern tool management workflows.

UV replaces multiple tools: pip, pip-tools, pipx, poetry, pyenv, twine, virtualenv, and more - delivering 10-100x faster performance through intelligent caching and parallel operations.

Version Awareness

**Recommended Version: UV 0.9.7+** (Latest as of October 2025)

Before starting, check your UV version:

uv --version

**Important Version-Specific Changes:**

  • **UV 0.9.6+**: Python 3.14 is now the default (previously 3.13)
  • **UV 0.9.6+**: Free-threaded Python 3.14+ supported without explicit opt-in
  • **UV 0.9.6+**: `uv build --clear` flag available for cleaning build artifacts
  • **UV 0.9.7+**: Security updates for tar/ZIP archive handling

If your version is older than 0.9.0, upgrade for the best experience:

# Using pip
pip install --upgrade uv

# Or reinstall using official installer
# Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

# Unix/Mac
curl -LsSf https://astral.sh/uv/install.sh | sh

See [Recent Changes Reference](references/recent-changes.md) for detailed version information and migration guidance.

When to Use This Skill

Use this skill when:

  • Setting up Python virtual environments and managing Python versions
  • Installing and managing Python CLI tools (development tools, utilities)
  • Running MCP servers with UVX
  • Deciding between `uv tool install` vs `uvx` for package execution
  • Configuring VS Code or other IDEs for MCP server integration
  • Migrating from pip, pipx, or poetry to UV
  • Troubleshooting UV-related issues

Skip this skill when:

  • You need basic Python package installation only (standard pip documentation may suffice)
  • Working with legacy Python 2.x projects

Core Concepts

1. UV Commands Overview

UV provides several commands for different use cases:

| Command | Purpose | Example | |---------|---------|---------| | `uv pip install` | Install packages in current environment | `uv pip install requests` | | `uv tool install` | Install CLI tools globally with isolation | `uv tool install black` | | `uvx` | Execute packages in temporary environments | `uvx mcp-server-sqlite` | | `uv venv` | Create virtual environments | `uv venv .venv` | | `uv python install` | Install Python versions | `uv python install 3.12` |

2. Tool vs UVX Decision Tree

Need to run a Python package?
|
├─ Use daily/frequently?
|  └─ YES → `uv tool install package`
|     Examples: black, pytest, flake8, mypy
|
├─ MCP server?
|  └─ YES → `uvx package` or `uvx --from path script.py`
|     Examples: mcp-server-sqlite, custom MCP servers
|
├─ Testing/one-off execution?
|  └─ YES → `uvx package`
|     Examples: testing new tools, version comparison
|
└─ Local development script?
   └─ YES → `uvx --from . script.py`
      Examples: project-specific scripts

3. MCP Server Execution Patterns

**Published Packages (No working directory needed):**

{
  "servers": {
    "sqlite": {
      "command": "uvx",
      "args": ["mcp-server-sqlite", "--db-path", "/path/to/db"]
    }
  }
}

**Local Development (Use --from flag):**

{
  "servers": {
    "my-server": {
      "command": "uvx",
      "args": [
        "--from", "/absolute/path/to/project",
        "server.py",
        "--config", "config.json"
      ]
    }
  }
}

**Key insight**: `--from` flag IS the working directory reference for UVX.

4. Virtual Environment Management

UV works seamlessly with Python's built-in venv:

# Create virtual environment
python -m venv .venv

# Activate (Windows Git Bash)
. .venv/Scripts/activate

# Activate (Windows CMD)
.venv\Scripts\activate.bat

# Activate (Linux/Mac)
source .venv/bin/activate

# Install packages with UV
uv pip install -r requirements.txt

Common Workflows

Development Tools Setup

# Install development tools once
uv tool install black
uv tool install flake8
uv tool install mypy
uv tool install pytest

# Use daily
black .
flake8 src/
mypy src/
pytest tests/

MCP Server Usage

# Test published MCP servers
uvx mcp-server-sqlite --db-path test.db
uvx mcp-server-git --repository /path/to/repo

# Local MCP server development
uvx --from /path/to/project server.py --env config.env

Project Initialization

# Create new project with UV
uv init my-project
cd my-project

# Add dependencies
uv add requests fastapi

# Run project
uv run python main.py

Python Version Management

# List available Python versions
uv python list

# Install default Python version (3.14 in UV 0.9.6+)
uv python install

# Install specific Python version
uv python install 3.12
uv python install 3.13

# Use in project
uv python pin 3.12

**Note:** As of UV 0.9.6, Python 3.14 is the default version. If you need Python 3.13 or earlier, explicitly specify the version.

Inline Script Dependencies (PEP 723)

UV supports defining dependencies directly in Python script comments:

#!/usr/bin/env -S uv run --script
# /// script
# dependencies = [
#   "requests",
#   "pandas",
# ]
# ///

import requests
import pandas as pd

# Your code here

Run with automatic dependency installation:

# UV installs dependencies automatically
uv run script.py

**Benefits:**

  • Self-contained single-file scripts
  • No pyproject.toml needed
  • Easy sharing and distribution
  • Perfect for utilities and automation

See [Inline Script Metadata Reference](references/inline-script-met

Read more
Ships withdotfiles-opencode

小彭老师现在改用claude code的开源替代opencode,满足了开源人士旺盛的定制需求x(其实opencode中也可以继续用claude的闭源模型,只是换成了开源的opencode客户端) 安装方法:SETUP.md

Get the whole plugin

Other skills on dotfiles-opencode.