python-schemas

Define and validate Pydantic v2 models with field and model validators.

1|Updated Mar 30, 2026
One-click install
npx skills add https://github.com/anicdh/agstack --skill python-schemas
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-schemas
Source: https://github.com/anicdh/agstack/tree/main/.claude/skills/python/python-schemas
Command: npx skills add https://github.com/anicdh/agstack --skill python-schemas

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers define and validate Pydantic v2 BaseModel schemas, manage settings, and implement modern validation patterns to reduce boilerplate and ensure consistent data handling across Python applications.

Core Features & Use Cases

  • Define request/response models with Field validators and model validators (Pydantic v2).
  • Use ConfigDict(from_attributes=True) for ORM serialization and safe exposure of data.
  • Centralized configuration via Settings with environment variables and .env support for predictable deployment.

Quick Start

Define a simple Pydantic v2 model with a few fields and validators, then instantiate it with sample data to observe automatic validation and normalization.

Frequently Asked Questions about python-schemas

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

FAQPage Schema
How do I define and validate Pydantic v2 models for API request and response schemas?

Define Pydantic v2 models for API request and response schemas by creating BaseModel classes with typed fields, then apply field_validator and model_validator decorators to enforce data validation and normalization automatically.

What is the best way to serialize ORM objects using Pydantic v2?

Serializing ORM objects using Pydantic v2 requires setting ConfigDict(from_attributes=True) on your BaseModel, which allows the schema to read data directly from object attributes for safe exposure and conversion.

How do I manage application settings with environment variables and .env files in Python?

Manage application settings with environment variables and .env files in Python by extending the Settings base class with env_file support, centralizing configuration for predictable deployment across different environments.

Can I use field_validator and model_validator together for complex validation in Pydantic v2?

You can use field_validator and model_validator together in Pydantic v2 to handle complex validation, combining field-specific checks with whole-model validation logic to reduce boilerplate.

Why does my Pydantic v2 schema fail to serialize data from ORM objects?

Pydantic v2 schema serialization from ORM objects fails when the model lacks ConfigDict(from_attributes=True), which is required to map object attributes to model fields during conversion.