agentleFS
tumftumf/skills/python-uv-project/SKILL.md

python-uv-project

Skill4 starsChanged 7 months agoMITView on GitHub

Scaffold opinionated Python projects with uv as the package/project manager and `uv init` as the bootstrap step. Use when creating or standardizing a Python repository that should include: git initialization, Makefile-driven `test`/`format`/`lint`/`typecheck` workflows, `prek` git hooks, strict typed data models with Pydantic, and Hatch-based semantic version bumps via `make bump-patch`, `make bump-minor`, and `make bump-major`. Also use when you want a solid generic Python repo baseline with README, LICENSE, `.gitignore`, `.editorconfig`, CI, coverage, settings management, and typed-package scaffolding.

We split this skill into the rules it gives an agent

42 rules. About 0 are common, 18 are distinctive, and 24 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈18

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 24

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Prefer current stable releases and avoid unnecessary version pin micromanagement unless the user asks for it.

    line 15
  2. Very specific:

    Use a src/ layout for packages.

    line 21
  3. Very specific:

    Use pytest for tests.

    line 22
  4. Very specific:

    Use ruff for formatting and linting.

    line 23
  5. Very specific:

    Use pyright for type checking.

    line 24
  6. Very specific:

    Use pydantic (and pydantic-settings when config/env modeling is needed) for strict data contracts.

    line 25
  7. Very specific:

    Use hatch for version bump operations.

    line 26
  8. Distinctive:

    Treat this as the default "this is worth having" baseline, not as an excuse to add large framework-specific boilerplate.

    line 44
  9. Very specific:

    Create the project with uv init rather than hand-writing pyproject.toml.

    line 50
  10. Distinctive:

    Prefer package mode for reusable libraries and service code:

    line 51
  11. Distinctive:

    Keep the initial setup non-interactive and scriptable.

    line 58
  12. Very specific:

    Keep package code under src/<package_name>/.

    line 62
  13. Very specific:

    Add tests/ for pytest.

    line 63
  14. Distinctive:

    Add a small version module when needed for Hatch version management.

    line 64
  15. Very specific:

    Add .gitignore entries appropriate for Python, .venv/, caches, and build artifacts.

    line 65
  16. Very specific:

    If the generated layout is close but not fully aligned, update it rather than replacing uv defaults wholesale.

    line 67
  17. Very specific:

    Add the development dependencies through uv and wire them into pyproject.toml.

    line 71
  18. Distinctive:

    Use current stable releases by default.

    line 83
  19. Distinctive:

    Every project created with this skill should expose these targets at minimum:

    line 87
  20. Very specific:

    Prefer uv run ... inside Make targets so the project-local environment is always used.

    line 99
  21. Very specific:

    Use the template in python-uv-project/references/templates.md.

    line 100
  22. Very specific:

    Use prek for git hooks. Recommended split:

    line 104
  23. Distinctive:

    Keep hooks fast on commit and comprehensive on push.

    line 110
  24. Distinctive:

    Use a local-hook configuration that shells out to Make targets instead of duplicating commands.

    line 111
  25. Distinctive:

    When the project touches structured data, configs, request/response models, or file-backed schemas:

    line 115
  26. Very specific:

    prefer explicit field types over dict[str, Any]

    line 119
  27. Distinctive:

    Do not leave loosely typed config parsing or ad hoc JSON validation in place if Pydantic can express it cleanly.

    line 123
  28. Distinctive:

    keep settings models explicit and typed

    line 130
  29. Distinctive:

    avoid reading raw environment variables throughout the codebase

    line 132
  30. Distinctive:

    Use Hatch for release version changes and expose it via Make.

    line 136
  31. Very specific:

    Prefer a simple, explicit Hatch configuration that updates one canonical version source.

    line 143
  32. Very specific:

    If the repo uses a package module such as src/<package_name>/__about__.py, point Hatch there.

    line 144
  33. Very specific:

    If the repo already manages version directly in pyproject.toml, keep the approach consistent.

    line 145
  34. Very specific:

    If the project is expected to live beyond a one-off script, add a minimum GitHub Actions workflow.

    line 149
  35. Very specific:

    Keep it small and boring: one job on ubuntu-latest, triggered on push to main and on pull_request.

    line 150
  36. Very specific:

    Prefer make check as the single CI entry point so local and remote verification stay aligned.

    line 158
  37. Distinctive:

    Do not add a matrix, release automation, cache tuning, or separate format job unless the project explicitly needs them.

    line 159
  38. Distinctive:

    After generating or refactoring the project, run the full local workflow:

    line 163
  39. Very specific:

    If hooks were added, also install them and ensure prek run --all-files passes.

    line 173
  40. Very specific:

    Prefer uv sync / uv run instead of raw virtualenv activation instructions.

    line 177
  41. Distinctive:

    Keep commands agent-friendly and non-interactive.

    line 178
  42. Distinctive:

    If CI is requested, mirror the same Make targets rather than re-specifying tool commands in multiple places.

    line 180

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

python-uv-project - Opinionated Python Project Bootstrap

Build a modern Python repo around uv, fast local automation, and predictable quality gates. Prefer current stable releases and avoid unnecessary version pin micromanagement unless the user asks for it.

Default stack

  • Bootstrap with uv init, then keep dependency management in uv.
  • Initialize git immediately and make the repo ready for normal commit flow.
  • Use a src/ layout for packages.
  • Use pytest for tests.
  • Use ruff for formatting and linting.
  • Use pyright for type checking.
  • Use pydantic (and pydantic-settings when config/env modeling is needed) for strict data contracts.
  • Use hatch for version bump operations.
  • Drive routine developer commands through Makefile targets: test, format, lint, typecheck.
  • Include a practical repo baseline: README.md, LICENSE, .gitignore, .editorconfig, CI, and coverage support.

Standard repo baseline

For a generic Python project, include these by default unless the user asks for a slimmer scaffold:

  • README.md with setup, major Make targets, and developer workflow.
  • LICENSE using MIT by default when the repo is intended for sharing or publication.
  • .gitignore for Python caches, local environments, build outputs, and IDE noise.
  • .editorconfig for consistent whitespace and line endings.
  • src/<package_name>/__about__.py as the canonical version source for Hatch when appropriate.
  • src/<package_name>/py.typed when the package may be distributed as a typed library.
  • src/<package_name>/settings.py for pydantic-settings-based configuration.
  • minimal GitHub Actions CI that runs the same Make targets used locally.
  • coverage support through pytest-cov and a dedicated make coverage target.

Treat this as the default "this is worth having" baseline, not as an excuse to add large framework-specific boilerplate.

Workflow

1. Scaffold with uv

Create the project with uv init rather than hand-writing pyproject.toml. Prefer package mode for reusable libraries and service code:

uv init --package <project-name>

Then add the default toolchain with uv add / uv add --dev. Keep the initial setup non-interactive and scriptable.

2. Normalize project layout

  • Keep package code under src/<package_name>/.
  • Add tests/ for pytest.
  • Add a small version module when needed for Hatch version management.
  • Add .gitignore entries appropriate for Python, .venv/, caches, and build artifacts.

If the generated layout is close but not fully aligned, update it rather than replacing uv defaults wholesale.

3. Configure quality tooling

Add the development dependencies through uv and wire them into pyproject.toml.

Recommended dev tools:

  • pytest
  • pytest-cov when coverage is part of the baseline
  • ruff
  • pyright
  • hatch
  • pydantic
  • pydantic-settings when the app has config models

Use current stable releases by default. Do not invent exact version pins unless the repo already pins tools consistently.

4. Add Makefile entry points

Every project created with this skill should expose these targets at minimum:

  • make test
  • make format
  • make lint
  • make typecheck
  • make check
  • make coverage
  • make bump-patch
  • make bump-minor
  • make bump-major

Prefer uv run ... inside Make targets so the project-local environment is always used. Use the template in python-uv-project/references/templates.md.

5. Install prek hooks

Use prek for git hooks. Recommended split:

  • pre-commit: make format and make lint
  • pre-push: make typecheck and make test

Keep hooks fast on commit and comprehensive on push. Use a local-hook configuration that shells out to Make targets instead of duplicating commands.

6. Make Pydantic the source of truth for data

When the project touches structured data, configs, request/response models, or file-backed schemas:

  • model them with pydantic.BaseModel
  • validate inputs at boundaries
  • prefer explicit field types over dict[str, Any]
  • set stricter model config when appropriate (extra="forbid", frozen models, validation on assignment, etc.)
  • centralize environment/config parsing in dedicated settings models

Do not leave loosely typed config parsing or ad hoc JSON validation in place if Pydantic can express it cleanly.

7. Establish logging and settings defaults

Set the project up so application code prefers logging over scattered print statements. For reusable templates, include a minimal settings.py backed by pydantic-settings and keep environment parsing there.

  • keep settings models explicit and typed
  • load configuration once near the application boundary
  • avoid reading raw environment variables throughout the codebase

8. Set up Hatch version bumps

Use Hatch for release version changes and expose it via Make. The user specifically wants:

  • make bump-patch
  • make bump-minor
  • make bump-major

Prefer a simple, explicit Hatch configuration that updates one canonical version source. If the repo uses a package module such as src/<package_name>/__about__.py, point Hatch there. If the repo already manages version directly in pyproject.toml, keep the approach consistent.

9. Add minimal GitHub Actions and verify the scaffold

If the project is expected to live beyond a one-off script, add a minimum GitHub Actions workflow. Keep it small and boring: one job on ubuntu-latest, triggered on push to main and on pull_request.

The minimum CI contract is:

make check

Prefer make check as the single CI entry point so local and remote verification stay aligned. Do not add a matrix, release automation, cache tuning, or separate format job unless the project explicitly needs them.

10. Verify the scaffold

After generating or refactoring the project, run the full local workflow:

make format
make lint
make typecheck
make test
make coverage

If hooks were added, also install them and ensure prek run --all-files passes.

Implementation notes

  • Prefer uv sync / uv run instead of raw virtualenv activation instructions.
  • Keep commands agent-friendly and non-interactive.
  • Preserve existing repository conventions when modifying an already-started project.
  • If CI is requested, mirror the same Make targets rather than re-specifying tool commands in multiple places.

References

  • Copy/paste bootstrap snippets: python-uv-project/references/templates.md

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.