skills/uv-python-execution/SKILL.md
Enforces using uv to run all Python scripts and ty for type checking. Includes inline script metadata (PEP 723) for one-time scripts with dependencies.
npx skillsauth add pratos/clanker-setup uv-python-executionInstall 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.
When this skill is triggered, ALWAYS display this banner first:
╭─────────────────────────────────────────────────────────────╮
│ 🐍 SKILL ACTIVATED: uv-python-execution │
├─────────────────────────────────────────────────────────────┤
│ Mode: [Python Execution | Type Checking | Inline Script] │
│ Action: Using uv/ty toolchain instead of direct invocation │
╰─────────────────────────────────────────────────────────────╯
Replace [Mode] with the detected trigger type.
This skill activates automatically whenever:
Python Execution - Pattern matching on:
python script.pypython3 script.pypython -m modulepython3 -m moduleOne-Time Scripts - Pattern matching on:
Type Checking - Pattern matching on:
pyrightmypy1. ALWAYS use uv run to execute Python scripts and modules.
2. ALWAYS use ty for type checking (not pyright or mypy directly).
# Running a script
uv run python script.py
# Running a module
uv run python -m pytest tests/
# Running with arguments
uv run python train.py --epochs 100 --lr 1e-4
# Running inline Python
uv run python -c "import torch; print(torch.cuda.is_available())"
# Direct python invocation - WRONG
python script.py
python3 script.py
python -m pytest
./script.py # if shebang points to python
# Check entire project
ty check
# Check specific file
ty check src/models/unet.py
# Check specific directory
ty check src/
# Check with specific options
ty check --warn-unreachable src/
# Using pyright directly - WRONG
pyright src/
uv run pyright src/
# Using mypy directly - WRONG
mypy src/
uv run mypy src/
uv runuv run ensures the script runs with the project's virtual environment and dependenciesuv.locktyty is extremely fast (written in Rust by Astral, same team as uv/ruff)pyproject.toml configuration automaticallypython3 --version to check system Python (but prefer uv run python --version)When writing Bash commands that execute Python:
uv run: Always add uv run before python or python3scripts/, verify it uses uv run in justfile tasksuv runWhen checking types or fixing type errors:
ty check: Run ty check instead of pyright/mypyty check path/to/file.py for focused checkingty check, fix errors, repeat until clean# Correct
uv run python scripts/train.py --config config.yaml
# Also correct - using just task
just train
# Correct
uv run pytest tests/ -v
# Also correct
just test
# Correct
uv run python -c "import torch; print(torch.__version__)"
# Check entire project for type errors
ty check
# Check specific module you're working on
ty check src/models/
# Check a specific file after making changes
ty check src/trainer/lightning_module.py
When the user asks for a quick standalone script with external dependencies, use uv's inline script metadata (PEP 723). This runs scripts with their own dependencies without polluting the project environment.
Add a special comment block at the top of the script:
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "requests",
# "rich",
# ]
# ///
import requests
from rich import print
response = requests.get("https://api.github.com")
print(response.json())
# Run directly (uv auto-detects inline metadata)
uv run script.py
# Or make executable and run
chmod +x script.py
./script.py
Fetch and display JSON data:
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.11"
# dependencies = ["httpx", "rich"]
# ///
import httpx
from rich.console import Console
from rich.json import JSON
console = Console()
data = httpx.get("https://api.github.com/repos/astral-sh/uv").json()
console.print(JSON.from_data(data))
Quick CSV processing:
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.11"
# dependencies = ["pandas", "tabulate"]
# ///
import pandas as pd
df = pd.read_csv("data.csv")
print(df.describe().to_markdown())
Web scraping one-liner:
#!/usr/bin/env -S uv run --script
# /// script
# dependencies = ["beautifulsoup4", "requests"]
# ///
import requests
from bs4 import BeautifulSoup
soup = BeautifulSoup(requests.get("https://example.com").text, "html.parser")
print(soup.title.string)
requests>=2.28,<3)uv run with project deps❌ Using python or python3 directly without uv run
❌ Activating venv manually before running (.venv/bin/activate)
❌ Using pip install instead of uv add or uv pip install
❌ Using pyright or mypy instead of ty check
❌ Running type checking with uv run pyright or uv run mypy
❌ Installing packages globally for one-time scripts (use inline metadata instead)
✅ All Python script executions use uv run prefix
✅ New scripts have corresponding justfile tasks
✅ Consistent execution environment across all runs
✅ All type checking uses ty check
✅ Type errors are checked before and after code changes
✅ One-time scripts use inline metadata (PEP 723) for dependencies
development
Conducts comprehensive web research to find accurate, relevant information. Use when you need modern information only discoverable on the web, documentation, best practices, or technical solutions. Uses curl+markdown.new, Exa/Parallel APIs, and camoufox browser — no surf/WebFetch/WebSearch.
development
Ensures .env files in TypeScript projects override sops-nix shell secrets. Use when setting up env loading, debugging missing/wrong API keys, or configuring dotenv in TS projects.
tools
Share agent session traces via the traces CLI. Use when the user asks to share/publish/upload a trace. Always use private visibility.
tools
Browser automation using Stagehand and AI. Use when you need to interact with websites, fill forms, login to services, extract data from web pages, or automate web workflows. Provides the browser_automate tool.