fastapi-standards
Use when building a FastAPI service in a touchstone repo — routers, dependencies, pydantic schemas, async endpoints, serving. Triggers on `fastapi` in pyproject/imports, `APIRouter`, `app = FastAPI()`. Language rules live in the python skill.
- License 许可
- MIT
- 最近更新
- 2026-08-26
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- fastapi-standards
- license
- MIT
- metadata
- { "author": "touchstone", "version": "0.2.0" }
- description
- Use when building a FastAPI service in a touchstone repo — routers, dependencies, pydantic schemas, async endpoints, serving. Triggers on `fastapi` in pyproject/imports, `APIRouter`, `app = FastAPI()`. Language rules live in the python skill.
03 SKILL.md 正文
FastAPI (framework)
Full standard: standards/frameworks/fastapi.md (layers on standards/languages/python.md). Rules:
Always
- Domain/module structure (
src/<domain>/{router,schemas,service,deps}), NOT file-type folders. - Sync vs async routes:
async defonly for non-blocking I/O; blocking I/O → plaindef(FastAPI runs it in a threadpool); CPU-bound → a worker. Don't make everythingasync. - Pydantic v2 request/response/db schemas separated;
response_model; never return ORM objects raw. Settings viapydantic-settings. - DI via
Depends(db session per request, auth, pagination);yielddeps for cleanup; override in tests.
Defer (don't duplicate)
- API contract/errors →
../../standards/design/api-design.md; DB + Alembic →../../standards/platform/database.md; authN/authZ →../../standards/practices/app-security.md; async correctness →../../standards/languages/python.md.
Done
ruff/pyright/pytest green · domain modules · async routes correct · OpenAPI versioned. See the doc.
04 同仓库更多 Skills
ok-standards
Use when writing shell, per standards/languages/shell.md.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.