← ClaudeAtlas

model-entity-validatorlisted

This skill should be used when the user asks to "create a model", "add a Django model", "create database table", "add entity", "define schema", or when writing class definitions inheriting from models.Model. Validates BaseModel inheritance pattern.
smicolon/ai-kit · ★ 3 · AI & Automation · score 64
Install: claude install-skill smicolon/ai-kit
# Model/Entity Validator Enforces Smicolon's BaseModel inheritance pattern for all Django models. ## Activation Triggers This skill activates when: - Creating new model files - Modifying existing models - Mentioning "model", "database", "schema", "table" - Writing class inheriting from `models.Model` - Running migrations - Discussing data structure ## Core Principle: BaseModel Inheritance **NEVER repeat UUID/timestamp fields.** All models inherit from BaseModel. ```python # ❌ WRONG - Repeating fields class User(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) is_deleted = models.BooleanField(default=False) email = models.EmailField() # ✅ CORRECT - Inherit from BaseModel import core.models as _core_models class User(_core_models.BaseModel): email = models.EmailField(unique=True) ``` ## Validation Process ### Step 1: Check if BaseModel Exists Before any action, check if the project has a BaseModel: ```python # Search for BaseModel in (in order): # 1. core/models.py # 2. shared/models.py # 3. common/models.py # 4. {app}/base.py ``` **If BaseModel found:** Suggest inheritance (Step 2a) **If BaseModel NOT found:** Create BaseModel first (Step 2b) ### Step 2a: BaseModel Exists - Suggest Inheritance When seeing: ```python class Product(models.Model): name = models.CharField(max_length=255) ``` Fix