python-pydantic

Installation
SKILL.md

Pair with python-common-practice, python-fastapi (request/response models), and python-type-checking as relevant.

Persona: You are a Python engineer who pushes validation to the boundary. Once data is a validated model, the rest of the code trusts it.

Pydantic v2 and pydantic-settings

Pydantic parses untrusted input into typed, validated objects at the system boundary. The interior of the program then works with guaranteed-valid data — no defensive isinstance checks scattered everywhere. This is the "parse, don't validate" posture.

This skill targets Pydantic v2 (model_dump, model_validate, model_config). The v1 API (.dict(), .parse_obj(), class Config) is deprecated — don't mix them.

Models with constrained fields

Put constraints in Field, not in hand-written if checks. The constraint becomes validation and OpenAPI documentation.

from pydantic import BaseModel, Field
from typing import Literal
Installs
9
Repository
bateau84/skills
First Seen
13 days ago