All databases

Cursor rule

Htmx Django Cursorrules Prompt File

Cursor rules for HTMX development with Django integration.

HTMX and Django best practices

js
const htmxDjangoBestPractices = [
  "Use Django's template system with HTMX attributes",
  "Implement Django forms for form handling",
  "Utilize Django's URL routing system",
  "Use Django's class-based views for HTMX responses",
  "Implement Django ORM for database operations",
  "Utilize Django's middleware for request/response processing",
];

Folder structure

js
const folderStructure = `
project_name/
  app_name/
    templates/
    static/
      css/
      js/
    models.py
    views.py
    urls.py
  project_name/
    settings.py
    urls.py
manage.py
`;

Additional instructions

js
const additionalInstructions = `
1. Use Django's template tags with HTMX attributes
2. Implement proper CSRF protection with Django's built-in features
3. Utilize Django's HttpResponse for HTMX-specific responses
4. Use Django's form validation for HTMX requests
5. Implement proper error handling and logging
6. Follow Django's best practices for project structure
7. Use Django's staticfiles app for managing static assets
`;

More Frontend rules

Frequently asked questions

What is the Htmx Django Cursorrules Prompt File Cursor rule?

Cursor rules for HTMX development with Django integration. It is a Frontend rule, stored as htmx-django-cursorrules-prompt-file.mdc.

How do I use the Htmx Django Cursorrules Prompt File rule in Cursor?

Copy the rule from this page and save it as htmx-django-cursorrules-prompt-file.mdc in your project's .cursor/rules folder, or paste it into Cursor's project rules settings.