Working with AI Agents
AI coding agents write a lot of Django. An agent's knowledge of Django stops at its training cutoff, so it may not know about the newest release.
Generated code may use deprecated features, or ones newer than your project's Django version.
The AGENTS.md File
Minimize problems agents introduce by providing instructions for working with your project in an AGENTS.md file at the root of the repo. Agents read it before they start writing code, so we can explain how our project works.
This is included in our starter repo:
# RescueScout
A Django site for an animal rescue.
## Commands
- `uv sync` installs everything.
- These checks must all pass before a change is done:
uv run ruff check .
uv run ruff format --check .
## Rules
- This project uses Django 6.1. Do not use an API that was removed or deprecated before it.
- No type hints, in any file.
- Do not add dependencies, a frontend build step, or login.
Commands tells an agent how to install the project and how to check its own work. Rules tells it what not to do.
The file grows with the project. Once we have a database, it will also say that a model change needs a migration.
Running the Checks
You can run the checks in AGENTS.md yourself:
# looks for mistakes such as unused imports
uv run ruff check .
# reports any file that isn't formatted according to ruff.toml
uv run ruff format --check .