Agent skill · software engineering · aiskillstore
py-pydantic-patterns
Pydantic v2 patterns for validation and serialization. Use when creating schemas, validating data, or working with request/response models.
Why this skill is useful
Provides specific Pydantic v2 patterns for validation and serialization that are crucial for avoiding common pitfalls in data modeling.
What it needs
About 4k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.
What this skill does
Pydantic v2 Patterns Problem Statement Pydantic v2 has significant API changes from v1. This codebase uses v2. Wrong patterns cause validation failures, serialization bugs, and frontend integration issues. --- Pattern: v1 to v2 Migration Critical changes to know: Quick reference: v1 v2 ---- ----- class Config modelconfig = ConfigDict(...) ormmode = True fromattributes=True .dict() .modeldump() .json() .modeldumpjson() @validator @fieldvalidator @rootvalidator @modelvalidator parseobj() modelvalidate() updateforwardrefs() modelrebuild() --- Pattern: Field Validators --- Pattern: Model Validators --- Pattern: Model Configuration --- Pattern: Field Definitions --- Pattern: Discriminated Unions Problem: Polymorphic responses where type depends on a field. --- Pattern: Custom Types --- Pattern: Serialization Control --- Pattern: Schema Inheritance --- Common Issues Issue Likely Cause Solution ------- -------------- ---------- "X is not a valid dict" Using .dict() (v1) Use .modeldump() "Unable to parse ORM object" Missing fromattributes Add ConfigDict(fromattributes=True) "@validator not recognized" v1 decorator Use @fieldvalidator with @classmethod "Extra fields not permitted" extra="forbid" Remove extra fields or change config Validation not running Default value not validated Add validatedefault=True --- Detection Commands
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills aiskillstore/py-pydantic-patterns