skills/python-uv/SKILL.md
Run Python scripts with automatic dependency management using uv. Use this skill when you need to (1) run Python scripts with external dependencies without polluting system Python, (2) create standalone Python scripts with inline dependencies (PEP 723), (3) convert existing scripts to use uv with inline metadata, (4) handle ModuleNotFoundError by running scripts with uv run --with, or (5) create CLI tools, data processing scripts, or API clients that are self-contained and portable.
npx skillsauth add emliunix/home.conf python-uvInstall 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.
This skill helps create and run Python scripts with automatic dependency management using uv tool. It provides two approaches: inline dependencies (PEP 723) for new/converted scripts, and uv run --with for running existing scripts without modification.
When to use each approach:
uv run --with → Running existing third-party scripts or quick one-off execution#!/usr/bin/env -S uv run --script
# /// script
# dependencies = [
# "package-name>=version",
# ]
# requires-python = ">=3.11"
# ///
import package_name
# Your code here
Use the template assets based on your use case:
assets/template-cli.py - Command-line tools with argument parsingassets/template-data.py - Pandas-based data analysisassets/template-api.py - REST API integration with authCopy the appropriate template and customize for your needs.
Run with: ./script.py or uv run script.py
Use the utility script to add inline dependencies:
scripts/add_inline_dependencies.py <script.py> <dep1> [dep2] ...
Example:
scripts/add_inline_dependencies.py myscript.py "requests>=2.31.0" "pyyaml>=6.0"
This will:
#!/usr/bin/env -S uv run --scriptuv run --with for Old-Style ScriptsModuleNotFoundError for unmaintained scriptsWhen you see import errors:
ModuleNotFoundError: No module named 'yaml'
Solution:
uv run --with pyyaml script.py
Multiple dependencies:
uv run --with pyyaml --with requests --with pandas script.py
| Import Statement | Package Name |
|-----------------|--------------|
| import yaml | pyyaml |
| import PIL | pillow |
| import bs4 | beautifulsoup4 |
| import dotenv | python-dotenv |
For complete mapping table and more details, see references/uvx-guide.md
cp assets/template-cli.py mytool.pychmod +x mytool.py./mytool.py or uv run mytool.pyscripts/add_inline_dependencies.py oldscript.py "dep1>=1.0" "dep2>=2.0"./oldscript.pyModuleNotFoundError: No module named 'requests'uv run --with requests script.py"requests>=2.31.0") for reproducibility--script flag in shebang to enable inline dependency supportuv run --with for quick experiments or external scriptsadd_inline_dependencies.py - Add PEP 723 metadata to existing Python scriptsuvx-guide.md - Comprehensive guide with examples, troubleshooting, and detailed explanationstemplate-cli.py - CLI tool template with Clicktemplate-data.py - Data processing template with Pandastemplate-api.py - API client template with RequestsScript not found: Install uv with brew install uv or curl -LsSf https://astral.sh/uv/install.sh | sh
Module not found during execution: Use uv run --with package-name script.py for quick fix, or add to inline dependencies for permanent solution
Permission denied: Run chmod +x script.py to make executable
For more detailed troubleshooting, see references/uvx-guide.md.
development
Manages thinking patterns and mental models when switching between different topics or modes. Use when (1) switching from analysis to design, (2) switching from exploration to validation, (3) switching from reading to writing, (4) any topic transition where thinking approach must change, (5) user signals "we're going to sketch/design/build" after analysis phase.
development
Systematic codebase investigation producing structured exploration files (Notes → Facts → Claims). Use when researching unknown systems, tracing code paths, or documenting architecture.
testing
Collaborative design workflow for architecture and system design. Use when the user wants to design or redesign a system, component, or feature. Triggers on phrases like "design", "architecture", "how should we", "what's the best way to", or when the user asks for tradeoff analysis. This skill is for exploration and decision-making, not implementation.
development
Change plan workflow for non-trivial code changes. Create, review, and track changes before implementation.