Python Fastapi Architecture

Use when the user asks about FastAPI, setting up a FastAPI project with dependency injection and Pydantic models, Depends(), APIRouter structure, lifespan events or async SQLAlchemy. Produces a layered FastAPI project. Not for Django (use python-django-architecture) or Flask (use flask-backend).

45 stars 6 forksSoftware Development

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add j4flmao/agent-skills --skill python-fastapi-architecture
Manual install
git clone --depth 1 https://github.com/j4flmao/agent-skills.git /tmp/agent-skills
mkdir -p ~/.claude/skills
cp -r /tmp/agent-skills/skills/backend/python/fastapi ~/.claude/skills/python-fastapi-architecture

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Python FastAPI Architecture

## Purpose
Structure FastAPI applications with Clean Architecture. Pydantic at boundaries only. Domain entities are pure Python dataclasses. FastAPI routers are thin. Dependency injection via Depends.

## Agent Protocol

### Trigger
Exact user phrases: "FastAPI structure", "FastAPI architecture", "FastAPI folder", "FastAPI clean arch", "FastAPI router", "FastAPI dependency injection", "Python backend structure".

### Input Context
Before activating, verify:
- requirements.txt or pyproject.toml has fastapi dependency.
- The feature or module being created is known.

### Output Artifact
No file output. Produces folder structure and code examples as text.

### Response Format
Folder structure:
```
src/
  main.py
  api/v1/endpoints/
  core/
  domain/
  application/use_cases/
  infrastructure/database/
  schemas/
```

Code: module-level only. No import statements.

No preamble. No postamble. No explanations. No filler/hedging/transitions. Compress output — why use many token when few do trick.

### Completion Criteria
- [ ] src/ directory structure follows Clean Architecture.
- [ ] Domain entities are pure Python (dataclasses). No Pydantic. No SQLAlchemy.
- [ ] Pydantic schemas exist only in src/schemas/ (API boundary).
- [ ] Repository interfaces are ABCs in domain/.
- [ ] Repository implementations use SQLAlchemy in infrastructure/.
- [ ] FastAPI routers use Depends() for DI.
- [ ] One endpoint file per resource in api/v1/endpoints/.
Read the full skill on GitHub

Details

Skill name
python-fastapi-architecture
Path
skills/backend/python/fastapi/SKILL.md
License
MIT
Repo updated
17 November 2026

FAQ

What does the Python Fastapi Architecture skill do?

Use when the user asks about FastAPI, setting up a FastAPI project with dependency injection and Pydantic models, Depends(), APIRouter structure, lifespan events or async SQLAlchemy. Produces a layered FastAPI project. Not for Django (use python-django-architecture) or Flask (use flask-backend).

How do I install the Python Fastapi Architecture skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add j4flmao/agent-skills --skill python-fastapi-architecture. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Python Fastapi Architecture popular?

It lives in j4flmao/agent-skills, which has 45 GitHub stars and 6 forks.

Related skills

Agent Observability

45

j4flmao/agent-skills

Use when the user asks about agent observability, tracing agent reasoning, debugging an agent loop, OpenTelemetry GenAI spans for LLM calls, LLM cost tracking per agent, agent audit logs or hallucination/eval monitoring in production. Produces instrumentation config, trace schema, dashboards, alerts and cost attribution. Not for generic service tracing without LLMs (use devops-opentelemetry).

DevOps & Cloud

AI Agent Architectures

45

j4flmao/agent-skills

Use when the user asks to build an AI agent, design an agent that calls tools and keeps memory, write an agent system prompt or pick an agent framework (Claude Agent SDK, OpenAI Agents SDK, LangGraph). Produces an architecture brief covering loop, tools, memory, guardrails and evals, routing depth to child skills. Not for workflow patterns (use ai-agentic-workflows).

AI, LLMs & Agents

AI Agent Core Loop

45

j4flmao/agent-skills

Use when the user asks about the agent loop, ReAct vs plan-and-solve, re-planning, Reflexion, an agent stuck in a loop, max iterations or termination conditions. Produces a loop spec or patch with state, success predicate, caps and no-progress detection. Not for overall agent design (use ai-agent-architectures) or tool schemas (use tool-calling-principles).

AI, LLMs & Agents

Quarkus Backend

45

j4flmao/agent-skills

Use when the user asks about Quarkus, Quarkus REST (RESTEasy Reactive), Panache, Dev Services, Quarkus native build, SmallRye Reactive Messaging or continuous testing. Produces Quarkus services with config, health checks and tests. Not for Micronaut (use micronaut) or Spring Boot (use spring-boot-architecture).

Software Development

Python Django Architecture

45

j4flmao/agent-skills

Use when the user asks about Django, Django ORM queries that are slow, select_related and prefetch_related, Django REST framework (DRF), Django apps structure or migrations. Produces Django code with a service layer and N+1-free queries. Not for FastAPI (use python-fastapi-architecture).

Software Development

Rate Limiting

45

j4flmao/agent-skills

Use when the user asks about rate limiting, protecting a public API from abuse with request throttling, token bucket, sliding window, 429 Too Many Requests, Retry-After or per-user quotas. Produces an algorithm, key and Redis-backed limiter. Not for circuit breakers and bulkheads (use backend-resilience-patterns).

Software Development

Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.