Skip to content
Back to skills

Django Model Helper

ASecurity

Generates Django models with proper field types, relationships, and migrations. Use when creating Django models or database schemas.

  • 666 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added February 8, 2026
databasespythongobashdjangodatabase

Security analysis

A100/100

Scanned February 10, 2026

npx -y skills add majiayu000/claude-skill-registry --skill django-model-helper --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Django Model Helper?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Django Model Helper
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-django-model-helper/badge)](https://www.skillsdirectory.com/skills/majiayu000-django-model-helper)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: django-model-helper
description: Generates Django models with proper field types, relationships, and migrations. Use when creating Django models or database schemas.
allowed-tools: [Write, Read, Bash]
---

# 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

```python
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

1. Generate migration:
   ```bash
   python manage.py makemigrations
   ```

2. Apply migration:
   ```bash
   python 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

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.