FastAPI

Rewrites Tailwind HTML to standalone CSS files preserving classes and visual output.

1|Updated May 2, 2026
One-click install
npx skills add https://github.com/Levironexe/architect --skill fastapi-levironexe
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: FastAPI
Source: https://github.com/Levironexe/architect/tree/main/skills/stacks/fastapi
Command: npx skills add https://github.com/Levironexe/architect --skill fastapi-levironexe

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Unstructured or “vibe-coded” FastAPI projects become hard to maintain, test, and evolve because HTTP handlers, business logic, validation schemas, and persistence concerns are mixed together in the wrong places.

Core Features & Use Cases

  • Domain-driven folder separation: Co-locates router, service, schemas, models, and dependencies per feature domain to reduce cross-file confusion and enable safe incremental refactors.
  • Clear responsibility boundaries: Enforces thin routers (HTTP-only) and orchestration/business rules in the service layer (no FastAPI/HTTP knowledge).
  • Explicit request/response contracts: Uses separate Pydantic input and output schemas so the API contract is decoupled from SQLAlchemy ORM models.
  • Dependency and configuration discipline: Centralizes settings in config.py and isolates DB session wiring in database.py and Depends() logic in dependencies.py.

Quick Start

Ask your coding agent to reorganize each feature domain into {domain}/router.py, {domain}/service.py, {domain}/schemas.py, {domain}/models.py, and {domain}/dependencies.py, then update main.py to register routers with consistent prefixes and tags.

Frequently Asked Questions about FastAPI

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor a FastAPI project to use domain driven design?

Refactoring a FastAPI project to domain driven design involves separating HTTP routing from business orchestration and persistence by co-locating router, service, schemas, models, and dependencies files per feature domain to enforce clear responsibility boundaries.

Why does my FastAPI service layer contain HTTP request handling?

FastAPI service layers contain HTTP request handling when business logic and routing are mixed together, violating responsibility boundaries. Applying a domain-driven architecture moves orchestration to service layers without HTTP knowledge, keeping routers thin with Pydantic validation and Depends injection.

What is the best way to separate SQLAlchemy models from Pydantic schemas in FastAPI?

The best way to separate SQLAlchemy models from Pydantic schemas in FastAPI is to enforce explicit request and response contracts. This uses separate Pydantic input and output schemas so the API contract is decoupled from SQLAlchemy ORM models within a domain-driven folder structure.

Can I incrementally refactor a multi-domain REST API without breaking existing FastAPI endpoints?

Yes, you can incrementally refactor a multi-domain REST API by co-locating router, service, schemas, models, and dependencies per feature domain. This domain-driven separation reduces cross-file confusion and supports safe phased improvements without breaking existing FastAPI endpoints.

Where should I centralize database sessions and configuration settings in a FastAPI DDD architecture?

In a FastAPI DDD architecture, you should centralize configuration settings in a dedicated config module and isolate DB session wiring in a database module. Dependency injection logic via Depends should be placed in a separate dependencies module to enforce dependency and configuration discipline.

When do I need to restructure my FastAPI codebase into a domain-driven architecture?

You need to restructure your FastAPI codebase into a domain-driven architecture when unstructured projects mix HTTP handlers, business logic, validation schemas, and persistence concerns together, making the application hard to maintain, test, and evolve across multi-domain REST APIs.