From django-design
This skill should be used when the user asks to build a Django project, design models or schemas, create views and APIs, configure deployment or settings, set up authentication, customize the admin, optimize performance, configure background tasks, build CMS features, integrate external APIs, create forms or templates, build django-cotton components, add HTMX or Alpine.js interactivity, style with Tailwind CSS, create D3 visualizations, establish a design system, review migrations, or scaffold apps. It covers the full Django stack from database models through production-ready frontend.
How this skill is triggered — by the user, by Claude, or both
Slash command
/django-design:django-designThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill guides the creation of well-architected Django applications across the full stack: from database models and business logic through templates, components, and interactive frontend. It prevents both backend slop (bloated views, tangled models, missing indexes) and frontend slop (inconsistent styling, scattered interactivity, unmaintainable templates).
references/admin.mdreferences/alpine.mdreferences/api.mdreferences/auth-and-security.mdreferences/background-tasks.mdreferences/cms-and-content.mdreferences/d3-django.mdreferences/deployment.mdreferences/design-system.mdreferences/forms.mdreferences/htmx.mdreferences/integrations.mdreferences/models.mdreferences/performance.mdreferences/tailwind.mdreferences/templates.mdreferences/testing.mdreferences/views.mdThis skill guides the creation of well-architected Django applications across the full stack: from database models and business logic through templates, components, and interactive frontend. It prevents both backend slop (bloated views, tangled models, missing indexes) and frontend slop (inconsistent styling, scattered interactivity, unmaintainable templates).
Before writing any code, understand the shape of the application:
Build with these principles:
@csrf_exempt, allow_all_origins, or hardcoded secret requires explicit justification.primary, error, surface) instead of raw values (#1e40af). This enables theme switching and keeps the design consistent.For new projects, use this structure. It scales from a single-app tool to a multi-app platform without reorganization.
project_name/
manage.py
project_name/
__init__.py
settings/
__init__.py # imports from base, detects environment
base.py # shared settings
development.py # local overrides
production.py # production overrides
test.py # test-specific (fast passwords, in-memory cache)
urls.py # root URL conf, includes app URLs
wsgi.py
asgi.py
apps/
core/ # shared utilities, base models, middleware
models.py # abstract base models (TimeStampedModel, etc.)
middleware.py
templatetags/ # shared template tags and filters
core_tags.py
utils.py
your_app/
models.py
views.py
urls.py
admin.py
forms.py # if using Django forms/templates
serializers.py # if using DRF
services.py # complex business logic that spans models
tests/
__init__.py
test_models.py
test_views.py
templates/
base.html # site-wide base template
base_studio.html # section base (optional)
includes/ # shared partials (nav, footer, pagination)
cotton/ # django-cotton components
card.html
button/
filled.html
outlined.html
your_app/
list.html # full page templates
_list_partial.html # HTMX partials (prefixed with underscore)
detail.html
static/
css/
tokens.css # design system tokens (colors, typography, spacing)
main.css # base styles
js/
main.js # Alpine.js init, shared behavior
alpine-components.js # reusable Alpine.data() functions
charts/ # D3 chart modules
utils.js # shared chart setup
requirements/
base.txt
development.txt
production.txt
Key decisions in this structure:
Settings as a package rather than a single file. This eliminates if DEBUG blocks and environment-sniffing. Each environment file imports from base.py and overrides what it needs.
Apps inside an apps/ directory to keep the project root clean. A core app holds shared abstractions so other apps don't depend on each other.
A services.py file for logic that coordinates across multiple models or involves external API calls. This prevents views from becoming business logic dumps.
Templates organized by app, not by type. Components go in templates/cotton/. HTMX partials are prefixed with underscore (_list_partial.html). This keeps related templates together.
Static assets organized by purpose. Design tokens in tokens.css, Alpine components in their own file, D3 charts in a charts/ directory. Each has a clear responsibility.
Each topic has a dedicated reference file with deep patterns, code examples, and anti-patterns. The library is organized into two pillars plus cross-cutting concerns.
Core server-side architecture, data layer, and infrastructure.
references/models.md - Abstract base models, field selection, index strategy, relationships, N+1 prevention, custom managers, signals, database constraintsreferences/views.md - FBV vs CBV guidance, template-based views, URL patterns, middleware, pagination, file uploads, error handlingreferences/api.md - DRF ViewSets, serializer patterns (list vs detail), router config, permissions, throttling, filtering, pagination, Django Ninja alternativesreferences/auth-and-security.md - Built-in auth, external providers (Clerk, Auth0), permissions, role-based access, security settings, CORS, rate limitingreferences/admin.md - Model registration, list_display, filters, fieldsets, custom actions, inline models, django-unfold, admin performancereferences/deployment.md - Vercel serverless, Gunicorn + Nginx, Docker, environment variables, connection pooling, static files, health checks, loggingreferences/background-tasks.md - Celery, django-rq, Huey, task design (idempotency, retries, timeouts), queue architecture, periodic tasks, monitoringreferences/cms-and-content.md - Content models, publishable workflows, page trees, placeholder/plugin architecture, content versioning, draft/live patternsTemplates, components, interactivity, and design system.
references/templates.md - Base template pattern, template inheritance, custom tags/filters, django-cotton components (definition, slots, props, dynamic attributes, Alpine integration), django-material, context processorsreferences/forms.md - ModelForm patterns, plain forms, formsets, custom widgets, form rendering control, validation order. See also templates.md for form field componentsreferences/htmx.md - Core HTMX attributes with Django examples, partial template pattern, CSRF handling, search with debounce, inline editing, infinite scroll, OOB swaps, boosted navigation, django-unicorn alternativereferences/alpine.md - Core directives (x-data, x-show, x-bind, x-model, x-for), Alpine + HTMX pairing patterns, Alpine + Cotton components, reusable data functions, transitions, passing Django data safelyreferences/tailwind.md - Django integration (django-tailwind and django-tailwind-cli), template usage, JIT and content scanning, responsive patterns, dark mode, component styling, production optimizationreferences/d3-django.md - Data handoff (json_script filter vs API endpoints), bar charts, line charts, force-directed graphs, responsive SVG, D3 + Alpine reactivity, chart file organizationreferences/design-system.md - Semantic color tokens, typography scale, spacing system, component-level tokens, Tailwind config mapping, Material Design 3 integration, light/dark theme switchingConcerns that span both backend and frontend.
references/performance.md - Query optimization, N+1 detection, annotations, only()/defer(), bulk operations, caching (low-level, template fragment, per-view), profiling, EXPLAIN ANALYZE, assertNumQueriesreferences/testing.md - factory_boy, pytest-django, testing business logic, view tests, constraint tests, query count tests, test organizationreferences/integrations.md - Client class pattern, authentication handling, retry with backoff, logging external calls, caching stable data, graceful degradation, testing mocked integrationsFor tasks that span both pillars, read references from each:
| Task Type | Read |
|---|---|
| New list page with filtering | views.md, templates.md, htmx.md |
| API endpoint serving chart data | api.md, d3-django.md, performance.md |
| Form with client-side validation | forms.md, alpine.md, htmx.md |
| Dashboard with data visualizations | views.md, templates.md, d3-django.md, design-system.md |
| Reusable UI component | templates.md (Cotton section), design-system.md, tailwind.md |
| Full CRUD feature | models.md, views.md, forms.md, templates.md, testing.md |
Five specialized agents provide targeted review and assistance:
| Agent | Focus | Use When |
|---|---|---|
django-architect | Full architecture review | Starting a new project, major refactoring, cross-pillar design decisions |
django-profiler | Performance analysis | Slow queries, N+1 detection, caching strategy, load testing results |
django-migrator | Migration safety | Schema changes, data migrations, zero-downtime deployments |
django-api-reviewer | API design review | New endpoints, serializer patterns, auth/permissions setup, API versioning |
django-frontend | Frontend integration review | Template structure, HTMX patterns, component conventions, accessibility |
These are the Django equivalent of "AI slop." They look plausible but create real problems:
select_related and prefetch_related before reaching for raw SQL.settings to check environment. Use feature flags, middleware, or context processors.{{ data|safe }} in JavaScript. Use Django's json_script filter for XSS-safe data transfer to Alpine or D3. Never inject unescaped data into script tags.{% if essay.word_count > 3000 and essay.stage == 'drafting' %}, that logic belongs on the model as a property or method.bg-primary, text-error) instead of raw values (bg-[#1e40af]). Hardcoded colors break theme switching.viewBox for responsive D3 charts. Pixel-width SVGs break on mobile.{% url %} tags and reverse(). Always.Provides CDSS development patterns for drug interaction checking, dose validation, clinical scoring (NEWS2, qSOFA), and alert classification integrated into EMR workflows.
npx claudepluginhub travis-gilbert/claude-marketplace --plugin django-design