Skip to content
Cursor Rules Generator
Backend4 sections

Django Cursor Rules Template

Generate production-ready Django Cursor rules for Project Rules (.mdc), AGENTS.md, or legacy .cursorrules. This template encodes stack-specific conventions for projects using Django. Python web framework with ORM, admin, auth, and batteries-included conventions.

What This Template Covers

The template focuses Cursor AI on concrete Django practices instead of generic coding advice. Required sections are always included; optional sections can be enabled when they match your project.

Required guidance

  • - Project Structure
  • - Models & ORM
  • - Views & APIs
  • - Testing

Default style

  • - Indentation: 4 spaces
  • - Quotes: double
  • - Semicolons: disabled
  • - Naming: snake_case

Example Django Rules

The generator turns these sections into Project Rules with frontmatter, AGENTS.md, or a single .cursorrules file depending on the output format you choose.

Project Structure

- Follow Django's app-based modular structure.
- Use 4 spaces for indentation.
- Use snake_case for variables, functions, and methods.
- Keep business logic in models, managers, and services — not in views.
- Use class-based views for common patterns, function-based for simple ones.
- Organize templates by app under templates/<app_name>/.

Models & ORM

- Define models with explicit field types and constraints.
- Use Meta class for ordering, indexes, and constraints.
- Use related_name explicitly for ForeignKey and ManyToManyField.
- Use model managers for reusable queryset logic.
- Use select_related() and prefetch_related() to avoid N+1 queries.
- Use migrations for all schema changes — never alter tables manually.

Views & APIs

- Use Django REST Framework for API endpoints.
- Use ModelSerializer for CRUD serializers.
- Use ViewSets with routers for standard REST patterns.
- Use permission_classes for access control on every endpoint.
- Use @action decorator for custom non-CRUD endpoints.
- Use pagination for list endpoints with reasonable defaults.

Common Searches This Page Helps With

django cursor rulesdjango .cursorrulesdjango AGENTS.md

Frequently Asked Questions

What does the Django Cursor rules template include?
It includes 4 rule sections covering project structure, models & orm, views & apis and other Django development conventions.
Can I generate Django Project Rules and AGENTS.md from the same template?
Yes. The generator can export the same stack-specific guidance as modern Project Rules (.mdc), AGENTS.md, or a legacy .cursorrules file.
Should I combine Django with other Cursor rules templates?
Yes. You can combine Django with related templates such as TypeScript, Tailwind CSS, Docker, or backend frameworks when your project uses multiple technologies.

Related Cursor Rules Templates