c/agents › command
0votes

CLAUDE.md template for a Django project

TemplateLow risk Tested
submitted by CommandVault editors to c/agents · 5 uses

Give Claude Code your Django project's commands, app layout and rules in one file.

Template · 7 variables
# CLAUDE.md

## Project
{{project_name}}: {{what_it_does}}. Stack: Python {{python_version}}, Django {{django_version}}, {{database}}.

## Commands
- Run locally: `python manage.py runserver`
- Tests: `pytest -q`
- Lint/format: `ruff check . && ruff format --check .`

## Where things live
- `{{project_package}}/settings/`: base, dev, prod settings
- `apps/<app>/`: models, views, serializers, urls, tests per app
- `templates/` and `static/`: shared front end

## Conventions
- New models need a migration (`python manage.py makemigrations`) committed with the code.
- Business logic lives in `services.py`, not views or models.
- Use the ORM; raw SQL only with a comment explaining why.
- Every view checks permissions explicitly.

## Never
- Commit secrets or `.env` files; refer to them by name only.
- Run migrations or scripts against production.
- Skip or delete a failing test to make the suite pass.

## Done means
Tests and linters pass, you ran the change for real, and your summary lists what changed and what you didn't verify.
e.g. clinic-portal
One line, e.g. patient booking and records for small clinics
e.g. 3.12
e.g. 5.2
e.g. PostgreSQL 16
The folder with settings.py, e.g. config
The exact command you run, e.g. pytest -q or python manage.py test
0 commentsreport

Guide

What you get: Claude Code (and Codex, if you save it as AGENTS.md) starts each session knowing your Django project's name, stack, commands, app layout and hard rules. Best for Developers using Claude Code or Codex on a Django project..

Before you start

  • A Django project
  • Claude Code or Codex installed
  • Your project package name (the folder holding settings)

Worked example (Oct 17, 2026, Claude Code 2.1.296; Codex 0.151.0 (gpt-5.6-sol))

Input

Filled with: project_name=Marrowgate Allotments, what_it_does=lets a city council rent out community garden plots, python_version=3.12, django_version=5.2, database=PostgreSQL 16, project_package=marrowgate. Question: Without reading any files, answer from the project instructions you were given at startup: what is this project called, what exact command runs the tests, and name one rule you must follow. If you have no such instructions, say so.

Result

Claude Code: "Project name: Marrowgate Allotments... Test command: `pytest -q (or python manage.py test)`. That's exactly as written, parentheses included... One rule: never skip or delete a failing test to make the suite pass." Codex: "Project: Marrowgate Allotments / Tests: `pytest -q` (or `python manage.py test`) / Rule: Every view must check permissions explicitly."

Fresh copy of a Next.js 16 starter repo (the stack in the file does not exist; this checks that the file is loaded, not that the commands run). Claude Code: file saved as CLAUDE.md, run headless in plan mode; a second run in JSON mode reported 1 turn, so no files were read. Codex: same text saved as AGENTS.md in a separate fresh copy, read-only sandbox; its log shows no commands run. The user's global ~/.claude/CLAUDE.md was also loaded for Claude Code. Both answers were correct on the first try. Claude Code pointed out that the test command line puts both options in one code span. After this test the Tests line became its own fill-in field ({{test_command}}, default pytest -q), because both tools stumbled on the old "pytest -q (or python manage.py test)" wording.

How to check it worked

  • Start a new session in the project folder and ask, without letting it read files, what the project is called and what command runs the tests. It should repeat your CLAUDE.md back.
  • In Claude Code, run /memory to see which instruction files are loaded.
  • If you also use Codex, save the same text as AGENTS.md (or have CLAUDE.md import it) and ask Codex the same question.

Common problems

  • The agent answers with generic Django advice instead of your values: the file isn't being loaded. Check it's named exactly CLAUDE.md (Codex needs AGENTS.md) and sits at the repo root, then start a new session; edits don't reach a session that's already running.
  • Leftover {{placeholders}}: the agent will repeat them literally. Search the file for '{{' before saving.
  • The file describes commands that don't match the repo (for example a different test runner). The agent trusts the file, so keep it in sync with package/tooling changes.
  • The Tests line lists two runners in one code span: `pytest -q (or python manage.py test)`. An agent may copy the whole thing as one command. Keep only the runner your project uses.

Use this file with your AI tool

Each tool reads project instructions from a different file name. Fill in the blanks above, then save it where your tool looks.

One command
npx commandvault add claude-md-template-for-a-django-project-a6598bdb --tool claude
Save as CLAUDE.md
# CLAUDE.md

## Project
{{project_name}}: {{what_it_does}}. Stack: Python {{python_version}}, Django {{django_version}}, {{database}}.

## Commands
- Run locally: `python manage.py runserver`
- Tests: `pytest -q`
- Lint/format: `ruff check . && ruff format --check .`

## Where things live
- `{{project_package}}/settings/`: base, dev, prod settings
- `apps/<app>/`: models, views, serializers, urls, tests per app
- `templates/` and `static/`: shared front end

## Conventions
- New models need a migration (`python manage.py makemigrations`) committed with the code.
- Business logic lives in `services.py`, not views or models.
- Use the ORM; raw SQL only with a comment explaining why.
- Every view checks permissions explicitly.

## Never
- Commit secrets or `.env` files; refer to them by name only.
- Run migrations or scripts against production.
- Skip or delete a failing test to make the suite pass.

## Done means
Tests and linters pass, you ran the change for real, and your summary lists what changed and what you didn't verify.

Use it: Claude Code loads it at the start of every session. Check with /context (Memory files).

From Claude Code's docs , checked Oct 17, 2026.

More from c/agents

See all of c/agents →
0 comments

Log in to join the discussion.