Get the FREE Ultimate OpenClaw Setup Guide →

uv

Scanned
npx machina-cli add skill YoniChechik/claude-code-config/uv --openclaw
Files (1)
SKILL.md
1.3 KB

You are working with a Python project that uses UV package manager. UV is a fast package manager serving as a drop-in replacement for pip, pip-tools, and virtualenv.

Core Commands

Project Setup

uv sync                           # Install all default AND dev dependencies from pyproject.toml

Running Commands

uv run python script.py           # Run Python with project dependencies

Adding Dependencies

uv add package-name               # Add to [project.dependencies]
uv add --dev package-name         # Add to [dependency-groups.dev]

CRITICAL: Anti-Patterns

NEVER use bare python

# FORBIDDEN:
python ...
python3 ...

INSTEAD: Always use uv run python ...

NEVER use pip

# FORBIDDEN:
uv pip ...
pip ...
python -m pip ...
uv run python -m pip ...

INSTEAD: Use uv add and uv sync

Instructions

When working with Python files in this project:

  1. Always use uv run python instead of bare python commands
  2. Install dependencies with uv add, never with pip
  3. Sync dependencies with uv sync after modifying pyproject.toml
  4. Run scripts and tools through uv run to ensure correct environment

Source

git clone https://github.com/YoniChechik/claude-code-config/blob/main/skills/uv/SKILL.mdView on GitHub

Overview

UV is a fast package manager that replaces pip, pip-tools, and virtualenv. It manages dependencies from pyproject.toml and runs Python code within the project environment using uv run. It also adds dependencies with uv add, keeping dependencies in sync with your project.

How This Skill Works

UV provides commands to install, add, and run. uv sync installs all default and dev dependencies from pyproject.toml; uv add installs new packages to [project.dependencies] or [dependency-groups.dev]; uv run executes Python commands inside the managed environment to ensure correct dependencies.

When to Use It

  • Setting up a Python project by syncing dependencies from pyproject.toml
  • Running a Python script with the project’s environment
  • Adding a new dependency to your project or its dev group
  • Installing changes after editing pyproject.toml (uv sync)
  • Migrating from pip-based workflows to UV for consistent environments

Quick Start

  1. Step 1: uv sync to install default and dev dependencies
  2. Step 2: uv run python script.py to run code with the project env
  3. Step 3: uv add package-name to add a dependency (uv add --dev package-name for dev)

Best Practices

  • Always use uv run python ... for Python commands
  • Install packages with uv add instead of pip
  • Sync dependencies with uv sync after changing pyproject.toml
  • Run scripts and tools through uv run to ensure the correct environment
  • Avoid mixing pip-installed packages; prefer UV throughout CI and development

Example Use Cases

  • Initialize a project and install dependencies with uv sync
  • Run a Python script: uv run python main.py
  • Add a runtime dependency: uv add requests
  • Add a dev dependency: uv add --dev pytest
  • Update your environment after pyproject.toml changes: uv sync

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers