pydantic · jiatastic — Claude Code skill: what it does, how to install
A skill that tells the agent how to model data with Pydantic: typed fields, validators, serialization and JSON schema output.
MIT 194 installs ★ 10 updated 2026-01-25
npx skills add jiatastic/open-python-skills --skill pydantic -a claude-codeWhat pydantic does
The skill covers the everyday Pydantic loop: schemas built from Python type hints, checks on data coming in and going out, dumping a model back to a dict or a JSON string.
It lists the patterns worth reaching for — typed fields, a validator for a single value, cross-field checks, settings read from environment variables. A short troubleshooting part names the usual traps: coercion that surprises you (reach for strict types), validators that get slow, mutable defaults that want default_factory.
The library has to be in the project first: uv pip install pydantic. The skill is guidance, not the package, so nothing gets validated until it is installed. Generated validators still deserve a read — a cross-field check the agent writes can reject payloads you meant to accept.
What it helps with
- define a request schema as a Pydantic model
- reject malformed payloads before they reach the database
- export a JSON schema for the API docs
- add a
field_validatorto a single field - pull config out of environment variables with
BaseSettings
Example prompts for the agent
- Model the incoming order payload with Pydantic and reject empty names.
- Run this dict through
model_validateand printmodel_dump(). - Generate the JSON schema from that model for the docs page.
How to install pydantic
1Skills CLI (Vercel)
npx skills add jiatastic/open-python-skills --skill pydantic -a claude-code2Manually: put the files in place
~/.claude/skills/pydantic/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/pydantic/
1Skills CLI (Vercel)
npx skills add jiatastic/open-python-skills --skill pydantic -a codex2Manually: put the files in place
.agents/skills/pydantic/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add jiatastic/open-python-skills --skill pydantic -a cursor2Manually: put the files in place
.cursor/skills/pydantic/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install jiatastic/open-python-skills skills/pydantic2Manually: put the files in place
.github/skills/pydantic/SKILL.md1Skills CLI (Vercel)
npx skills add jiatastic/open-python-skills --skill pydantic -a gemini-cli2Platform CLI
gemini skills install https://github.com/jiatastic/open-python-skills --path skills/pydanticManually: put the files in place
.devin/skills/pydantic/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add jiatastic/open-python-skills --skill pydantic -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about pydantic
How do I install the pydantic skill in Claude Code?
Run npx skills add jiatastic/open-python-skills --skill pydantic -a claude-code. The skill file lands at ~/.claude/skills/pydantic/SKILL.md.
What does the pydantic skill do?
It hands the agent ready patterns for Pydantic models, validators and serialization, so data checks come out in one shape instead of being rewritten each time.
Do I still need the Pydantic package installed?
Yes, install it separately with uv pip install pydantic. The skill only shows how to use it.
Source text
SKILL.md · MIT
---
name: pydantic
description: >
Pydantic models and validation. Use when: (1) Defining schemas,
(2) Validating input/output, (3) Generating JSON schema.
---
# 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
```bash
uv pip install pydantic
```
```python
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**: `model_dump()` and `model_dump_json()`.
5. **Settings**: environment-driven config via `BaseSettings`.
## Example: field_validator
```python
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: model_validate + model_dump
```python
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
- https://docs.pydantic.dev/
© jiatastic · MIT · jiatastic/open-python-skills
Similar skills
All skills for Backend and APIs →pydantic by other authors comes first.