ddd-fastapilisted
Install: claude install-skill salimramirez/agent-skills
# DDD in FastAPI
Write the actual code for a Domain-Driven Design model in **FastAPI / Python**. The core rules below say *what* the building blocks are and when to reach for each; the references say *how to express them idiomatically* in FastAPI, and the assets and scripts write the parts that should come out the same every time.
This is an **opinionated** house style: for every decision it names one convention and says what that convention buys, rather than listing options. It is one coherent way to do this, not the only correct one; where a choice is genuinely open, the reference says so. Python leaves more to taste than Java does, and the house style respects that: it fixes the decisions that make every bounded context look alike — where a file goes, what it is called, which layer may import which — and leaves the rest to the code in front of it. Examples use the **QuickBite** food-delivery domain — an `Order` in the `ordering` bounded context, a `Customer` in `customers`.
The idioms are FastAPI with `async` routes, Pydantic v2 for the request and response schemas and the settings, SQLAlchemy 2 with its asyncio extension over PostgreSQL (`asyncpg`), Alembic for the schema, and plain Python — classes and frozen dataclasses — for the domain. The shipped code targets **Python 3.12+** and was run on 3.12 and 3.13, from the lowest versions `pyproject.toml` allows (FastAPI 0.122, SQLAlchemy 2.0.0, Alembic 1.16) to the current ones. The one floor that is behavior and not just