Featured image of post Creating a Cursor rule to keep Python workflows on uv

Creating a Cursor rule to keep Python workflows on uv

I already had reusable `uv`-first instructions for Claude Code and Codex. I have now added the Cursor path too: generate a rule from the same source guidance so Cursor stays on the same Python workflow.

Not long ago, I wrote about setting up a uv-first Python workflow for Claude Code and Codex.

Since then, I added the Cursor version to the same repo:

github.com/ipeterfulop/coding-agents-uv-setup

The goal is still narrow and practical: if a project uses uv, I want the agent to stay inside that workflow when it installs dependencies, runs scripts, or reaches for Python as a helper tool during a task.

For Claude Code and Codex, that meant local instruction files. For Cursor, the setup is a little different.

Instead of dropping a single project instruction file into the repo root, the Cursor flow here is to create a rule from the bundled .codex/AGENTS.md using /create-rule. The repo now includes both the ready-made rule at .cursor/rules/python-uv-enforcement.mdc and a short guide in .cursor/README.md that shows how to create it.

The policy itself is the same as before. The point is to make commands like these the default:

1
2
3
4
5
uv add httpx
uv sync
uv run python script.py
uv run pytest
uvx ruff check .

And to avoid the usual drift back to things like pip install, raw python, or manual dependency edits when the project is already meant to run on uv.

What changed is not the Python workflow. What changed is that I now have the same workflow expressed in a format Cursor can apply directly.

That was the missing piece I wanted: one small repo, with one consistent policy, adapted for Claude Code, Codex, and now Cursor as well.

Built with Hugo
Theme Stack designed by Jimmy