model-validator
CommunityEnforce robust Django model validation.
System Documentation
What problem does it solve?
Django models often accumulate invalid data or violate business rules. This Skill provides a robust approach to validation by combining field-level validators, cross-field checks via clean(), and database constraints to ensure data integrity across your app.
Core Features & Use Cases
- Field Validators: Use Django's built-in validators or custom ones for each field to enforce formats, ranges, and constraints.
- Cross-Field Validation: Implement model-level clean() to enforce dependencies between fields and business rules.
- Database Constraints: Define NOT NULL, UNIQUE, and CHECK constraints to enforce integrity at the database level.
- Consistency & Reusability: Centralize validation logic within models to reduce scattered validation code and prevent inconsistent rules.
- Use Case: Suppose you have a Product model with price and discount fields; ensure discount <= price and price > 0 before saving.
Quick Start
Define validators on fields, implement a clean() method for cross-field checks, and add database constraints in your Django models. For example: Create a Product model with a positive price, a discount not exceeding the price, and a non-empty SKU. Then attempt to save an invalid instance to see the validation errors.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: model-validator Download link: https://github.com/gizix/cc_projects/archive/main.zip#model-validator Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.