본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)48k · #5542

pydantic-models-py

하는 일

이 도구는 컴퓨터 프로그램에서 쓸 체계적인 데이터 구조를 만드는 데 도움을 줍니다. 특히 시스템의 여러 부분(API 같은)이 서로 통신할 때 유용합니다. '멀티 모델 패턴'이라는 방식을 사용해 데이터가 어떤 모습이어야 하는지 정의합니다.

사용하는 경우

  • ✓새로운 항목을 만들기 위해 전송되는 데이터를 정의할 때.
  • ✓기존 항목을 수정하기 위해 전송되는 데이터를 정의할 때.
  • ✓응답으로 반환되는 데이터를 정의할 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

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.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이름, 이메일, 생성일 필드가 있는 사용자의 Pydantic 모델을 멀티 모델 패턴에 따라 만들어 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 도구는 Pydantic 라이브러리를 사용해 데이터를 정리하는 '모델'을 정의합니다. 모델은 데이터의 설계도 같은 것입니다. 공통 데이터에는 기본 모델을, 생성, 수정, 응답에는 전용 모델을 사용하도록 제안합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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.
자주 묻는 질문

Pydantic이란 무엇인가요?

타입 주석을 사용해 데이터를 검증하고 정리하도록 돕는 Python 라이브러리입니다.

'멀티 모델 패턴'이란 무엇인가요?

생성, 수정, 응답처럼 목적별로 데이터 모델을 나누어 정리하는 방식입니다. 명확성과 일관성을 높입니다.

'camelCase 별칭'은 무엇에 쓰나요?

모델이 필드 이름을 'snake_case'(예: `workspace_id`)와 'camelCase'(예: `workspaceId`) 두 형식 모두로 받을 수 있게 해 줍니다. 연동을 더 유연하게 만듭니다.

상세 정보

작성자의 원본 설명

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

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#5542
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬