pydantic-models-py
Build Pydantic Models with Multi-Model Pattern
Define consistent API schemas without manual boilerplate. This skill generates structured Pydantic models following established patterns for request validation, responses, and database integration.
์คํฌ ZIP ๋ค์ด๋ก๋
Claude์์ ์ ๋ก๋
์ค์ โ ๊ธฐ๋ฅ โ ์คํฌ โ ์คํฌ ์ ๋ก๋๋ก ์ด๋
ํ ๊ธ์ ์ผ๊ณ ์ฌ์ฉ ์์
ํ ์คํธํด ๋ณด๊ธฐ
"pydantic-models-py" ์ฌ์ฉ ์ค์ ๋๋ค. User entity with id, name, email, created_at fields
์์ ๊ฒฐ๊ณผ:
Generated UserBase, UserCreate, UserUpdate, UserResponse, and UserInDB model classes with proper Field definitions, type annotations, and Config class for alias handling
"pydantic-models-py" ์ฌ์ฉ ์ค์ ๋๋ค. Project model requiring camelCase API compatibility
์์ ๊ฒฐ๊ณผ:
Models with Field aliases (workspaceId, createdAt) that accept both naming conventions while using Pythonic snake_case internally
๋ณด์ ๊ฐ์ฌ
์์ All 21 static analysis findings are false positives. The scanner misidentified Markdown code block backticks as shell execution, and documentation references to HTTP/cryptography as actual code. SKILL.md is pure documentation with Python code examples for Pydantic model patterns. No executable code, network calls, or security risks detected.
ํ์ง ์ ์
๋ง๋ค ์ ์๋ ๊ฒ
REST API Schema Definition
Define request/response models for FastAPI or Flask endpoints with consistent validation patterns.
Database Document Modeling
Create InDB model variants with doc_type fields for Cosmos DB or MongoDB document storage.
Frontend-Backend Contract Sync
Generate matching Python models and TypeScript types to ensure API contract consistency.
์ด ํ๋กฌํํธ๋ฅผ ์ฌ์ฉํด ๋ณด์ธ์
Create Pydantic models for a User entity with fields: id (string), name (string, required), email (string with email validation), created_at (datetime). Use the multi-model pattern with Base, Create, Update, and Response variants.
Generate Pydantic models for a Project entity. All fields should accept both snake_case and camelCase using Field aliases. Include workspace_id, project_name, and is_active fields.
Create complete Pydantic models for a Document entity including InDB variant with doc_type field. Add min_length validation on name and optional description field for updates.
Build Pydantic models for an Order entity with nested line_items array. Each line item has product_id, quantity, and price. Create full multi-model pattern with validation constraints on all fields.
๋ชจ๋ฒ ์ฌ๋ก
- Always separate Create and Update models - Create requires all fields, Update makes all fields optional for PATCH semantics
- Use Field with explicit default=None for optional update fields to distinguish between null and unset values
- Enable populate_by_name = True in Config class to accept both snake_case and camelCase from API clients
ํผํ๊ธฐ
- Do not reuse the same model class for both request bodies and database documents - separation prevents data leakage
- Avoid putting business logic in model classes - keep them as pure data schemas with validation only
- Do not omit doc_type in InDB models when using Cosmos DB - queries will fail without proper type filtering
์์ฃผ ๋ฌป๋ ์ง๋ฌธ
What is the multi-model pattern and why use it?
How do camelCase aliases work with Pydantic?
Why make all Update fields optional?
What is the doc_type field for?
Do I need to create TypeScript types manually?
Can I use this pattern with SQLAlchemy or other ORMs?
๊ฐ๋ฐ์ ์ธ๋ถ ์ ๋ณด
์์ฑ์
sickn33๋ผ์ด์ ์ค
MIT
๋ฆฌํฌ์งํ ๋ฆฌ
https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/pydantic-models-py์ฐธ์กฐ
main
ํ์ผ ๊ตฌ์กฐ
๐ SKILL.md