Agent skill
django-model-helper
Generates Django models with proper field types, relationships, and migrations. Use when creating Django models or database schemas.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/django-model-helper
SKILL.md
Django Model Helper
Generates Django models following best practices.
When to Use
- "Create a Django model for users"
- "Generate Product model"
- "Add BlogPost model with relationships"
Model Generation
from django.db import models
from django.contrib.auth.models import AbstractUser
class User(AbstractUser):
"""Custom user model."""
bio = models.TextField(blank=True)
avatar = models.ImageField(upload_to='avatars/', blank=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
class Meta:
db_table = 'users'
ordering = ['-created_at']
def __str__(self):
return self.username
class Post(models.Model):
"""Blog post model."""
title = models.CharField(max_length=200)
slug = models.SlugField(unique=True)
author = models.ForeignKey(User, on_delete=models.CASCADE, related_name='posts')
content = models.TextField()
published_at = models.DateTimeField(null=True, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
class Meta:
db_table = 'posts'
ordering = ['-published_at']
indexes = [
models.Index(fields=['slug']),
models.Index(fields=['author', '-published_at']),
]
def __str__(self):
return self.title
After Creating Model
-
Generate migration:
bashpython manage.py makemigrations -
Apply migration:
bashpython manage.py migrate
Best Practices
- Use appropriate field types
- Add indexes for frequently queried fields
- Define str methods
- Use Meta class for table name and ordering
- Add related_name to relationships
- Include created_at/updated_at timestamps
- Use on_delete properly
- Add helpful docstrings
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?