Skip to content
Skillpedia
APIs & servers (backend)48k · #3928

pydantic-models-py

Lets your agent create clear data models for APIs. It uses the multi-model pattern to organize information. Useful for defining clean API contracts.

What it does

This tool helps create organized data structures for use in computer programs, especially for communication between different parts of a system (like an API). It uses a pattern called the 'Multi-Model Pattern' to define how data should be.

When to use it

  • ✓When defining how data is sent to create something new.
  • ✓When defining how data is sent to update something existing.
  • ✓When defining how data is returned as a response.

Example of what to ask your AI

“Create a Pydantic model for a user with name, email, and creation date fields, following the multi-model pattern.”

Want more? Open the sections below.

How to use

The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.

Skill link

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/pydantic-models-py/SKILL.md

Ready-to-paste message

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/pydantic-models-py/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
How it works

The tool uses the Pydantic library to define 'models' which are like blueprints for organizing data. It suggests using base models for common data and specific models for creation, updates, and responses.

Installation

Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.

In the terminal (Claude Code, Codex, Cursor), in your project folder:

npx skills add sickn33/agentic-awesome-skills --skill pydantic-models-py

Or download just the file:

curl -L https://raw.githubusercontent.com/sickn33/agentic-awesome-skills/main/plugins/agentic-awesome-skills-claude/skills/pydantic-models-py/SKILL.md -o SKILL.md
Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Pydantic Models

Create Pydantic models following the multi-model pattern for clean API contracts.

Quick Start

Use the inline model patterns below and adapt class names and fields to the actual API contract. Inspect the installed Pydantic version before selecting configuration syntax; these fragments require the imports and application types shown by your project. Do not assume a standalone template file is bundled.

Multi-Model Pattern

Model Purpose
Base Common fields shared across models
Create Request body for creation (required fields)
Update Request body for updates (all optional)
Response API response with all fields
InDB Database document with doc_type

camelCase Aliases

class MyModel(BaseModel):
    workspace_id: str = Field(..., alias="workspaceId")
    created_at: datetime = Field(..., alias="createdAt")
    
    class Config:
        populate_by_name = True  # Accept both snake_case and camelCase

Optional Update Fields

class MyUpdate(BaseModel):
    """All fields optional for PATCH requests."""
    name: Optional[str] = Field(None, min_length=1)
    description: Optional[str] = None

Database Document

class MyInDB(MyResponse):
    """Adds doc_type for Cosmos DB queries."""
    doc_type: str = "my_resource"

Integration Steps

  1. Create models in src/backend/app/models/
  2. Export from src/backend/app/models/__init__.py
  3. Add corresponding TypeScript types

When to Use

This skill is applicable to execute the workflow or actions described in the overview.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
FAQ

What is Pydantic?

Pydantic is a Python library that helps validate and organize data using type annotations.

What is the 'Multi-Model Pattern'?

It's a way to organize your data models for different purposes, such as creation, updates, or responses, ensuring clarity and consistency.

What are 'camelCase Aliases' for?

They allow your models to accept field names in both 'snake_case' (like `workspace_id`) and 'camelCase' (like `workspaceId`) formats, making integration more flexible.

Details

Original description by the author

Create Pydantic models following the multi-model pattern for clean API contracts.

repo: sickn33/agentic-awesome-skills

Popularity

GitHub stars
48k
Ranking position
#3928
License
MIT
Updated
10/15/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills