AGENTS-COLLECTION json-to-pydantic
Converts JSON data snippets into Python Pydantic data models.
install
source · Clone the upstream repo
git clone https://github.com/mk-knight23/AGENTS-COLLECTION
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/mk-knight23/AGENTS-COLLECTION "$T" && mkdir -p ~/.claude/skills && cp -r "$T/AGENTS/ANTIGRAVITY/SKILLS/JSON-TO-PYDANTIC" ~/.claude/skills/mk-knight23-agents-collection-json-to-pydantic && rm -rf "$T"
manifest:
AGENTS/ANTIGRAVITY/SKILLS/JSON-TO-PYDANTIC/SKILL.mdsource content
JSON to Pydantic Skill
This skill helps convert raw JSON data or API responses into structured, strongly-typed Python classes using Pydantic.
Instructions
-
Analyze the Input: Look at the JSON object provided by the user.
-
Infer Types:
->stringstr
->number
orintfloat
->booleanbool
->arrayList[Type]
->nullOptional[Type]- Nested Objects -> Create a separate sub-class.
-
Follow the Example: Review
to see how to structure the output code. notice how nested dictionaries likeexamples/
are extracted into their own class.preferences- Input:
examples/input_data.json - Output:
examples/output_model.py
- Input:
Style Guidelines
- Use
for class names.PascalCase - Use type hints (
,List
) fromOptional
module.typing - If a field can be missing or null, default it to
.None