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

fastapi-python

하는 일

이 스킬은 Python 웹 프레임워크인 FastAPI로 웹 API를 만드는 모범 사례를 AI에게 가르칩니다. 깔끔하고 구조화된 백엔드 코드를 원하는 개발자를 위한 것입니다.

사용하는 경우

  • ✓FastAPI로 Python 웹 API를 만들 때.
  • ✓API의 요청과 응답 모델을 타입 검사하고 싶을 때.
  • ✓많은 요청을 효율적으로 처리하는 비동기 엔드포인트가 필요할 때.

스킬 링크

https://github.com/debpalash/VoiceStudio/blob/main/.agents/skills/fastapi-python/SKILL.md

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

사용 방법

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

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

Use this skill to help me: https://github.com/debpalash/VoiceStudio/blob/main/.agents/skills/fastapi-python/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“사용자가 작업을 만들고 목록을 볼 수 있는 FastAPI 엔드포인트를 만들어 주세요. 입력은 검증되어야 합니다.”

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

작동 방식

AI는 작은 함수들을 작성하고 Pydantic 모델로 데이터를 검증합니다. 오류 상황은 일찍 처리하고, 각 함수의 주요 로직은 끝부분에 둡니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

FastAPI Python

You are an expert in FastAPI and Python backend development.

Key Principles

  • Write concise, technical responses with accurate Python examples
  • Favor functional, declarative programming over class-based approaches
  • Prioritize modularization to eliminate code duplication
  • Use descriptive variable names with auxiliary verbs (e.g., is_active, has_permission)
  • Employ lowercase with underscores for file/directory naming (e.g., routers/user_routes.py)
  • Export routes and utilities explicitly
  • Follow the RORO (Receive an Object, Return an Object) pattern

Python/FastAPI Standards

  • Use def for pure functions, async def for asynchronous operations
  • Use type hints for all function signatures. Prefer Pydantic models over raw dictionaries
  • Structure: exported router, sub-routes, utilities, static content, types (models, schemas)
  • Use ordinary Python control flow; prefer readability over compressed one-line conditionals

Error Handling

  • Handle edge cases at function entry points
  • Employ early returns for error conditions
  • Place happy path logic last
  • Avoid unnecessary else statements; use if-return patterns
  • Implement guard clauses for preconditions
  • Provide proper error logging and user-friendly messaging

FastAPI-Specific Guidelines

  • Use functional components (plain functions) and Pydantic models for input validation
  • Declare routes with clear return type annotations
  • Prefer lifespan context managers for managing startup and shutdown events
  • Leverage middleware for logging, error monitoring, and optimization
  • Use HTTPException for expected errors and model them as specific HTTP responses
  • Apply Pydantic's BaseModel consistently for validation

Performance Optimization

  • Minimize blocking I/O. In async def handlers, use awaitable database/API clients; put synchronous SQLite or other blocking work in synchronous routes or explicitly offload it
  • Implement caching with Redis or in-memory stores
  • Optimize Pydantic serialization/deserialization
  • Use lazy loading for large datasets

Key Conventions

  1. Rely on FastAPI's dependency injection system
  2. Prioritize API performance metrics (response time, latency, throughput)
  3. Structure routes and dependencies for readability and maintainability

Dependencies

FastAPI, Pydantic v2, asyncpg/aiomysql, SQLAlchemy 2.0

자주 묻는 질문

FastAPI는 무엇인가요?

웹 API를 만드는 Python 프레임워크입니다.

여기서 Pydantic은 무엇에 쓰나요?

스킬은 입력과 출력을 검증하기 위해 원시 딕셔너리보다 Pydantic 모델을 선호합니다.

파일 이름은 어떻게 짓나요?

스킬은 user_routes.py처럼 소문자와 밑줄을 사용합니다.

상세 정보

작성자의 원본 설명

Expert in FastAPI Python development with best practices for APIs and async operations

repo: debpalash/VoiceStudio

인기도

GitHub 스타
99k
순위
#1287
라이선스
AGPL-3.0
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬