.cursor/skills/django-templates/SKILL.md
Django template patterns including inheritance, partials, tags, and filters. Use when working with templates, creating reusable components, or organizing template structure.
npx skillsauth add AngelDann/app-comisions-dist django-templatesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
templates/
├── base.html # Root template with common structure
├── partials/ # Reusable fragments (navbar, footer, pagination)
├── components/ # UI components (button, card, modal)
└── <app>/ # App-specific templates
├── list.html # Full pages extend base.html
├── detail.html
├── _list.html # HTMX partials (underscore prefix)
└── _form.html
Naming conventions:
list.html, detail.html, form.html_list.html, _card.html (underscore prefix)partials/_navbar.html, partials/_pagination.htmlcomponents/_button.html, components/_modal.htmlUse three-level inheritance for consistent layouts:
Standard blocks to define in base.html:
title - Page title (use {{ block.super }} to append to site name)content - Main page contentextra_css - Page-specific stylesheetsextra_js - Page-specific scriptsPartials are template fragments included in other templates. Use for:
Components are self-contained UI elements with configurable behavior. Pass context with:
{% include "components/_button.html" with text="Submit" variant="primary" %}only to isolate context: {% include "_card.html" with title=post.title only %}When to create custom template tags:
simple_tag - Return a string value (e.g., active link class, formatted output)inclusion_tag - Render a template fragment (e.g., pagination component, user avatar)When to create custom filters:
Location: apps/<app>/templatetags/<app>_tags.py (create __init__.py in templatetags directory)
Move logic out of templates:
user.can_moderate not user.role == "admin" or user.role == "moderator"Use URL names, not hardcoded paths:
{% url 'posts:detail' pk=post.pk %} not /posts/{{ post.id }}/Use CSS classes, not inline styles:
class="error-message" not style="color: red;"Handle empty states:
{% empty %} clause in loops that might have no itemsAdapted from claude-code-django (.claude/skills/django-templates).
development
pytest-django testing patterns, Factory Boy, fixtures, and TDD workflow. Use when writing tests, creating test factories, or following TDD red-green-refactor cycle.
development
HTMX patterns for Django including partial templates, hx-* attributes, and dynamic UI without JavaScript. Use when building interactive UI, handling AJAX requests, or creating dynamic components.
development
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
development
Check if documentation is in sync with code. Use when the user wants to verify that documentation matches current code, find outdated docs, or audit documentation accuracy. Triggers on requests like "check docs", "sync documentation", "are the docs up to date", "/docs-sync".