fastapi
Skill2 starsChanged 5 months agoMITView on GitHub
Use when project is FastAPI (Python async web framework). Covers Pydantic v2 models, dependency injection via Depends, async SQLAlchemy 2.x, lifespan context manager, BackgroundTasks vs Celery, routers per feature. Round 9 B.
27 other projects use a version of this.
Adopted by
Most recently taken up by
- gurupak/claude-skillstheir own version, first seen Oct 25, 2026
- DongDuong2001/pudo-code-systemtheir own version, first seen Oct 13, 2026
- G1Joshi/Agent-Skillstheir own version, first seen Oct 13, 2026
- nimadorostkar/Claude-Skills-collectiontheir own version, first seen Oct 13, 2026
- Alteriom/ai-dev-skillstheir own version, first seen Oct 11, 2026
- kid-sid/claude-spellbooktheir own version, first seen Oct 9, 2026
Used with
Projects with it also use docker, react and 3 more.
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.
wrsmith108Skilldocker
Container-based development for isolated, reproducible environments. Use when running npm commands, installing packages, executing code, or managing project dependencies. Trigger phrases include "npm install", "run the build", "start the server", "install package", or any code execution request.
Also in 4 projects that use this
VercelSkillreact
React renderer for json-render that turns JSON specs into React components. Use when working with @json-render/react, building React UIs from JSON, creating component catalogs, or rendering AI-generated specs.
Also in 3 projects that use this
rogue-dev-studioSkillpython
Python 3.13 with uv package manager via mise. Use when the project needs this capability or the user / team manifest asks for it. Use for specialized `python` work when listed in TEAM.yaml or explicitly requested.
Also in 3 projects that use this
MicrosoftSkilltypescript
TypeScript best practices for this monorepo. Use this skill when: (1) writing new TypeScript code, (2) reviewing TypeScript code, (3) working with API responses, fetch calls, or JSON parsing, (4) adding or modifying types and interfaces.
Also in 3 projects that use this
BlockSkillfrontend-design
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
Also in 3 projects that use this
Other versions27 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 27
- kid-sid/claude-spellbook★ 190same name
- youlaitech/youlai-skills★ 63same name
- Bbar0n234/learnflow-ai★ 35same name
- nimadorostkar/Claude-Skills-collection★ 33same name
- G1Joshi/Agent-Skills★ 15same name
- harness-studio/harness-studio★ 9same name
- DongDuong2001/pudo-code-system★ 5same name
- jawwad-ali/claude-code-skills★ 4same name
- Spardutti/claude-skills★ 3same name
- ffsshhttiikk/opencode-agents-skills★ 2same name
17 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 repository60 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- analyzeSkill
- animation-disciplineSkill
- api-versioningSkill
- autopilotSkill
- browser-e2eSkill
- characterizeSkill
- clarifySkill
- codemodSkill
- constitution-compactSkill
- constitutionSkill
- context-budgetSkill
- creative-webSkill
- db-migrationSkill
- debugSkill
- detect-stackSkill
- dispatch-criteriaSkill
- dreamSkill
- experimentSkill
- flag-cleanupSkill
- flag-rolloutSkill
- flask-realtimeSkill
- framework-detectorSkill
- front-end-designSkill
- grill-meSkill
- handoffSkill
- image-generationSkill
- implementSkill
- initiativeSkill
- instinctSkill
- loopSkill
- nextjsSkill
- observabilitySkill
- okr-alignSkill
- parallel-swarmSkill
- pivotSkill
- planSkill
- pr-bodySkill
- prime-disciplineSkill
- prod-observabilitySkill
- react-nodeSkill
- react-viteSkill
- release-trainSkill
- researchSkill
- reviewSkill
- security-guardSkill
- self-healSkill
- shipSkill
- skill-creatorSkill
- specifySkill
- tailwind-disciplineSkill
- tasksSkill
- tdd-loopSkill
- token-budgetSkill
- typographySkill
- verify-loopSkill
- verifySkill
- wip-checkpointSkill
- <kebab-case-skill-name>Skill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 1 is distinctive, and 3 are very specific to this project.
0
Common
Most of the 25 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 20
Request bodies are Pydantic classes: Never dict or Body() without a model.
- Very specific: line 21
Dependency injection via
Depends(): No module-level state for DB session / current user / settings. - Very specific: line 96
Every endpoint has response_model=
- Distinctive: line 120
All endpoints have typed request + response models
“Common” is measured: kept by at least 6 in 10 of the 25 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
FastAPI
Mandate
Enforce typed-everywhere Pydantic v2, dependency injection via Depends(), async SQLAlchemy 2.x patterns, modern lifespan (NOT on_startup/on_shutdown), and BackgroundTasks-vs-Celery decision discipline.
Decisions encoded
- Pydantic v2 only. v1 patterns (e.g.,
BaseModel.dict()) are anti-patterns; usemodel_dump(). - Every endpoint declares
response_model=. Untyped responses → OpenAPI lies. - Request bodies are Pydantic classes. Never
dictorBody()without a model. - Dependency injection via
Depends(). No module-level state for DB session / current user / settings. - Routers per feature.
APIRouter(prefix="/users", tags=["users"]);main.pyonly mounts routers. @asynccontextmanagerlifespan. Deprecatedon_startup/on_shutdownare forbidden.BackgroundTasksfor fire-and-forget ≤ 30s; Celery/RQ for retries, scheduling, or > 30s.- Async SQLAlchemy 2.x.
select(User).where(...)style — NOT legacy Query.
Project structure
app/
├── main.py # FastAPI() instance, lifespan, router mounts
├── api/
│ └── v1/
│ ├── __init__.py # APIRouter(prefix="/v1")
│ ├── users.py
│ ├── auth.py
│ └── billing.py
├── core/
│ ├── config.py # Pydantic Settings
│ ├── deps.py # Depends() factories
│ ├── security.py # JWT, password hashing
│ └── db.py # async engine + sessionmaker
├── models/ # SQLAlchemy 2.x DeclarativeBase
├── schemas/ # Pydantic request/response models
├── services/ # business logic; no FastAPI imports
└── tests/
├── conftest.py # test client + db fixtures via testcontainers
├── test_users.py
└── test_auth.pyCanonical patterns
Lifespan (NOT on_startup/on_shutdown)
from contextlib import asynccontextmanager
from fastapi import FastAPI
@asynccontextmanager
async def lifespan(app: FastAPI):
# startup
app.state.engine = create_async_engine(...)
yield
# shutdown
await app.state.engine.dispose()
app = FastAPI(lifespan=lifespan)Dependency injection
async def get_db(request: Request) -> AsyncSession:
async with AsyncSession(request.app.state.engine) as session:
yield session
@router.post("/users", response_model=UserResponse, status_code=201)
async def create_user(
body: UserCreate, # Pydantic — validated at boundary
db: AsyncSession = Depends(get_db),
current: User = Depends(get_current_user),
) -> UserResponse:
...Async SQLAlchemy 2.x
result = await db.execute(
select(User).where(User.email == email)
)
user = result.scalar_one_or_none()Hard rules
- Pydantic v2 (
from pydantic import BaseModel+model_config, NOTConfigclass) - Every endpoint has
response_model= - No
dictrequest bodies — always Pydantic - No
Session()instantiation outsideDepends(get_db) - No
Query()-style legacy SQLAlchemy - Services NEVER import from
fastapi; routes call services BackgroundTasks(.add_task)only for ≤ 30s + idempotent + crash-safe; otherwise Celery/RQ
Common pitfalls
- Sync function with async DB — silent deadlock or broken connection pool. Async all the way down.
- Sharing a session across requests — use
Depends(get_db)per request; never module-level session. on_startup/on_shutdown— deprecated; uselifespan.- Returning ORM objects directly — Pydantic doesn't serialize; declare
response_model+ usefrom_attributes=Truein model_config. Body()for complex bodies — use a Pydantic class so OpenAPI is accurate.- CPU-bound work in BackgroundTasks — blocks the event loop; offload to Celery + worker.
References
- FastAPI: https://fastapi.tiangolo.com/
- Async SQLAlchemy: https://docs.sqlalchemy.org/en/20/orm/extensions/asyncio.html
- Pydantic v2 migration: https://docs.pydantic.dev/latest/migration/
Done means
- All endpoints have typed request + response models
- Lifespan replaces on_startup/on_shutdown
- DB session via Depends, never module-level
- Routers organized by feature, mounted from main.py
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.

