What to put in an AGENTS.md for a Python repo

Python tooling differs most from repo to repo, so name yours first: the package manager, linter, type checker and test runner, each as the command you run. The lockfile shows the manager: uv.lock for uv, poetry.lock for Poetry.

Which commands should it list?

  • uv run pytestlocks and syncs the environment first; no activation needed
  • poetry install && poetry run pytestthe Poetry way; installs the versions in poetry.lock
  • pytest tests/test_api.py::test_loginone test by node id; -k selects by name
  • ruff check --fix && ruff formatlint with fixes, then format; ruff format --check in CI
  • mypy srcor pyright; name the one CI runs
  • uv sync --lockedfor CI: fails on a stale uv.lock instead of rewriting it

Write them as your repo runs them, with its package manager and flags, plus how to run one test.

What layout should it explain?

  • src/ or flat layout. With src/, the package must be installed (editable, in dev) before tests can import it.
  • Which file holds each tool's config. Ruff uses the closest .ruff.toml, ruff.toml or pyproject.toml with [tool.ruff]; pyright prefers pyrightconfig.json over pyproject.toml. Neither merges files.
  • The Python versions you support (requires-python), and where the virtualenv lives if not .venv.

What do agents get wrong?

  • Run tools through the manager (uv run, poetry run), not a global python or pytest: the project environment is isolated from the shell.
  • Commit the lockfile with the dependency change that moved it; uv.lock always belongs in git, poetry.lock for applications.
  • mypy reads the first of mypy.ini, .mypy.ini, pyproject.toml and setup.cfg it finds; keep its settings in one.

From the official docs: docs.astral.sh/sync · docs.astral.sh/layout · python-poetry.org/basic-usage · docs.pytest.org/usage.html · docs.astral.sh/configuration · mypy.readthedocs.io/config_file.html · microsoft.github.io/pyright · packaging.python.org/src-layout-vs-flat-layout . The rest of the file is the same for any project: what goes in an AGENTS.md.

Python repos with an AGENTS.md or CLAUDE.md (29)

29 of the 56 Python repos on the leaderboard have an AGENTS.md or CLAUDE.md at the root, and 26 are long enough to pass the AGENTS.md check in full. Most-starred first; each file name links to the file.

Python repos on the leaderboard with an AGENTS.md or CLAUDE.md
RepoFileLength
Significant-Gravitas/AutoGPTAGENTS.md 12,045
huggingface/transformersAGENTS.md 3,262
langflow-ai/langflowAGENTS.md 11,708
langchain-ai/langchainAGENTS.md 20,351
github/spec-kitAGENTS.md 3,746
Comfy-Org/ComfyUIAGENTS.md 25,621
pytorch/pytorchAGENTS.md 17,128
vllm-project/vllmAGENTS.md 6,351
python/cpythonAGENTS.md 602
hiyouga/LlamaFactoryCLAUDE.md 3,901
apache/supersetAGENTS.md 16,630
scikit-learn/scikit-learnAGENTS.md 1,316
scrapy/scrapyAGENTS.md 4,919
BerriAI/litellmAGENTS.md 19,562
crewAIInc/crewAIAGENTS.md 1,866
pandas-dev/pandasAGENTS.md 2,713
apache/airflowAGENTS.md 24,297
streamlit/streamlitAGENTS.md 10,454
getsentry/sentryAGENTS.md 6,979
ray-project/rayAGENTS.md 4,319
gradio-app/gradioAGENTS.md 3,776
PostHog/posthogAGENTS.md 26,799
huggingface/diffusersAGENTS.md 4,082
pydantic/pydanticAGENTS.md 128
wagtail/wagtailAGENTS.md 2,161
aio-libs/aiohttpAGENTS.md 3,652
Kludex/starletteAGENTS.md 198
data-privacy-stack/presidioAGENTS.md 6,369
sqlfluff/sqlfluffAGENTS.md 11,495

More examples