rominirani

json-to-pydantic

62
15
# Install this skill:
npx skills add rominirani/antigravity-skills --skill "json-to-pydantic"

Install specific skill from multi-skill repository

# Description

Converts JSON data snippets into Python Pydantic data models.

# SKILL.md


name: json-to-pydantic
description: Converts JSON data snippets into Python Pydantic data models.


JSON to Pydantic Skill

This skill helps convert raw JSON data or API responses into structured, strongly-typed Python classes using Pydantic.

Instructions

  1. Analyze the Input: Look at the JSON object provided by the user.
  2. Infer Types:
  3. string -> str
  4. number -> int or float
  5. boolean -> bool
  6. array -> List[Type]
  7. null -> Optional[Type]
  8. Nested Objects -> Create a separate sub-class.

  9. Follow the Example:
    Review examples/ to see how to structure the output code. notice how nested dictionaries like preferences are extracted into their own class.

  10. Input: examples/input_data.json

  11. Output: examples/output_model.py

Style Guidelines

  • Use PascalCase for class names.
  • Use type hints (List, Optional) from typing module.
  • If a field can be missing or null, default it to None.

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.