py-pydantic-patterns

Community

Standardize Pydantic v2 validation patterns.

AuthorCJHarmath
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill provides practical migration and pattern guidance for migrating from Pydantic v1 to v2, enabling robust validation, serialization, and API modeling in Python projects.

Core Features & Use Cases

  • Migration patterns: from v1 to v2 using field_validator, model_validator, and ConfigDict configurations.
  • Validation patterns: field validators, model validators, discriminated unions, and custom types for clean data models.
  • Serialization control: customize how models serialize to dicts or JSON with field_serializer and computed fields.
  • API modeling: build clear input/output schemas and reuse base models via schema inheritance for FastAPI/SQLModel.

Quick Start

Define a simple Pydantic v2 model with model_config, then validate input data using model_validate to demonstrate field and model validators.

Dependency Matrix

Required Modules

None required

Components

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: py-pydantic-patterns
Download link: https://github.com/CJHarmath/claude-agents-skills/archive/main.zip#py-pydantic-patterns

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.