pydantic-models-py
Create consistent Pydantic models using Base, Create, Update, and Response variants. Ideal for robust Python API development.
Install
mkdir -p .claude/skills/pydantic-models-py && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/1234" && unzip -o skill.zip -d .claude/skills/pydantic-models-py && rm skill.zipInstalls to .claude/skills/pydantic-models-py
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Create Pydantic models following the multi-model pattern with Base, Create, Update, Response, and InDB variants. Use when defining API request/response schemas, database models, or data validation in Python applications using Pydantic v2.Key capabilities
- →Define Base, Create, Update, Response, and InDB models
- →Implement camelCase aliases
- →Configure optional fields for PATCH requests
- →Add database document types
How it works
It applies a multi-model pattern to generate specialized variants of data models for different API and database layers.
Inputs & outputs
When to use pydantic-models-py
- →Define consistent API request schemas
- →Generate database model variants
- →Validate incoming data with Pydantic v2
About this skill
Pydantic Models
Create Pydantic models following the multi-model pattern for clean API contracts.
Quick Start
Copy the template from assets/template.py and replace placeholders:
{{ResourceName}}→ PascalCase name (e.g.,Project){{resource_name}}→ snake_case name (e.g.,project)
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
from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field
class MyModel(BaseModel):
model_config = ConfigDict(populate_by_name=True)
workspace_id: str = Field(..., alias="workspaceId")
created_at: datetime = Field(..., alias="createdAt")
Optional Update Fields
class MyUpdate(BaseModel):
model_config = ConfigDict(populate_by_name=True)
name: Optional[str] = Field(None, min_length=1)
description: Optional[str] = None
Database Document
class MyInDB(MyResponse):
doc_type: str = "my_resource"
Integration Steps
- Create models in
src/backend/app/models/ - Export from
src/backend/app/models/__init__.py - Add corresponding TypeScript types
Reference Files
| File | Contents |
|---|---|
| references/capabilities.md | Additional non-hero capabilities, operation-group coverage, and production checklists. |
When not to use it
- →When working with non-Pydantic validation frameworks
Limitations
- →Requires adherence to the multi-model pattern
How it compares
It enforces a consistent multi-model structure that separates concerns between request, response, and database storage.
Compared to similar skills
pydantic-models-py side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| pydantic-models-py (this skill) | 3 | 29d | No flags | Intermediate |
| fastapi-templates | 520 | 2mo | No flags | Intermediate |
| fastapi-pro | 79 | 4mo | No flags | Advanced |
| fastapi-router-py | 5 | 29d | No flags | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by microsoft
View all by microsoft →You might also like
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
fastapi-pro
sickn33
Build high-performance async APIs with FastAPI, SQLAlchemy 2.0, and Pydantic V2. Master microservices, WebSockets, and modern Python async patterns. Use PROACTIVELY for FastAPI development, async optimization, or API architecture.
fastapi-router-py
microsoft
Create FastAPI routers with CRUD operations, authentication dependencies, and proper response models. Use when building REST API endpoints, creating new routes, implementing CRUD operations, or adding authenticated endpoints in FastAPI applications.
backend-architect
sickn33
Expert backend architect specializing in scalable API design, microservices architecture, and distributed systems. Masters REST/GraphQL/gRPC APIs, event-driven architectures, service mesh patterns, and modern backend frameworks. Handles service boundary definition, inter-service communication, resilience patterns, and observability. Use PROACTIVELY when creating new backend services or APIs.
supabase-python
alinaqi
FastAPI with Supabase and SQLAlchemy/SQLModel
fastapi
kid-sid
Use when structuring a FastAPI application, designing dependency injection chains, defining Pydantic v2 schemas, adding JWT authentication, or writing async route tests with httpx.