ai-project-template / backend
CLAUDE.md9 starsChanged 16 months agoMITView on GitHub
Add new dependencies to pyproject.toml:
In this repository2 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- frontend/CLAUDE.mdCLAUDE.md
The file
We split this CLAUDE.md into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 94
Always validate input with Pydantic schemas
- Distinctive: line 95
Use Django's ORM to prevent SQL injection
- Distinctive: line 97
Never expose sensitive data in API responses
- Very specific: line 101
Add new dependencies to pyproject.toml:
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Backend AI Instructions
🏗️ Backend Architecture
- Framework: Django 5.1 with Django Ninja for APIs
- Database: PostgreSQL (SQLite in dev)
- Authentication: JWT tokens
- API Style: RESTful with OpenAPI schema
📁 App Structure
apps/
├── core/ # Shared utilities, base models
├── users/ # User management, auth
└── <feature>/ # Feature-specific apps
├── api.py # Django Ninja endpoints
├── models.py # Django models
├── schemas.py # Pydantic schemas
├── services.py # Business logic
└── tests/ # App tests📝 API Patterns
Django Ninja Router
from ninja import Router
from .schemas import ItemIn, ItemOut
from .services import ItemService
router = Router()
@router.post("/", response=ItemOut)
def create_item(request, data: ItemIn):
return ItemService.create(data.dict())
@router.get("/{item_id}", response=ItemOut)
def get_item(request, item_id: int):
return ItemService.get(item_id)Service Layer
from .models import Item
class ItemService:
@staticmethod
def create(data: dict) -> Item:
return Item.objects.create(**data)
@staticmethod
def get(item_id: int) -> Item:
return Item.objects.get(id=item_id)🔧 Common Tasks
Add New App
cd backend/apps
mkdir new_feature
cd new_feature
touch __init__.py api.py models.py schemas.py services.py
mkdir tests
touch tests/__init__.py tests/test_api.pyRun Migrations
uv run python manage.py makemigrations
uv run python manage.py migrateTesting
# Run all tests
uv run pytest
# Run specific app tests
uv run pytest apps/users/tests/
# With coverage
uv run pytest --cov=apps --cov-report=html🛡️ Security
- Always validate input with Pydantic schemas
- Use Django's ORM to prevent SQL injection
- Implement proper permission classes
- Never expose sensitive data in API responses
📦 Dependencies
Add new dependencies to pyproject.toml:
uv add package-nameDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

