fastapi-patterns
Skill2 starsChanged 54 days agoMITView on GitHub
FastAPI patterns, Pydantic schemas, dependency injection, async correctness, response models, error handling, OpenAPI, and auth. Use whenever the project contains `fastapi` in dependencies, files importing from `fastapi`, `@app.get`/`@router.get` decorators, Pydantic BaseModel subclasses used as request/response types, OR the user asks about FastAPI, Pydantic v2, Depends(), HTTPException, OAuth2PasswordBearer, APIKeyHeader, response_model, even if FastAPI is not mentioned by name.
- Installs packages
11 other projects use a version of this.
Adopted by
Most recently taken up by
- imMamdouhaboammar/tiktok-growth-automation-meshtheir own version, first seen Oct 1, 2026
- productionx-in/Core-Skillstheir own version, first seen Sep 29, 2026
- templetongroup/radianttheir own version, first seen Sep 17, 2026
- bjornjee/skillstheir own version, first seen Sep 8, 2026
- SamuelNDCE/claude-super-skill-librarytheir own version, first seen Aug 1, 2026
- JunMystery/Agent-Guidance-Pythontheir own version, first seen Jul 21, 2026
Used with
Projects with it also use golang-patterns and verification-loop.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
FaisalAlqarniSkillgolang-patterns
Idiomatic Go patterns, best practices, and conventions for building robust, efficient, and maintainable Go applications.
Also in 3 projects that use this
WorldFlowAISkillverification-loop
Also in 3 projects that use this
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- templetongroup/radiant★ 113same name
- 4444J99/a-i--skills★ 17same name
- hieutrtr/ai1-skills★ 8same name
- peopleforrester/claude-dotfiles★ 3same name
- aragaobruno/monster-antigravity★ 2same name
- bjornjee/skills★ 2same name
- JunMystery/Agent-Guidance-Python★ 2same name
- productionx-in/Core-Skills★ 1same name
- SamuelNDCE/claude-super-skill-library★ 1same name
- imMamdouhaboammar/tiktok-growth-automation-mesh★ 0same name
1 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository34 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- templates/CLAUDE.mdCLAUDE.md
- auditSkill
- backup-patternsSkill
- bash-patternsSkill
- depsSkill
- django-patternsSkill
- docker-patternsSkill
- drf-patternsSkill
- engineering-fundamentalsSkill
- git-patternsSkill
- go-patternsSkill
- graphql-patternsSkill
- investigateSkill
- javascript-patternsSkill
- logging-patternsSkill
- referenceSkill
- metaSkill
- monitoring-patternsSkill
- next-app-router-patternsSkill
- nuxt-patternsSkill
- opentofu-patternsSkill
- python-patternsSkill
- react-patternsSkill
- report-formatSkill
- security-patternsSkill
- storybook-patternsSkill
- tailwind-patternsSkill
- test-patternsSkill
- typescript-patternsSkill
- vps-provisioningSkill
- vue-patternsSkill
- wcag-auditSkill
- writeSkill
The file
Files
FastAPI patterns
FastAPI 0.141.x, Pydantic 2.13.x (baseline at time of writing). Verify current versions at https://pypi.org/project/fastapi/ and https://pypi.org/project/pydantic/. Adapt advice to the versions in the project's requirements.txt, pyproject.toml, or lockfile.
Install: pip install "fastapi[standard]"
Reference files
| File | Covers |
| pydantic-schemas.md | BaseModel, Field(), field_validator, model_validator, model_config, ConfigDict, separate input/output schemas |
| dependency-injection.md | Depends(), Annotated pattern, yield dependencies, testing overrides |
| async-correctness.md | async def vs def, threadpool behavior, blocking I/O rules |
| response-models.md | response_model, response_model_exclude_unset, separate schemas |
| error-handling.md | HTTPException, custom exception handlers, status codes |
| openapi.md | Metadata, tags, disabling docs in production, route decorator params |
| auth.md | OAuth2PasswordBearer, JWT, APIKeyHeader, HTTPBasic, timing attacks |
| anti-patterns.md | Severity-labeled anti-patterns to flag in review |
References
- https://fastapi.tiangolo.com/
- https://pydantic.dev/docs/validation/latest/
- https://fastapi.tiangolo.com/tutorial/security/
- https://fastapi.tiangolo.com/async/
Version notes
Checked: 2026-09-26 against https://pypi.org/project/fastapi/ and https://fastapi.tiangolo.com/release-notes/
- 0.141.1 (2026-07-29) with Pydantic 2.13.5 (2026-08-28): no guidance change. FastAPI stays on 0.x by design; there is no 1.x and no Pydantic 3.
- 0.128.0: Pydantic v1 compatibility (
pydantic.v1models) removed; unsupported on Python 3.14+. - 0.95.0:
Annotatedform forDepends()became the recommended shape.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

