์Šคํ‚ฌ python-fastapi-patterns
๐Ÿ

python-fastapi-patterns

๋‚ฎ์€ ์œ„ํ—˜ โšก ์Šคํฌ๋ฆฝํŠธ ํฌํ•จ๐Ÿ”‘ ํ™˜๊ฒฝ ๋ณ€์ˆ˜

Build REST APIs with FastAPI patterns

๋˜ํ•œ ๋‹ค์Œ์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค: 0xDarkMatter

FastAPI is a modern Python web framework for building APIs. This skill provides ready-to-use patterns for dependency injection, validation, middleware, and background tasks. Developers can quickly implement production-ready APIs without searching through documentation.

์ง€์›: Claude Codex Code(CC)
๐Ÿฅ‰ 76 ๋ธŒ๋ก ์ฆˆ
1

์Šคํ‚ฌ ZIP ๋‹ค์šด๋กœ๋“œ

2

Claude์—์„œ ์—…๋กœ๋“œ

์„ค์ • โ†’ ๊ธฐ๋Šฅ โ†’ ์Šคํ‚ฌ โ†’ ์Šคํ‚ฌ ์—…๋กœ๋“œ๋กœ ์ด๋™

3

ํ† ๊ธ€์„ ์ผœ๊ณ  ์‚ฌ์šฉ ์‹œ์ž‘

ํ…Œ์ŠคํŠธํ•ด ๋ณด๊ธฐ

"python-fastapi-patterns" ์‚ฌ์šฉ ์ค‘์ž…๋‹ˆ๋‹ค. Create a FastAPI endpoint that creates a user with email validation

์˜ˆ์ƒ ๊ฒฐ๊ณผ:

  • from pydantic import BaseModel, EmailStr, Field
  • from fastapi import FastAPI, HTTPException, status
  • from datetime import datetime
  • ย 
  • class UserCreate(BaseModel):
  • name: str = Field(..., min_length=1, max_length=100)
  • email: EmailStr
  • age: int = Field(..., ge=18, le=120)
  • ย 
  • class UserResponse(BaseModel):
  • id: int
  • name: str
  • email: EmailStr
  • created_at: datetime
  • model_config = {"from_attributes": True}
  • ย 
  • @app.post("/users", response_model=UserResponse, status_code=status.HTTP_201_CREATED)
  • async def create_user(user: UserCreate):
  • # Create user in database
  • db_user = await create_user_in_db(user)
  • return db_user

๋ณด์•ˆ ๊ฐ์‚ฌ

๋‚ฎ์€ ์œ„ํ—˜
v3 โ€ข 1/10/2026

This is a documentation and code generation skill containing educational FastAPI patterns. The included bash script generates boilerplate code without executing dangerous operations. No network calls, credential theft, or malicious behavior detected.

7
์Šค์บ”๋œ ํŒŒ์ผ
1,047
๋ถ„์„๋œ ์ค„ ์ˆ˜
4
๋ฐœ๊ฒฌ ์‚ฌํ•ญ
3
์ด ๊ฐ์‚ฌ ์ˆ˜
๋‚ฎ์€ ์œ„ํ—˜ ๋ฌธ์ œ (2)
Bash script for code generation
The skill contains a bash script (scripts/scaffold-api.sh) that generates FastAPI boilerplate code. The script uses standard bash string manipulation and cat heredoc to output code templates. It takes a single resource name argument and performs case conversions. No dangerous operations: no file writes outside stdout, no network calls, no credential access.
Environment variable configuration
The fastapi-template.py reads environment variables using pydantic-settings (standard practice). This is legitimate configuration management and does not access sensitive credentials beyond what the developer explicitly provides in their .env file.

์œ„ํ—˜ ์š”์ธ

โšก ์Šคํฌ๋ฆฝํŠธ ํฌํ•จ (1)
๐Ÿ”‘ ํ™˜๊ฒฝ ๋ณ€์ˆ˜ (1)

ํ’ˆ์งˆ ์ ์ˆ˜

82
์•„ํ‚คํ…์ฒ˜
100
์œ ์ง€๋ณด์ˆ˜์„ฑ
81
์ฝ˜ํ…์ธ 
30
์ปค๋ฎค๋‹ˆํ‹ฐ
86
๋ณด์•ˆ
70
์‚ฌ์–‘ ์ค€์ˆ˜

๋งŒ๋“ค ์ˆ˜ ์žˆ๋Š” ๊ฒƒ

Build REST APIs

Create production-ready REST APIs with FastAPI using proven patterns for routing, validation, and error handling

API scaffolding

Generate CRUD endpoint boilerplate quickly for new resources using the included scaffold script

Learn FastAPI patterns

Understand dependency injection, middleware chains, and async patterns through clear code examples

์ด ํ”„๋กฌํ”„ํŠธ๋ฅผ ์‚ฌ์šฉํ•ด ๋ณด์„ธ์š”

Basic API setup
Create a FastAPI application with lifespan management for database and cache startup and shutdown
Pydantic models
Create a Pydantic model for user registration with email validation, password strength, and confirm password matching
Dependency injection
Set up dependency injection for an async database session and a JWT-authenticated current user
Middleware chain
Add middleware for request logging, security headers, and rate limiting to a FastAPI app

๋ชจ๋ฒ” ์‚ฌ๋ก€

  • Use Pydantic models for all request validation and response serialization
  • Implement dependency injection for shared resources like databases and caches
  • Add middleware early in the stack for CORS and security headers

ํ”ผํ•˜๊ธฐ

  • Do not use bare Exception handlers that expose internal errors
  • Avoid hardcoding credentials or API keys in source code
  • Do not skip validation by using arbitrary JSON response types

์ž์ฃผ ๋ฌป๋Š” ์งˆ๋ฌธ

What Python version is required?
FastAPI 0.100+ requires Python 3.10 or higher with Pydantic v2 support
Does this skill handle database connections?
Patterns show async database session setup via dependency injection but require your own ORM integration
Can I use this with SQLAlchemy?
Yes. The dependency injection patterns work with any async database library including SQLAlchemy async
Is the data I process secure?
This skill only provides patterns. All data processing happens in your application code with full control
How do I debug validation errors?
Use RequestValidationError exception handler to format validation error details with field locations
How is this different from Flask or Django?
FastAPI provides automatic OpenAPI docs, native async support, and type validation without Flask's request parsing

๊ฐœ๋ฐœ์ž ์„ธ๋ถ€ ์ •๋ณด

์ž‘์„ฑ์ž

0xDarkMatter

๋ผ์ด์„ ์Šค

MIT

์ฐธ์กฐ

main

ํŒŒ์ผ ๊ตฌ์กฐ

๐Ÿ“ assets/

๐Ÿ“„ fastapi-template.py

๐Ÿ“ references/

๐Ÿ“„ background-tasks.md

๐Ÿ“„ dependency-injection.md

๐Ÿ“„ middleware-patterns.md

๐Ÿ“„ validation-serialization.md

๐Ÿ“ scripts/

๐Ÿ“„ scaffold-api.sh

๐Ÿ“„ SKILL.md