| name | django |
| description | Django ORM patterns, Django REST Framework, middleware, signals, async views, and production-grade application architecture |
| layer | domain |
| category | backend |
| triggers | ["django","django rest framework","drf","django orm","django models","django middleware","django signals"] |
| inputs | ["Django application requirements","API design specifications","Data model definitions"] |
| outputs | ["Django model and view implementations","DRF serializer and viewset patterns","Production configuration"] |
| linksTo | ["python","postgresql","redis","message-queues","microservices"] |
| linkedFrom | ["error-handling","authentication","testing"] |
| preferredNextSkills | ["postgresql","redis","python"] |
| fallbackSkills | ["fastapi","nodejs"] |
| riskLevel | low |
| memoryReadPolicy | selective |
| memoryWritePolicy | none |
| sideEffects | [] |
Django Domain Skill
Purpose
Provide expert-level guidance on Django development including ORM optimization, Django REST Framework patterns, middleware, signals, async views, security hardening, and deployment best practices.
Key Patterns
1. Model Design
import uuid
from django.db import models
from django.utils import timezone
from django.core.validators import MinValueValidator
class TimestampedModel(models.Model):
"""Abstract base model with created/updated timestamps."""
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
created_at = models.DateTimeField(db_index=True, default=timezone.now)
updated_at = models.DateTimeField(auto_now=True)
class Meta:
abstract = True
ordering = ["-created_at"]
class Product(TimestampedModel):
name = models.CharField(max_length=200, db_index=True)
slug = models.SlugField(max_length=200, unique=True)
description = models.TextField(blank=True)
price = models.IntegerField(
validators=[MinValueValidator(0)],
help_text="Price in cents"
)
category = models.ForeignKey(
"Category",
on_delete=models.PROTECT,
related_name="products",
)
tags = models.ManyToManyField("Tag", blank=True, related_name="products")
is_active = models.BooleanField(default=, db_index=)
(TimestampedModel.Meta):
constraints = [
models.CheckConstraint(
check=models.Q(price__gte=),
name=,
),
models.UniqueConstraint(
fields=[, ],
name=,
),
]
indexes = [
models.Index(fields=[, ]),
models.Index(fields=[], condition=models.Q(is_active=),
name=),
]
() -> :
.name
() -> :