modules/home/programs/cli-agents/shared/skills/coding/python/SKILL.md
Use uv for Python development. Always prefer uv over pip/poetry/virtualenv. Use ruff for linting/formatting, pytest for testing, mypy for type checking.
npx skillsauth add not-matthias/dotfiles-nix pythonInstall 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.
You are a Python development specialist using uv and related tools. ALWAYS use uv — never pip, poetry, virtualenv, or venv directly.
NEVER use: pip install, python -m venv, poetry, pipenv, conda
ALWAYS use: uv
# Create project
uv init <name> # New project with pyproject.toml
uv init --lib <name> # Library project
# Dependencies
uv add <package> # Add dependency
uv add --dev <package> # Add dev dependency
uv remove <package> # Remove dependency
uv sync # Install all deps from lockfile
# Running
uv run python script.py # Run in project environment
uv run pytest # Run tool in project environment
uv run <any-command> # Preferred way to run anything
# Tools (one-off usage, no install needed)
uvx ruff check . # Run ruff without installing
uvx mypy . # Run mypy without installing
Always follow this sequence:
uv run pytest -q # Run tests first
uv run ruff check . # Linting
uv run ruff format --check . # Format check
uv run mypy . # Type checking (if project uses it)
Decision tree:
uv run ruff check . (fast)uv run pytest -quv run ruff format .uv run mypy .Ruff replaces flake8, isort, black, and more. Prefer it over all of them.
uv run ruff check . # Lint
uv run ruff check --fix . # Auto-fix lint issues
uv run ruff format . # Format (replaces black)
uv run ruff format --check . # Check formatting without modifying
[tool.ruff]
line-length = 88
target-version = "py311"
[tool.ruff.lint]
select = ["E", "F", "I", "UP"] # pycodestyle, pyflakes, isort, pyupgrade
ignore = ["E501"] # Line too long (handled by formatter)
[tool.ruff.lint.per-file-ignores]
"tests/**" = ["S101"] # Allow assert in tests
uv run pytest # Run all tests
uv run pytest -q # Quiet output
uv run pytest -x # Stop on first failure
uv run pytest -k "test_name" # Run matching tests
uv run pytest -v # Verbose output
uv run pytest --tb=short # Short traceback
uv run pytest tests/ # Run specific directory
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-q --tb=short"
uv run mypy . # Check entire project
uv run mypy src/ # Check specific directory
uv run mypy --strict . # Strict mode
[tool.mypy]
python_version = "3.11"
strict = true
ignore_missing_imports = true
my-project/
├── pyproject.toml
├── uv.lock
├── src/
│ └── my_project/
│ ├── __init__.py
│ └── main.py
└── tests/
├── __init__.py
└── test_main.py
[project]
name = "my-project"
version = "0.1.0"
requires-python = ">=3.11"
dependencies = []
[project.optional-dependencies]
dev = ["pytest", "ruff", "mypy"]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.ruff]
line-length = 88
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-q"
[tool.mypy]
strict = true
ignore_missing_imports = true
For pure Python packages, uv_build is an alternative to hatchling:
[build-system]
requires = ["uv_build>=0.9.28,<0.10.0"]
build-backend = "uv_build"
uv init my-project
cd my-project
uv add --dev pytest ruff mypy
uv run pytest # verify setup works
[project.scripts]
my-tool = "my_project.cli:main"
uv run my-tool # Run the script
uv run --with requests python script.py # Ad-hoc dependency
uvx python-script-tool # Run published tool
Declare dependencies directly in a standalone script — no project needed:
# /// script
# requires-python = ">=3.12"
# dependencies = ["requests<3", "rich"]
# ///
import requests
from rich import print
Then just uv run script.py. Manage with uv add --script script.py requests.
uv run ruff check --fix . && uv run ruff format . && uv run pytest -q
Issue: ModuleNotFoundError after uv add
uv sync # Re-sync lockfile to environment
Issue: Wrong Python version
uv python pin 3.11 # Pin project to specific version
uv python install 3.11 # Install if not available
Issue: Stale lockfile
uv lock --upgrade # Update all deps
uv lock --upgrade-package X # Update specific package
documentation
Save notes, journal entries, and research to the personal-notes Obsidian vault (personal-vault-v2). Use when the user asks to 'save note', 'save to notes', 'write to personal notes', 'save to daily notes', 'note this down', or wants to persist findings/analysis to their personal vault.
documentation
Use whenever the user asks to address, fix, resolve, review, or respond to pull-request comments or review feedback.
development
Apply Not Matthias's Rust-first personal coding style. Use whenever the user explicitly asks to apply or review their code style, make Rust match their preferences, perform a style pass, or simplify/refactor according to their conventions. Inspect only task-touched code, honor local project conventions first, and make only safe opt-out style edits.
development
Guide for writing ast-grep rules to perform structural code search and analysis. Use when users need to search codebases using Abstract Syntax Tree (AST) patterns, find specific code structures, or perform complex code queries that go beyond simple text search. This skill should be used when users ask to search for code patterns, find specific language constructs, or locate code with particular structural characteristics.