fastapi-patterns
FastAPI patterns for async APIs, dependency injection, Pydantic request and response models, OpenAPI docs, tests, security, and production readiness.
npx skills add mturac/everything-openai-codex --skill fastapi-patterns --agent codex
Same command for any agent — swap --agent for claude-code, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# FastAPI Patterns Production-oriented patterns for FastAPI services. ## When to Use - Building or reviewing a FastAPI app. - Splitting routers, schemas, dependencies, and database access. - Writing async endpoints that call a database or external service. - Adding authentication, authorization, OpenAPI docs, tests, or deployment settings. - Checking a FastAPI PR for copy-pasteable examples and production risks. ## How It Works Treat the FastAPI app as a thin HTTP layer over explicit dependencies and service code: - `main.py` owns app construction, middleware, exception handlers, and router registration. - `schemas/` owns Pydantic request and response models. - `dependencies.py` owns database, auth, pagination, and request-scoped dependencies. - `services/` or `crud/` owns business and persistence operations. - `tests/` overrides dependencies instead of opening production resources. Prefer small routers and explicit `response_model` declarations. Keep raw ORM objects, secrets, and framework globals out of response schemas. ## Project Layout ```text app/ |-- main.py |-- config.py |-- dependencies.py |-- exceptions.py |-- api/ | `-- routes/ | |-- users.py | `-- health.py |-- core/ |
- When to Use
- How It Works
- Project Layout
- Application Factory
- Pydantic Schemas
- Dependencies
- Async Endpoints
- Error Handling
- OpenAPI Customization
- Testing
- Security Checklist
- Performance Checklist
- Examples
- See Also
What does the fastapi-patterns skill do?
FastAPI patterns for async APIs, dependency injection, Pydantic request and response models, OpenAPI docs, tests, security, and production readiness.
How do I install it?
Run `npx skills add mturac/everything-openai-codex --skill fastapi-patterns --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From mturac/everything-openai-codex, a repository with 84 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
