About shunk031-python-uv-workflow
A uv-based workflow skill for developers implementing or refactoring Python projects. It also sets guidance for path construction, dependency resolution settings, and tests aligned with repository policy.
Key features
- 01Use uv as the default toolchain
- 02Run scripts with uv run
- 03Test behavior changes
- 04Follow project setup and quality gates
- 05Anchor paths to source files
Use cases
- 01Run scripts and tests in Python projects
- 02Check behavior and output parity during refactors
- 03Review uv lockfile and configuration
- 04Inspect path code for portability
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ shunk031/ skills --skill shunk031-python-uv-workflowAfter installing, type/shunk031-python-uv-workflowin Claude Code to confirm it loaded.
Bundled filesagents/openai.yamlreferences/python-uv-rules.md
Details
From the project READMENote
After reading this
SKILL.md, say:🐍 I read shunk031-python-uv-workflow.
Python UV Workflow
Overview
Use this workflow to keep Python implementation and refactoring aligned with repository policy.
Workflow
- Use
uvas the default toolchain for Python projects. - Run scripts with
uv run <script>. - Write tests when behavior changes and verify expected behavior.
- Add standard dev dependencies with
uv. - Follow the existing project's setup and quality gates. Install pre-commit hooks after dependency setup when the project or repository requires them.
- For a new project or an explicit setup request, add only the project configuration the request or repository policy needs; do not create
.pre-commit-config.yamlor aMakefilefor an isolated script edit. - Keep resolver-affecting uv settings such as
exclude-newerout of a user's global uv configuration:uv lockrecords them in the lockfile's[options]block, so every environment without the same setting re-resolves and rewrites the lockfile on each non-frozenuv run,uv sync, oruv-lockhook. A project that needs such a setting must declare it under[tool.uv]in its ownpyproject.toml; a committed lockfile with an undeclared[options]block is defective and must be fixed by regenerating the lock. - For refactoring from non-
uvoriginals, align dependencies and verify output parity. Match the repository's coverage target; raise coverage toward 90% only when the refactor or repository requires that target. - Construct Python paths from a source-file anchor, and keep every path component in its own operand:
- Forbidden:
Path("/path/to") / "hoge"andREPO_ROOT / "home/dot_codex/hooks/session_start_gateway.py" - Required:
Path(__file__).parents[N] / "path" / "to" / "hoge"Never put multiple path components separated by/or\in a string literal passed toPathor used as an operand to/. Anchoring paths to the source file keeps them working after relocation and across worktrees without coupling them to a host layout. Explicit roots supplied through a CLI argument or environment variable are allowed; hard-coded absolute path strings remain forbidden. Before finalizing Python changes, inspect every changedPath(...)and/expression for path-separator-containing string operands.
- Forbidden:
- Name variables for their semantic role. When the same concept has multiple representations, add a qualifier such as
_path,_text, or_dataonly to distinguish them; do not add type suffixes mechanically when the role is already clear.
Testing Expectations
- Add tests before refactoring when behavior changes.
- Prefer real data over mocks and monkeypatches when feasible.
- Follow the project's stated coverage target; do not impose a universal percentage.
Use python-uv-rules.md for exact commands and canonical hook configuration.
Comments
Markdown supported