fastapi
Skill20 starsChanged 7 months agoMITView on GitHub
Apply when building FastAPI endpoints, Pydantic models, or async APIs. Covers routing, dependency injection, error handling, testing, and OpenAPI hygiene.
16 other projects use a version of this.
Adopted by
Most recently taken up by
- jawwad-ali/claude-code-skillstheir own version, first seen Sep 5, 2026
- Spardutti/claude-skillstheir own version, first seen Aug 31, 2026
- peakdong68/my-skillstheir own version, first seen Aug 29, 2026
- conjure-3301/skillstheir own version, first seen Aug 17, 2026
- Bbar0n234/learnflow-aitheir own version, first seen Aug 11, 2026
- youlaitech/youlai-skillstheir own version, first seen Jul 14, 2026
Other versions16 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 16
- youlaitech/youlai-skills★ 56same name
- martinholovsky/claude-skills-generator★ 47same name
- Bbar0n234/learnflow-ai★ 35same name
- nimadorostkar/Claude-Skills-collection★ 28same name
- DongDuong2001/pudo-code-system★ 5same name
- jawwad-ali/claude-code-skills★ 4same name
- rishapgandhi/python-skills★ 4same name
- Spardutti/claude-skills★ 3same name
- ffsshhttiikk/opencode-agents-skills★ 2same name
- aptitude-stack/registery★ 1same name
6 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 repository49 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/brainstorming.mdcCursor rule
- .cursor/rules/branch-finishing.mdcCursor rule
- .cursor/rules/code-quality.mdcCursor rule
- .cursor/rules/db-schema.mdcCursor rule
- .cursor/rules/debugging.mdcCursor rule
- .cursor/rules/docker.mdcCursor rule
- .cursor/rules/domain-template.mdcCursor rule
- .cursor/rules/drawio.mdcCursor rule
- .cursor/rules/error-log.mdcCursor rule
- .cursor/rules/fastapi.mdcCursor rule
- .cursor/rules/git-conventions.mdcCursor rule
- .cursor/rules/github-cli.mdcCursor rule
- .cursor/rules/implementation-plan.mdcCursor rule
- .cursor/rules/langchain.mdcCursor rule
- .cursor/rules/python.mdcCursor rule
- .cursor/rules/react.mdcCursor rule
- .cursor/rules/review-deployment.mdcCursor rule
- .cursor/rules/security-review.mdcCursor rule
- .cursor/rules/self-extension-workflow.mdcCursor rule
- .cursor/rules/shell-scripting.mdcCursor rule
- .cursor/rules/svg-check.mdcCursor rule
- .cursor/rules/tdd.mdcCursor rule
- .cursor/rules/typescript.mdcCursor rule
- skill-everythingSkill
- brainstormingSkill
- branch-finishingSkill
- code-qualitySkill
- db-schemaSkill
- debuggingSkill
- dockerSkill
- domain-templateSkill
- drawioSkill
- error-logSkill
- git-conventionsSkill
- github-cliSkill
- implementation-planSkill
- langchainSkill
- pythonSkill
- reactSkill
- review-deploymentSkill
- security-reviewSkill
- self-extension-workflowSkill
- shell-scriptingSkill
- svg-checkSkill
- tddSkill
- <kebab-case-name>Skill
- typescriptSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 0 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 14 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 26
Always: use Pydantic v2 syntax (model_config, model_dump, model_validate) unless the project explicitly pins Pydantic v1 (pydantic<2 in …
- Very specific: line 32
Always: use status_code on the route decorator (@app.post("/items", status_code=201)) rather than constructing a Response object just to …
- Very specific: line 46
Always: use BackgroundTasks (injected via Depends or as a route parameter) for fire-and-forget work.
- Very specific: line 52
Always: test FastAPI routes with TestClient (sync) or AsyncClient from httpx (async).
“Common” is measured: kept by at least 6 in 10 of the 14 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
Sub-Skill: FastAPI
Purpose: Prevent common FastAPI and Pydantic mistakes. Apply these rules whenever writing or reviewing FastAPI route handlers, Pydantic schemas, or async API code.
Rules
- Always declare request and response bodies as Pydantic models — never use raw
dictorAnyfor I/O. Reference: ERR-2026-025 - Always use Pydantic v2 syntax (
model_config,model_dump,model_validate) unless the project explicitly pins Pydantic v1 (pydantic<2in requirements). Reference: ERR-2026-025 - Always declare route handlers as
async defunless the handler calls blocking I/O that cannot be awaited; userun_in_executorfor blocking calls inside async handlers. - Always specify an explicit
response_modelon every route decorator so FastAPI filters and validates the response shape. - Always use
status_codeon the route decorator (@app.post("/items", status_code=201)) rather than constructing aResponseobject just to set the status. - Never raise bare
Exceptionin route handlers; raiseHTTPExceptionwith a meaningfulstatus_codeanddetailstring, or define a custom exception with an exception handler. - Always register exception handlers via
@app.exception_handler(MyError)for domain errors rather than catching them inside every route. - Use
Depends()for shared logic (auth, DB sessions, pagination params) — never duplicate the same logic across multiple route functions. - Prefer
APIRouterwith aprefixandtagslist to group related endpoints; register routers withapp.include_router()rather than defining all routes on the app object. - Always configure CORS via
CORSMiddlewarewith an explicitallow_originslist; never useallow_origins=["*"]in production. - Use the
lifespancontext manager (FastAPI ≥ 0.93) for startup/shutdown logic instead of the deprecated@app.on_event("startup")/@app.on_event("shutdown")decorators. - Always use
BackgroundTasks(injected viaDependsor as a route parameter) for fire-and-forget work; neverasyncio.create_taskinside a route without a lifecycle guard. - Avoid exposing internal field names in OpenAPI by setting
model_config = ConfigDict(populate_by_name=True)and usingaliasoralias_generatorwhen the wire format differs from the Python attribute name. - Use
pydantic-settings(BaseSettings) for configuration; never reados.environdirectly inside route handlers or dependency functions. - Always test FastAPI routes with
TestClient(sync) orAsyncClientfromhttpx(async); never spin up a real server in unit tests. - Ensure path operation functions declare only the parameters they actually use; unused
Requestinjections or staleDependsimports are dead code and confuse readers. - Before adding a new route, check whether an existing router already owns that resource prefix; adding routes to the wrong router breaks OpenAPI tag grouping.
- Never store mutable state in module-level variables inside route modules; use dependency-injected singletons or
app.stateinstead.
See also
skills/python/SKILL.mdskills/code-quality/SKILL.md
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.

