jiatastic/open-python-skills

pydantic

Pydantic models and validation. Use when: (1) Defining schemas, (2) Validating input/output, (3) Generating JSON schema.

First seen Jan 24, 2026

Installation

$ npx skills add jiatastic/open-python-skills --skill pydantic

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from jiatastic/open-python-skills · top by installs.

npx skills add jiatastic/open-python-skills

Browse all from jiatastic/open-python-skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 9
License LICENSE
Default branch main
Open issues 0
Status Active

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 1,673 B
  • docs SUMMARY.md 136 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 173 installs

SKILL.md

pydantic

Type-driven validation and serialization using Pydantic models.

Overview

Pydantic validates data using Python type hints and provides rich serialization via model_dump() and JSON schema output.

When to Use

  • Validating request/response payloads
  • Normalizing untrusted input
  • Generating JSON schema for docs

Quick Start

uv pip install pydantic
from pydantic import BaseModel

class User(BaseModel):
    id: int
    email: str

user = User(id=1, email="[email protected]")

Core Patterns

  1. Typed fields: strict schema definitions.
  2. Field validators: custom validation logic.
  3. Model validators: cross-field checks.
  4. Serialization: modeldump() and modeldump_json().
  5. Settings: environment-driven config via BaseSettings.

Example: field_validator

from pydantic import BaseModel, field_validator

class Model(BaseModel):
    name: str

    @field_validator("name")
    @classmethod
    def ensure_not_empty(cls, v: str):
        if not v:
            raise ValueError("name required")
        return v

Example: modelvalidate + modeldump

from pydantic import BaseModel

class Model(BaseModel):
    foo: int

model = Model.model_validate({"foo": 1})
print(model.model_dump())

Troubleshooting

  • Coercion surprises: use strict types if needed
  • Slow validators: keep them minimal
  • Mutable defaults: use default_factory

References