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

pydantic-models-py

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.

Skill link

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

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

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.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

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.”

5 new skills a week. 1 minute to read.

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.

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
#5542
License
MIT
Updated
10/15/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills