What problem does it solve? Pydantic v2 code often fails silently through unintended coercion, alias mismatches, leaked subclass fields, or broken v1-to-v2 migrations. This Skill guides writing, reviewing, debugging, and testing Pydantic models so validation boundaries and serialized output are explicit, tested, and version-correct. ## Core Features & Use Cases - Boundary Design: Choose the right abstraction (BaseModel, TypeAdapter, RootModel) based on input source, strictness, extra-data policy, and output contract. - Validation & Serialization Guidance: Apply validators, serializers, discriminated unions, directional aliases, and strict-mode rules with canonical code patterns. - Version Grounding & Migration: Detect v1-shaped APIs (parse_obj, .dict(), @validator, orm_mode) and migrate them with behavior tests, plus an inspection script that reports installed Pydantic versions and API signatures. - Use Case: When an API endpoint accepts payment payloads, use this Skill to build a strict model with extra="forbid", a discriminated union for payment kinds, tested aliases, and JSON-mode serialization that cannot leak internal fields. ## Quick Start Ask the AI to review or write a Pydantic model for your payload, specifying the input source, strictness needs, and expected serialized output.