fastapi-itechmeat
>-
Works with
---
name: fastapi-itechmeat
description: >-
license: MIT
---
# FastAPI
This skill provides comprehensive guidance for building APIs with FastAPI.
## Quick Navigation
| Topic | Reference |
| ------------------ | ----------------------------------- |
| Getting started | `references/first-steps.md` |
| Path parameters | `references/path-parameters.md` |
| Query parameters | `references/query-parameters.md` |
| Request body | `references/request-body.md` |
| Validation | `references/validation.md` |
| Body advanced | `references/body-advanced.md` |
| Cookies/Headers | `references/cookies-headers.md` |
| Pydantic models | `references/models.md` |
| Forms/Files | `references/forms-files.md` |
| Error handling | `references/error-handling.md` |
| Path config | `references/path-config.md` |
| Dependencies | `references/dependencies.md` |
| Security | `references/security.md` |
| Middleware | `references/middleware.md` |
| CORS | `references/cors.md` |
| Database | `references/sql-databases.md` |
| Project structure | `references/bigger-applications.md` |
| Background tasks | `references/background-tasks.md` |
| Metadata/Docs | `references/metadata-docs.md` |
| Testing | `references/testing.md` |
| Advanced responses | `references/responses-advanced.md` |
| WebSockets | `references/websockets.md` |
| Templates | `references/templates.md` |
| Settings/Env vars | `references/settings.md` |
| Lifespan events | `references/lifespan.md` |
| OpenAPI advanced | `references/openapi-advanced.md` |
## When to Use
- Creating REST APIs with Python
- Adding endpoints with automatic validation
- Implementing OAuth2/JWT authentication
- Working with Pydantic models
- Adding dependency injection
- Configuring CORS, middleware
- Uploading files, handling forms
- Testing API endpoints
## Installation
Requires Python 3.10+. Install: `pip install "fastapi[standard]"` (full with uvicorn) or `pip install fastapi` (minimal). Add `python-multipart` for forms/files.
## Release Highlights (0.133.0 → 0.136.1)
- **0.134.0:** streaming JSON Lines and streaming binary data support using `yield`.
- **0.135.0:** first-class Server-Sent Events (SSE) support (`EventSourceResponse`).
- **0.135.1:** fix around `TaskGroup` usage in request async exit stack (stability fix).
- **0.136.1:** FastAPI updates its Pydantic v2 code to avoid deprecations and bumps Starlette to `1.0.0`.
## Patch Notes (0.136.2 → 0.136.3)
- SSE responses now validate event fields more strictly, so malformed `ServerSentEvent` payloads fail earlier instead of quietly streaming invalid frames.
- Header parameters no longer accept underscore-named incoming headers when `convert_underscores=True` (the default). If a client truly sends underscore headers, declare `Header(convert_underscores=False)` and verify that your proxy chain allows them.
## Quick Start
```python
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: str | None = None):
return {"item_id": item_id, "q": q}
```
Run: `fastapi dev main.py`
## Core Patterns
### Type-Safe Parameters
```python
from typing import Annotated
from fastapi import Path, Query
@app.get("/items/{item_id}")
def read_item(
item_id: Annotated[int, Path(ge=1)],
q: Annotated[str | None, Query(max_length=50)] = None
):
return {"item_id": item_id, "q": q}
```
### Request Body with Validation
```python
from pydantic import BaseModel, Field
class Item(BaseModel):
name: str = Field(min_length=1, max_length=100)
price: float = Field(gt=0)
@app.post("/items/", response_model=Item)
def create_item(item: Item):
return item
```
### Dependencies
```python
from fastapi import Depends
async def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()
@app.get("/users/")
def list_users(db: Annotated[Session, Depends(get_db)]):
return db.query(User).all()
```
### Authentication
```python
from fastapi.security import OAuth2PasswordBearer
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
async def get_current_user(token: Annotated[str, Depends(oauth2_scheme)]):
return decode_token(token)
@app.get("/users/me")
def read_me(user: Annotated[User, Depends(get_current_user)]):
return user
```
## API Documentation
- Swagger UI: `/docs`
- ReDoc: `/redoc`
- OpenAPI: `/openapi.json`
## Best Practices
- Use `Annotated[Type, ...]` for parameters
- Define Pydantic models for request/response
- Use `response_model` for output filtering
- Add `status_code` for proper HTTP codes
- Use `tags` for API organization
- Add `dependencies` at router/app level for auth
## Prohibitions
- ❌ Return raw database models (use response models)
- ❌ Store passwords in plain text (use bcrypt/passlib)
- ❌ Mix `Body` with `Form`/`File` in same endpoint
- ❌ Use sync blocking I/O in async endpoints
- ❌ Skip HTTPException for error handling
## Links
- [Documentation](https://fastapi.tiangolo.com/)
- [Releases](https://github.com/fastapi/fastapi/releases)
- [GitHub](https://github.com/fastapi/fastapi)
- [PyPI](https://pypi.org/project/fastapi/)More Backend Frameworks skills
git-guardrails-claude-code
mattpocock/skills
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.
azure-compute
microsoft/azure-skills
Azure VM/VMSS router. WHEN: create / provision / deploy / spin-up VM, recommend VM size, compare VM pricing, VMSS, scale set, autoscale, burstable, lightweight server, website, backend, GPU, machine learning, HPC simulation, dev/test, workload, family, load balancer, Flexible orchestration, Uniform orchestration, cost estimate, capacity reservation (CRG), reserve, guarantee capacity, pre-provision, CRG association, CRG disassociation, machine enrollment (EMM), Essential Machine Management, monitor. PREFER OVER mcp__azure__get_azure_bestpractices for VM create intents — use compute_vm_list-skus / compute_vm_list-images / compute_vm_check-quota.
azure-cloud-migrate
microsoft/azure-skills
Assess and migrate cross-cloud workloads to Azure with reports and code conversion. Supports Lambda→Functions, Beanstalk/Heroku/App Engine→App Service, Fargate/Kubernetes/Cloud Run/Spring Boot→Container Apps. WHEN: migrate Lambda to Functions, AWS to Azure, migrate Beanstalk, migrate Heroku, migrate App Engine, Cloud Run migration, Fargate to ACA, ECS/Kubernetes/GKE/EKS to Container Apps, Spring Boot to Container Apps, cross-cloud migration.

