uv-run — скилл для Claude Code: что делает и как установить
Инструктирует агента запускать Python-скрипты через менеджер uv без ручной активации виртуального окружения и оформлять зависимости прямо внутри файла.
npx skills add laurigates/claude-plugins --skill uv-run -a claude-codeЧто делает uv-run
Скилл обучает ИИ запускать скрипты на Python через uv run. Ручная активация окружения больше не требуется. Ассистент узнаёт, как добавлять временные библиотеки через флаг --with и как оформлять самодостаточные файлы со встроенными зависимостями по спецификации PEP 723.
В инструкции собраны шаблоны запуска разовых CLI-утилит через uvx, проброс аргументов командной строки и замеры производительности с помощью cProfile, scalene или py-spy. Для долгосрочной правки pyproject.toml скилл не предназначен: для этой задачи автор рекомендует использовать связку с uv-project-management.
Какие задачи решает
- запустить разовый Python-скрипт без создания и активации venv
- подключить временные библиотеки через флаг
--with - встроить метаданные зависимостей в файл по стандарту PEP 723
- запустить профилирование кода через
cProfile,scaleneилиpy-spy
Примеры запросов агенту
- Запусти
fetch_data.py, подтянув временную зависимостьrequests - Оформи в
script.pyблок зависимостей по PEP 723 дляhttpxиrich - Запусти профилирование памяти для
benchmark.pyчерезmemory-profiler
Как установить uv-run
1Через Skills CLI (Vercel)
npx skills add laurigates/claude-plugins --skill uv-run -a claude-code2Вручную: положить файлы
~/.claude/skills/uv-run/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/uv-run/
1Через Skills CLI (Vercel)
npx skills add laurigates/claude-plugins --skill uv-run -a codex2Вручную: положить файлы
.agents/skills/uv-run/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add laurigates/claude-plugins --skill uv-run -a cursor2Вручную: положить файлы
.cursor/skills/uv-run/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install laurigates/claude-plugins uv-run2Вручную: положить файлы
.github/skills/uv-run/SKILL.md1Через Skills CLI (Vercel)
npx skills add laurigates/claude-plugins --skill uv-run -a gemini-cli2Командой платформы
gemini skills install https://github.com/laurigates/claude-plugins --path python-plugin/skills/uv-runВручную: положить файлы
.devin/skills/uv-run/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add laurigates/claude-plugins --skill uv-run -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о uv-run
Как установить uv-run в Claude Code?
Выполните команду npx skills add laurigates/claude-plugins --skill uv-run -a claude-code. Конфигурация сохранится по пути ~/.claude/skills/uv-run/SKILL.md.
Что делает скилл uv-run?
Он даёт агенту правила вызова uv run и uvx для изолированных скриптов. Помощник запускает код с нужной версией интерпретатора и изолированными пакетами.
Чем uvx отличается от uv run --with?
Команда uvx запускает CLI-инструменты вроде ruff или httpie вообще без установки в систему. Флаг uv run --with добавляет пакет временно только на один запуск конкретного скрипта.
Исходный текст
SKILL.md · MIT
---
created: 2025-12-16
modified: 2026-05-09
reviewed: 2026-04-25
name: uv-run
description: Run Python scripts with uv (PEP 723 inline deps, --with for one-off deps). Use when running scripts without venv activation or needing one-off dependencies.
user-invocable: false
allowed-tools: Glob, Grep, Read, WebFetch, TodoWrite, WebSearch, Edit, Write, NotebookEdit, Bash
---
# UV Run
Run Python scripts with uv - no manual venv activation needed.
## When to Use This Skill
| Use this skill when... | Use a focused sibling instead when... |
|---|---|
| Running a one-off script with `uv run script.py` and no project context | Adding a long-lived dependency to a project — use uv-project-management |
| Embedding PEP 723 inline metadata or `--with` deps into a self-contained script | Installing a global CLI tool (`uv tool install` / `uvx`) — use uv-tool-management |
| Executing project commands inside the project venv without manual activation | Authoring the project's pyproject.toml or lockfile — use uv-project-management |
## Core Capabilities
- **Direct execution**: `uv run script.py` handles environment automatically
- **Temporary dependencies**: `uv run --with requests script.py` for one-off needs
- **Inline dependencies**: PEP 723 metadata blocks for self-contained scripts
- **Ephemeral tools**: `uvx tool` runs CLI tools without installation
## Essential Commands
### Running Scripts
```bash
# Run script (uv manages environment automatically)
uv run script.py
# Run with arguments
uv run script.py --input data.csv --output results.json
# Run a specific module
uv run -m http.server 8000
# Run with specific Python version
uv run --python 3.12 script.py
```
### Temporary Dependencies
Add dependencies for a single run without modifying project:
```bash
# Single dependency
uv run --with requests fetch_data.py
# Multiple dependencies
uv run --with requests --with rich api_client.py
# Version constraints
uv run --with 'requests>=2.31' --with 'rich>12,<14' script.py
# Combine with project dependencies
uv run --with pytest-benchmark pytest # Add benchmark to existing pytest
```
### Inline Script Dependencies (PEP 723)
Create self-contained scripts with embedded dependencies:
```python
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "requests>=2.31",
# "rich>=13.0",
# ]
# ///
import requests
from rich import print
response = requests.get("https://api.github.com")
print(response.json())
```
Run directly:
```bash
uv run script.py
# Or make executable:
chmod +x script.py
./script.py
```
### Managing Script Dependencies
```bash
# Initialize script with metadata
uv init --script example.py --python 3.12
# Add dependency to script
uv add --script example.py requests rich
# Lock script dependencies for reproducibility
uv lock --script example.py
```
### Ephemeral Tool Execution (uvx)
Run CLI tools without installation:
```bash
# Run tool once
uvx pycowsay "Hello from uv!"
uvx httpie https://api.github.com
uvx ruff check .
# With specific version
uvx [email protected] check .
# uvx is shorthand for:
uv tool run pycowsay "Hello"
```
## Shebang Patterns
### Self-Contained Executable Script
```python
#!/usr/bin/env -S uv run --script
# /// script
# dependencies = ["click", "rich"]
# ///
import click
from rich import print
@click.command()
@click.argument('name')
def hello(name):
print(f"[green]Hello, {name}![/green]")
if __name__ == "__main__":
hello()
```
### Script with Python Version Requirement
```python
#!/usr/bin/env -S uv run --script --python 3.12
# /// script
# requires-python = ">=3.12"
# dependencies = ["httpx"]
# ///
import httpx
# Uses Python 3.12+ features
```
## When to Use Each Pattern
| Scenario | Approach |
|----------|----------|
| Quick one-off task | `uv run --with pkg script.py` |
| Reusable script | Inline deps (PEP 723) |
| Shareable utility | PEP 723 + shebang |
| Team collaboration | Inline deps + `uv lock --script` |
| Run CLI tool once | `uvx tool` |
| Project scripts | `uv run` (uses project deps) |
## uvx vs uv run --with
- **`uvx tool`**: Run a CLI **tool** without installation (e.g., `uvx ruff check .`)
- **`uv run --with pkg`**: Run a **script** with temporary dependencies (e.g., `uv run --with requests script.py`)
```bash
# Run a tool (CLI application)
uvx httpie https://api.github.com
# Run a script with dependencies
uv run --with httpx api_test.py
```
## Profiling and Debugging
```bash
# CPU profiling
uv run python -m cProfile -s cumtime script.py | head -20
# Line-by-line profiling (temporary dependency)
uv run --with line-profiler kernprof -l -v script.py
# Memory profiling
uv run --with memory-profiler python -m memory_profiler script.py
# Real-time profiling (ephemeral tool)
uvx py-spy top -- python script.py
# Quick profiling
uv run --with scalene python -m scalene script.py
```
## See Also
- **uv-project-management** - Project dependencies and lockfiles
- **uv-tool-management** - Installing CLI tools globally
- **python-development** - Core Python language patterns
## References
- Official docs: https://docs.astral.sh/uv/guides/scripts/
- PEP 723: https://peps.python.org/pep-0723/
- Tools: https://docs.astral.sh/uv/guides/tools/
© laurigates · MIT · laurigates/claude-plugins