/major-ai-skills:fastapifrom major-ai-skills
Build production FastAPI services with Pydantic v2 models, async-safe I/O, dependency injection, OpenAPI, webhook raw-body routes, and structured errors. Use for JSON APIs, Stripe webhooks, and TestClient/httpx testing.
Ships in major-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
FastAPI builds HTTP APIs on Starlette with Pydantic validation and automatic OpenAPI. Dependencies inject auth, DB sessions, and settings. Async routes must not block the event loop with sync ORM/socket calls without run_in_threadpool.
Claude operates as a Principal API Engineer: typed I/O, webhook raw bodies, idempotent event processing, and consistent error envelopes.
uvicorn / gunicorn workers
│
FastAPI app
├── APIRouter (domain modules)
├── Depends() graph
├── Pydantic request/response models
└── /docs OpenAPI
Use when
Do not use when
BackgroundTasks alone.dict responses.APIRouter per domain with shared exception handlers.pydantic-settings cached dependency—never hardcode secrets.event_id; return 200 on duplicate; 500 on handler failure so providers retry.* with credentials.from fastapi import Depends, FastAPI, HTTPException, Request
from pydantic import BaseModel, Field
app = FastAPI(title="Inventory API", version="1.2.0")
class ItemIn(BaseModel):
sku: str = Field(min_length=1, max_length=64)
qty: int = Field(ge=0)
class ItemOut(ItemIn):
id: int
def get_current_user(authorization: str | None = None) -> str:
if not authorization:
raise HTTPException(status_code=401, detail="unauthorized")
return "user"
@app.post("/items", response_model=ItemOut, status_code=201)
async def create_item(body: ItemIn, user: str = Depends(get_current_user)) -> ItemOut:
return ItemOut(id=1, **body.model_dump())
Stripe webhook (raw body):
@app.post("/webhooks/stripe")
async def stripe_webhook(request: Request):
payload = await request.body()
sig = request.headers.get("stripe-signature", "")
event = stripe.Webhook.construct_event(payload, sig, settings.stripe_webhook_secret)
# idempotency gate on event.id
| Issue | Root cause | Fix |
|---|---|---|
| Signature verify fails | Body parsed/re-serialized | Use raw request.body() |
| Event loop blocked | Sync DB in async def | Threadpool or sync route |
| 422 on valid JSON | Pydantic v2 strict extras | Align models; model_config |
| OpenAPI drift | Missing response_model | Declare response types |
| Duplicate fulfillment | No idempotency store | UNIQUE event_id + txn |
@app.exception_handler for domain errors./v1).request_id middleware.TestClient or httpx ASGI transport for integration tests.BackgroundTasks ≠ durable queue (use Celery, ARQ, Temporal).@stripe — payment events and idempotency@postgresql — transactional fulfillment@docker — multi-worker uvicorn/gunicorn@nodejs — compare Express webhook raw body patternsMANDATORY: Verify webhook signatures on untouched raw bytes. Persist provider event IDs before side effects. Never block async routes with sync DB without an explicit threadpool strategy. Load secrets from environment only.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub alivirgo/major-ai-skills --plugin major-ai-skills412 skills in this plugin
/3d-slicerAutomate 3D Slicer research workflows with MRML, VTK/ITK, DICOM data, and Segment Editor. Use for software workflows, not clinical interpretation./abbreviated-git-statusInspect Git branch, staging, and working-tree changes with short or porcelain status output when a compact repository check is needed./ableton-liveAutomate Ableton Live sessions with Python MIDI Remote Scripts, Max for Live, AbletonOSC, and Link synchronization./act-as-a-personal-tutorExplain a subject step by step, assess prior knowledge, and use short exercises to check understanding before advancing.Other plugins' skills for the same job