fastapi

Solid

FastAPI best practices and conventions. Use when working with FastAPI APIs and Pydantic models for them. Keeps FastAPI code clean and up to date with the latest features and patterns, updated with new versions. Write new code or refactor and update old code.

AI & Automation 516 stars 54 forks Updated yesterday Apache-2.0

Install

View on GitHub

Quality Score: 91/100

Stars 20%
90
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# FastAPI Official FastAPI skill to write code with best practices, keeping up to date with new versions and features. > **Project note**: This project starts the server via `./run_services.sh` (uvicorn), not `fastapi dev`. The patterns below still apply to all endpoint/model code. ## Use the `fastapi` CLI Run the development server on localhost with reload: ```bash fastapi dev ``` Run the production server: ```bash fastapi run ``` ### Add an entrypoint in `pyproject.toml` FastAPI CLI will read the entrypoint in `pyproject.toml` to know where the FastAPI app is declared. ```toml [tool.fastapi] entrypoint = "my_app.main:app" ``` ### Use `fastapi` with a path When adding the entrypoint to `pyproject.toml` is not possible, or the user explicitly asks not to, or it's running an independent small app, you can pass the app file path to the `fastapi` command: ```bash fastapi dev my_app/main.py ``` Prefer to set the entrypoint in `pyproject.toml` when possible. ## Use `Annotated` Always prefer the `Annotated` style for parameter and dependency declarations. It keeps the function signatures working in other contexts, respects the types, allows reusability. ### In Parameter Declarations Use `Annotated` for parameter declarations, including `Path`, `Query`, `Header`, etc.: ```python from typing import Annotated from fastapi import FastAPI, Path, Query app = FastAPI() @app.get("/items/{item_id}") async def read_item( item_id: Annotated[int, Path(ge=1, descrip...

Details

Author
ReflexioAI
Repository
ReflexioAI/claude-smart
Created
1 months ago
Last Updated
yesterday
Language
Python
License
Apache-2.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category