How to configure GitHub Copilot for a uv project
Commit .github/copilot-instructions.md with the commands that already work in the repository. GitHub Copilot adds this file to supported chats and agent tasks, so those sessions can follow the repository’s uv workflow.
If the project still needs its tools configured, start with the modern Python project setup guide. For Claude Code, use the separate Claude Code and uv configuration.
Prerequisites
- A uv project with a current
uv.lock - GitHub Copilot on a client or feature that supports repository-wide instructions
- The project’s lint, format, test, and type-check commands already passing
- GitHub CLI installed only if adding the optional Ruff skill
Record the project’s uv workflow
Create .github/copilot-instructions.md in the repository root. Keep only the checks that the project has adopted, and replace the example source and test paths:
# Python project workflow
This repository uses uv for Python, dependencies, and project tools. Keep
`pyproject.toml` and `uv.lock` in sync, and do not install project packages
with pip.
- Set up the environment with `uv sync --locked`.
- Run Python with `uv run --locked python`.
- Add runtime dependencies with `uv add <package>`.
- Add development tools with `uv add --dev <package>`.
- Remove dependencies with `uv remove <package>`.
- Keep source code in `src/` and tests in `tests/`.
- Follow the type checker and Python version already configured in the project.
- After editing Python, run `uv run --locked ruff check --fix src tests`, then
`uv run --locked ruff format src tests`, and review the resulting diff.
Before completing a change, run:
```bash
uv run --locked ruff check src tests
uv run --locked ruff format --check src tests
uv run --locked pytest
uv run --locked pyrefly check
```
Report each command, its exit code, and anything that could not run. Do not
claim success when a check was skipped or when pytest collected no tests.uv run executes the command inside the project’s virtual environment, ensuring all dependencies are installed first. The --locked flag stops these commands when project metadata and uv.lock disagree instead of updating the lockfile.
The --dev flag marks a tool as a development dependencyA package needed during development (testing, linting, formatting) that is not shipped to users of your project. Installed with the --dev flag.
, keeping it out of production installs. Replace pyrefly check with the repository’s existing type-check command, or remove that line when the project has not adopted a type checker.
On a passing project, Ruff reports that checks passed and files are formatted, pytest reports at least one passing test, and Pyrefly reports zero errors. uv sync --locked must also leave an executable Python interpreter in .venv.
Commit the instruction file so teammates and remote Copilot tasks receive the same project guidance.
Confirm that Copilot loaded the file
Open a Copilot chat for the repository and ask:
Which commands should you use to run this project's tests and formatter?Expect the answer to name uv run --locked pytest and uv run --locked ruff format --check src tests. Expand the response’s references and confirm that .github/copilot-instructions.md appears.
If the file is absent, confirm that the current Copilot feature supports repository-wide instructions, the repository root is open, and custom instructions are enabled. Remove conflicting copies of the same rule instead of relying on an undocumented precedence order.
Add the Ruff workflow when it earns its context
Keep specialized procedures out of the always-on instruction file. To add the community-contributed ruff-recursive-fix skill, inspect it before installation:
gh skill preview github/awesome-copilot ruff-recursive-fixExpect a file tree containing ruff-recursive-fix/SKILL.md, followed by the rendered Ruff Recursive Fix instructions. Skills can contain unsafe instructions or scripts, so review every file before continuing.
Install the reviewed skill for Copilot at project scope:
gh skill install github/awesome-copilot ruff-recursive-fix --agent github-copilot --scope projectExpect GitHub CLI to report the source revision and create .agents/skills/ruff-recursive-fix/SKILL.md. Commit the installed skill so repository and cloud sessions can discover it.
Copilot can select the skill from its description when a Ruff task matches. To request it explicitly, start the prompt with Use the /ruff-recursive-fix skill and name the files or directory to check.
Keep verification outside the prompt
Custom instructions guide Copilot; they do not guarantee compliance. Keep the non-mutating final checks in CI, review Copilot’s diff, and require passing checks before merging.