fastapi
Skill2 starsChanged 2 months agoMITView on GitHub
FastAPI application conventions - app factory and lifespan, pydantic-settings configuration, Pydantic v2 request and response schemas, dependency injection, router design, service and persistence seams, and httpx-based app testing. Use when working in a FastAPI service - adding or reviewing endpoints, schemas, dependencies, auth wiring, or settings, when a request-layer change needs the app's structure, or when FastAPI behavior must be reconciled with the project's existing layout. 中文触发:FastAPI、接口开发、路由、依赖注入、Pydantic
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
- qyndex/claude-inittheir own version, first seen Oct 13, 2026
- Alteriom/ai-dev-skillstheir own version, first seen Oct 11, 2026
Used with
Projects with it also use nextjs, docker and 4 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.
OpenAISkillnextjs
Next.js App Router expert guidance. Use when building, debugging, or architecting Next.js applications — routing, Server Components, Server Actions, Cache Components, layouts, middleware/proxy, data fetching, rendering strategies, and deployment on Vercel.
Also in 4 projects that use this
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 repository25 other files it gives its agents.
- AGENTS.mdAGENTS.md
- humanizer-zhSkill
- backend-patternsSkill
- frontend-patternsSkill
- security-reviewSkill
- python-projectSkill
- ts-backendSkill
- ts-frontendSkill
- readmeSkill
- codebase-designSkill
- code-reviewSkill
- coding-standardsSkill
- domain-modelingSkill
- fixSkill
- grillingSkill
- living-docs-governanceSkill
- planSkill
- prototypeSkill
- publish-ticketsSkill
- resilienceSkill
- session-handoffSkill
- specSkill
- systematic-debuggingSkill
- tddSkill
- verificationSkill
The file
We split this skill into the rules it gives an agent
9 rules. 0 are common, 6 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 25 edited versions we read keep these.
6
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
- Distinctive: line 34
Read only the references the active branch needs:
- Distinctive: line 62
Read the pin before depending on version-specific behavior.
- Distinctive: line 63
Search the repository for an existing endpoint or schema of the same shape and copy it.
- Distinctive: line 64
When the exact signature or default decides correctness, mark it unverified and confirm against the installed version rather than writing …
- Distinctive: line 75
Keep route handlers thin: parse, authorize, delegate, and serialize.
- Very specific: line 79
Keep request-scoped resources inside yield dependencies so cleanup survives exceptions.
- Distinctive: line 80
Do not run blocking I/O inside an async handler.
- Very specific: line 82
Do not decide transaction scope in the route: backend-patterns owns it, the service layer expresses it.
- Very specific: line 83
Do not author retry, timeout, or overload behavior in an endpoint: consume resilience.
“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
Apply conventions that hold in FastAPI applications on top of python-project, and adopt whatever this repository already does. This skill owns the web-layer binding: transport, schema, dependency, and route shape. It does not own service boundaries, consistency, or failure policy.
Workflow
1. Establish the context
Inspect the repository and state:
- FastAPI, Starlette, and Pydantic versions from
pyproject.tomlor the lockfile, and whether the codebase is Pydantic v2 or still v1; - the existing layout: app factory or module-level app,
routers/or feature packages, where settings, dependencies, and models live; - the async model: async or sync handlers, the DB driver, and whether sync calls already appear inside async paths;
- the dependency graph already in use (
Dependsproviders, settings access, auth dependencies,yielddependencies with cleanup); - error convention: exception handlers, response models, status codes, and the error body shape clients already parse;
- the auth model: authentication mechanism, authorization enforcement point, and the current-user dependency;
- how tests build an app instance today (transport, fixtures, dependency overrides).
Completion criterion: every statement about the app's structure cites a file; anything unverified is marked as an assumption.
2. Define the problem and the invariant
Describe the pressure without naming a library: a boundary value that can arrive unvalidated, an authorization check that can be skipped on a new route, a request-scoped resource leaking across requests, a blocking call inside an async path, a response that exposes a stored field it should not. State the invariant in observable terms — status code, body shape, or side effect that must hold.
Completion criterion: the affected route, ownership seam, and observable correctness condition are explicit.
3. Select the branch
Read only the references the active branch needs:
| Problem branch | Reference or owner |
| Layout, app factory, lifespan and startup ordering, settings and environment configuration | references/app-and-configuration.md |
| Request and response schemas, validation and serialization boundaries, dependency injection, auth wiring, router and endpoint design, status codes and error shape | references/schemas-dependencies-and-routes.md |
| Service methods, transaction ownership, session lifecycle, repository seams, persistence access from routes | references/service-layer-and-persistence.md |
| App-level testing: transport, fixtures, dependency overrides, lifespan in tests | references/testing-fastapi-apps.md; consume python-project for pytest fundamentals, fixtures, and async test mechanics |
| pytest structure, fixture scopes, parametrization, markers, plugin configuration | Invoke python-project and read references/testing-with-pytest.md |
| Layering, ownership boundaries, transaction scope, distributed consistency, API and event contract evolution | Invoke backend-patterns; the FastAPI shape must express its decision, not replace it |
| Timeouts, retries, cancellation, idempotency of a mutating endpoint, overload behavior, unknown mutation outcomes | Invoke resilience |
| Test-first slices, test seam choice, coverage policy, mocking scope | Invoke tdd |
| Gate execution and the final verdict | Invoke verification |
| Trust boundary: new endpoint, auth flow, input surface, secret handling | Invoke security-review |
| Naming, readability, duplication, control flow | Invoke coding-standards |
Completion criterion: the route shape follows the branch, not framework habit.
4. Adapt to this repository
Prefer the app's existing structure over the reference's example tree: the example is one valid shape, not the required one. Reuse the existing settings object, session dependency, current-user dependency, error shape, and response-model convention. If the change would introduce a second way to access settings, open a session, or shape an error, stop and reconcile with the existing one instead.
Completion criterion: the endpoint is indistinguishable in style from its neighbours, and no second convention for session, settings, or errors was introduced.
5. Version-sensitive APIs: repository evidence only
FastAPI and Pydantic behavior differs across versions and is not remembered reliably.
- Read the pin before depending on version-specific behavior; Pydantic v1 and v2 code are not interchangeable.
- Search the repository for an existing endpoint or schema of the same shape and copy it.
- When the exact signature or default decides correctness, mark it unverified and confirm against the installed version rather than writing from recall.
- External documentation lookup is intentionally out of scope here; when it is enabled, this section points at the global
context7-docsskill.
Completion criterion: no version-dependent claim in the change rests on memory alone.
6. Define verification evidence
For each invariant, name the request-level check that would fail if it broke: status code, validated payload, authorization denial, session cleanup after an exception, or a serialization boundary that must not leak a field. Hand sequencing to plan and gate execution to verification. This skill identifies design gaps; it does not issue READY, NOT READY, or BLOCKED.
Route Rules
- Keep route handlers thin: parse, authorize, delegate, and serialize. Business decisions belong to the service layer.
- Validate at the boundary with a schema; never trust a raw
dictor a query parameter shape. - Distinguish the request schema from the response schema. Returning the ORM object is how stored fields leak.
- Make the authorization check an explicit dependency on every authoritative route rather than an inline conditional.
- Keep request-scoped resources inside
yielddependencies so cleanup survives exceptions. - Do not run blocking I/O inside an async handler; match the driver's async or sync model instead of mixing.
- Declare the expected failure as a response model or an exception handler once, and reuse the project's error shape.
- Do not decide transaction scope in the route:
backend-patternsowns it, the service layer expresses it. - Do not author retry, timeout, or overload behavior in an endpoint: consume
resilience.
Output Contract
Scale depth to scope: a single endpoint needs the invariant, the route shape, and its check. Use the full structure for auth, session, schema-boundary, or cross-service work.
Detected stack and evidence
Problem and invariant
Route, schema, and dependency shape
Service and transaction seam
Failure behavior and error shape
Verification evidence
Unverified API assumptions and open risksThe endpoint is not complete until the invariant, the authorization path, the serialization boundary, the failure behavior, and the check are stated.
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.

