Skip to content
Agentmart
Submit a tool

AGENTS.md · TheAlgorithms/Python

AGENTS.md from TheAlgorithms/Python: 63 lines covering Before opening a pull request, Code conventions (enforced by CI), Running the suite locally, Good agent…

Template by TheAlgorithms

IndexedMIT★ 225,492
Write a review

Install

Works with Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Claude Code. Read the repository before you give any tool access to your data.

curl -fsSL https://raw.githubusercontent.com/TheAlgorithms/Python/master/AGENTS.md -o AGENTS.md

Read it and adapt it to your project before use.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

The AGENTS.md file that TheAlgorithms/Python (225,488 stars) keeps for coding agents. It has 63 lines in 4 sections: Before opening a pull request; Code conventions (enforced by CI); Running the suite locally; Good agent behavior. Use it as a model for your own project's instructions.

Use cases: prompt-engineering

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

What's in it

An AGENTS.md file: instructions coding agents (Codex, Cursor, Copilot, Gemini CLI and others) read before working in a repo.

For
Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Claude Code
Length
63 lines
File
AGENTS.md

Sections

  1. Before opening a pull request
  2. Code conventions (enforced by CI)
  3. Running the suite locally
  4. Good agent behavior

First lines (shown under the repo's MIT license)

# AGENTS.md

Guidance for AI coding agents (and their humans) contributing to
**TheAlgorithms/Python**. This complements — and never overrides —
[`CONTRIBUTING.md`](CONTRIBUTING.md). Read that first.

This repository is educational: implementations should be clear and correct
rather than maximally optimized. Every change goes through CI and the
`algorithms-keeper` bot, both of which reject non-conforming PRs automatically.

## Before opening a pull request

- **Check at least one box in the PR description.** The `algorithms-keeper`
  bot **closes any PR whose "Describe your change" section has no checked
  box** (`* [x]`). Fill in the template that ships in
  `.github/pull_request_template.md` and tick every item that applies before
  you submit — this is the single most common reason automated PRs get closed.
- **One algorithm file per PR.** Split unrelated changes into separate PRs to
  keep review focused.
- **Don't change code and its doctests in the same PR.** If you're only
  updating tests, say so and touch nothing else.

## Code conventions (enforced by CI)

- **Formatting & linting:** `ruff` (`uvx ruff check .` and `uvx ruff format .`).
  Run `uvx pre-commit run --all-files` locally to catch everything CI will.
- **Type hints:** annotate every function parameter and return value with
  [type hints](https://docs.python.org/3/library/typing.html).
- **Doctests:** every function needs at least one
  [doctest](https://docs.python.org/3/library/doctest.html) that passes under
  `python -m doctest -v your_file.py` (and `pytest`).
- **Naming:** filenames are all-lowercase with underscores (no spaces or
  dashes); functions and variables follow standard Python naming.
- **Placement:** new files go inside an existing directory.
- **References:** new algorithms include a URL to Wikipedia or a comparable
  explanation.

## Running the suite locally

This project is managed with [`uv`](https://docs.astral.sh/uv/) — there is no
`requirements.txt`. Dependencies live in `pyproject.toml`/`uv.lock`, and `uvx`
runs a tool in a throwaway environment without polluting yours:

```bash
uvx pre-commit run --all-files                       # ruff, formatting, hooks
uvx pytest your_module/your_file.py --doctest-modules
```

(`uv run pytest ...` works too if you'd rather use the project's locked
environment.)

Some directories are intentionally skipped in CI (`--ignore` entries in
`.github/workflows/build.yml`), usually because a heavy dependency lacks a
wheel for the CPython version the repo currently targets. Check that list
before assuming a file is untested.

## Good agent behavior

- Keep diffs minimal and scoped to the stated change.
- Preserve existing style and structure; prefer clarity over cleverness.
- Never fabricate doctest output — run it and paste the real result.
- If CI is red, read the log and fix the cause rather than re-running blindly.

Signals

Stars
225,492
Forks
51,209
Open issues
4
Last commit (this folder)
Aug 30, 2026 (2 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026
Cite this page

AGENTS.md · TheAlgorithms/Python. Agent Mart. https://agentmart.dev/templates/thealgorithms-python-agents-md (last updated 2026-10-24)