django-model

Create Django models with BaseModel, UUID primary keys, and Pydantic JSON validation.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/jprokay-counterpart/jprokay-counterpart --skill django-model
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: django-model
Source: https://github.com/jprokay-counterpart/jprokay-counterpart/tree/main/claude/skills/django-model
Command: npx skills add https://github.com/jprokay-counterpart/jprokay-counterpart --skill django-model

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires django, pydantic, psycopg2-binary.

What problem does it solve?

Django model creation can be complex, especially when adhering to specific architectural patterns like UUID primary keys, audit fields, and Pydantic validation for JSON fields. This Skill standardizes the process, preventing common errors and ensuring consistency across your codebase, allowing you to focus on business logic.

Core Features & Use Cases

  • Pattern-Compliant Models: Automatically generate models inheriting from BaseModel with UUID PKs and audit timestamps, ensuring architectural consistency.
  • Pydantic JSON Validation: Implement robust, type-safe validation for JSON fields using Pydantic schemas, reducing data integrity issues.
  • Relationship Management: Correctly define foreign keys, one-to-many, and many-to-many relationships with proper on_delete behavior and related_name for efficient querying.
  • Use Case: When starting a new feature that requires a new database table, use this Skill to quickly scaffold a model that perfectly fits your project's established patterns, complete with audit fields and complex JSON data validation, saving development and review time.

Quick Start

Define a Pydantic model for JSON field validation

from pydantic import BaseModel as PydanticBaseModel, Field class CoverageDetailSchema(PydanticBaseModel): coverage_type: str = Field(..., description="Type of coverage") limit: float = Field(..., gt=0, description="Coverage limit")

Create the Django model inheriting from common.models.BaseModel

from django.db import models from common.models import BaseModel # Assumes BaseModel exists from pydantic import PydanticEncoder class PolicyCoverage(BaseModel): coverage_name: str = models.CharField(max_length=100) coverage_details = models.JSONField( default=dict, encoder=PydanticEncoder, help_text="Coverage details as validated JSON" )

Frequently Asked Questions about django-model

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create Django models with UUID primary keys and audit fields?

Create Django models inheriting from a BaseModel class with UUID primary keys and automatic audit timestamps. This Skill generates pattern-compliant models that standardize your codebase, ensure architectural consistency, and eliminate common setup errors across your project.

Can I validate JSON fields in Django models using Pydantic?

Yes. Define a Pydantic schema for type-safe validation, then attach it to a Django JSONField with PydanticEncoder. This approach reduces data integrity issues and enforces strict validation rules on complex JSON data stored in your database.

What's the best way to define Django relationships like foreign keys and many-to-many?

Define relationships with proper `on_delete` behavior and `related_name` attributes for efficient querying. This Skill shows how to correctly establish foreign keys, one-to-many, and many-to-many relationships within architectural patterns.

How do I scaffold a new Django model that follows project patterns?

Use this Skill to quickly generate a new model with UUID PKs, audit fields, and Pydantic-validated JSON fields built in. It eliminates repetitive setup and review cycles by ensuring every model adheres to your established architectural standards.

Does this work with psycopg2 and PostgreSQL databases?

Yes. The Skill includes psycopg2-binary as a dependency and is designed for PostgreSQL. UUID primary keys and JSONField validation work natively with psycopg2-backed Django projects.