pydantic

pydantic is a skill for Claude Code from Jartan-LLC/grimoire. It costs 25 tokens per session (7,228 once invoked), scanned A, original, MIT.

A Python data-validation library that checks incoming values against type-based models while the program is running. It can convert some compatible values and reports validation errors for invalid data.

In plain words
What is it for?
Validating API requests, configuration, database records, and other structured Python data with fields, constraints, defaults, and type annotations.
Why use it?
It catches malformed data at the boundary of an application instead of letting incorrect values spread through the program. Models also provide a consistent way to describe and export data.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Part of the pythonica plugin — 17 skills shipped together

Good fit Validating API requests, configuration, database records, and other structured Python data with fields, constraints, defaults, and type annotations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jartan-llc/grimoire/pydantic
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Jartan-LLC/grimoire --skill pydantic
Clone the repo
git clone --depth 1 https://github.com/Jartan-LLC/grimoire

Made for: Claude Code.

Or install pythonica, the plugin that ships this one along with the rest of its 17 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pydantic

README.md
[![agentmods](https://agentmods.dev/badge/skills/jartan-llc/grimoire/pydantic/github.svg)](https://agentmods.dev/skills/jartan-llc/grimoire/pydantic)
Your own site
<a href="https://agentmods.dev/skills/jartan-llc/grimoire/pydantic"><img src="https://agentmods.dev/badge/skills/jartan-llc/grimoire/pydantic/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pydantic

Your own site · 80×15
<a href="https://agentmods.dev/skills/jartan-llc/grimoire/pydantic"><img src="https://agentmods.dev/badge/skills/jartan-llc/grimoire/pydantic.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 25 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 7,228 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00025 $0.07228
Opus 5 $0.00013 $0.03614
Sonnet 5 $0.00005 $0.01446
Haiku 4.5 $0.00003 $0.00723

Measured 9d ago against content hash 95bc97566acc, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

pydantic scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/pythonica/skills/pydantic/SKILL.md · 1,264 lines

How it starts

The opening of the file, as written. The whole thing — 1,264 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Pydantic Validation Skill

Quick Start

from pydantic import BaseModel, Field, EmailStr
from datetime import datetime

class User(BaseModel):
    id: int
    name: str = Field(..., min_length=1, max_length=100)
    email: EmailStr
    created_at: datetime = Field(default_factory=datetime.now)
    is_active: bool = True

# Validate data
user = User(id=1, name="Alice", email="[email protected]")
print(user.model_dump())  # {'id': 1, 'name': 'Alice', ...}

# Automatic type coercion
user2 = User(id="2", name="Bob", email="[email protected]")
assert user2.id == 2  # String "2" coerced to int

# Validation error
try:
    User(id=3, name="", email="invalid")
except ValidationError as e:
    print(e.errors())

Core Concepts

BaseModel Foundation

from pydantic import BaseModel, ConfigDict

class Product(BaseModel):
    model_config = ConfigDict(
        str_strip_whitespace=True,
        validate_assignment=True,
        use_enum_values=True,
        arbitrary_types_allowed=False
    )

    name: str
    price: float
    quantity: int = 0

# Usage
product = Product(name="  Widget  ", price=19.99)
assert product.name == "Widget"  # Whitespace stripped

# Validate on assignment
product.price = "29.99"  # Auto-converts to float

Field Configuration

from pydantic import Field, field_validator
from typing import Annotated

class Item(BaseModel):
    # Field constraints
    sku: str = Field(pattern=r'^[A-Z]{3}-\d{4}$')
    price: float = Field(gt=0, le=10000)
    stock: int = Field(ge=0, default=0)

    # Annotated types (Pydantic v2)
    quantity: Annotated[int, Field(ge=1, le=100)]

    # Descriptions and examples
    description: str = Field(
        ...,
        description="Product description",
        examples=["High-quality widget"]
    )

    # Deprecated fields
    old_field: str | None = Field(None, deprecated=True)

    @field_validator('sku')
    @classmethod
    def validate_sku(cls, v: str) -> str:
        if not v.startswith('ABC'):
            raise ValueError('SKU must start with ABC')
        return v

Read the full file on GitHub · 1,264 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 1,264 lines · 25 tokens per session scan A 95bc97566acc

Subscribe to this mod's changes

pydantic is a skill published in the GitHub repository Jartan-LLC/grimoire (2 stars, last pushed yesterday), licensed MIT. It adds 25 tokens to every session and 7,228 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

django-expert

Use when building Django web applications or REST APIs with Django REST Framework. Invoke when working with settings.py, models.py, manage.py, or any Django project file. Creates Django models with proper indexes, optimizes ORM queries using selectrelated/prefetchrelated, builds DRF serializers and viewsets, and…

Jeffallan/claude-skills · 96 tokens

fastapi-expert

Use when building high-performance async Python APIs with FastAPI and Pydantic V2. Invoke to create REST endpoints, define Pydantic models, implement authentication flows, set up async SQLAlchemy database operations, add JWT authentication, build WebSocket endpoints, or generate OpenAPI documentation. Trigger terms…

Jeffallan/claude-skills · 95 tokens

framework-migration-assistant

Automatically migrate Python web applications between frameworks (Flask → FastAPI, Django → FastAPI). Use when you need to migrate an existing web application to a modern framework while preserving functionality. The skill analyzes the codebase, updates routes, handlers, configuration, dependency injection patterns…

ArabelaTso/Skills-4-SE · 92 tokens

fastapi-senior-dev

Senior Python Backend Engineer skill for FastAPI. Use when scaffolding production-ready APIs, enforcing clean architecture, optimizing async patterns, or auditing FastAPI codebases.

georgekhananaev/claude-skills-vault · 39 tokens

django

Use when building Django applications. Covers ORM query performance, model design, migrations, Django REST Framework, security defaults, and testing.

nimadorostkar/Claude-Skills-collection · 28 tokens

fastapi

Use when building APIs with FastAPI. Covers dependency injection, Pydantic v2 validation, async database access, authentication, background tasks, and testing.

nimadorostkar/Claude-Skills-collection · 34 tokens