pydantic-models-py – skill Lập trình cho agent AI
Tạo model Pydantic theo mẫu multi-model để có hợp đồng API rõ ràng.
Cài skill pydantic-models-py bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/pydantic-models-py-86925.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /pydantic-models-py – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/pydantic-models-py-86925.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $pydantic-models-py – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/pydantic-models-py-86925.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /pydantic-models-py – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/pydantic-models-py-86925.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /pydantic-models-py – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
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 camelCaseOptional Update Fields
class MyUpdate(BaseModel):
"""All fields optional for PATCH requests."""
name: Optional[str] = Field(None, min_length=1)
description: Optional[str] = NoneDatabase 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.
Skill liên quan
- pypict-skill – Tạo test theo cặp (pairwise).
- pytest-skill – Tạo test pytest chuẩn production bằng Python, với fixtures, parametrize, markers…
- python – Hướng dẫn super-code theo ngôn ngữ cho Python.
- python-development – Bạn là chuyên gia kiến trúc dự án Python, chuyên khởi tạo ứng dụng Python sẵn sàng…
- python-development-python-scaffold – Bạn là chuyên gia kiến trúc dự án Python, chuyên khởi tạo ứng dụng Python sẵn sàng…
- python-fastapi-development – Phát triển backend Python FastAPI với mẫu async, SQLAlchemy, Pydantic, xác thực và các…
- python-packaging – Hướng dẫn toàn diện cách tạo, cấu trúc và phân phối package Python bằng công cụ đóng gói…
- python-patterns – Nguyên tắc phát triển Python và cách ra quyết định. Chọn framework, mẫu async, type…