python-fastapi-architecture

python-fastapi-architecture is a skill for Claude Code, Codex from j4flmao/agent-skills. It costs 126 tokens per session (4,401 once invoked), scanned A, original, MIT.

A structure guide for FastAPI, a Python framework for building web APIs. It organizes the application into layers, keeping web requests, business rules, and database code separate.

In plain words
What is it for?
Use it to plan FastAPI folders, routers, dependency injection, domain entities, use cases, database code, and request or response schemas.
Why use it?
It helps prevent routers from becoming overloaded and keeps core business objects independent from FastAPI, data validation, and database libraries.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions Codex.

Good fit Use it to plan FastAPI folders, routers, dependency injection, domain entities, use cases, database code, and request or response schemas.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/j4flmao/agent-skills/fastapi
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add j4flmao/agent-skills --skill fastapi
Clone the repo
git clone --depth 1 https://github.com/j4flmao/agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for python-fastapi-architecture

README.md
[![agentmods](https://agentmods.dev/badge/skills/j4flmao/agent-skills/fastapi/github.svg)](https://agentmods.dev/skills/j4flmao/agent-skills/fastapi)
Your own site
<a href="https://agentmods.dev/skills/j4flmao/agent-skills/fastapi"><img src="https://agentmods.dev/badge/skills/j4flmao/agent-skills/fastapi/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for python-fastapi-architecture

Your own site · 80×15
<a href="https://agentmods.dev/skills/j4flmao/agent-skills/fastapi"><img src="https://agentmods.dev/badge/skills/j4flmao/agent-skills/fastapi.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 126 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,401 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00126 $0.04401
Opus 5.5 $0.00050 $0.01760
Sonnet 5.5 $0.00025 $0.00880
Haiku 4.5 $0.00013 $0.00440

Measured 1mo ago against content hash ac21b315b729, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

python-fastapi-architecture scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/backend/python/fastapi/SKILL.md · 541 lines

How it starts

The opening of the file, as written. The whole thing — 541 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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/.

Max Response Length

Folder structure: unlimited. Code: 15 lines per example.

Architecture Decision Trees

FastAPI vs Django vs Flask

Criterion FastAPI Django Flask
Async Native (async def) Partial (3.1+ async) Limited (async extra)
Validation Pydantic (built-in) DRF Serializers Manual / Flask-Marshmallow
Performance High (Starlette + Uvicorn) Moderate Low
DI system Depends() No built-in Flask-Injector
Ecosystem Growing Largest Large
Auto-docs OpenAPI (built-in) DRF-YASG Flask-Smorest

Read the full file on GitHub · 541 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 541 lines · 126 tokens per session scan A ac21b315b729

Subscribe to this mod's changes

python-fastapi-architecture is a skill published in the GitHub repository j4flmao/agent-skills (33 stars, last pushed 10d ago), licensed MIT. It adds 126 tokens to every session and 4,401 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

background-task

Add or modify work that runs outside the request/response cycle — emails, document ingestion, webhooks, cleanups, scheduled jobs. Use when something is slow or fire-and-forget, or when adding a periodic/cron task. This project's queue is {{ cookiecutter.backgroundtasks }}.

vstorm-co/full-stack-ai-agent-template · 62 tokens

channel-bot

Work with messaging-channel bots (Telegram / Slack) — register a bot, route inbound messages through the AI agent, handle webhooks vs polling, or add a new channel adapter. Use when wiring chat into a messaging platform or debugging bot delivery.

vstorm-co/full-stack-ai-agent-template · 53 tokens

fastapi-guard

Production-ready security middleware for FastAPI. Use when adding IP filtering, rate limiting, per-route security decorators, route-resolution strict mode, global behavior rules, passive/log-only mode, or Guard Agent SaaS telemetry to a FastAPI app. Covers SecurityMiddleware setup, SecurityConfig tuning, and the…

rennf93/fastapi-guard · 72 tokens

pydantic-resolve-3step

A three-stage development method for Python projects built with pydantic-resolve, starting with agreed data models and ending with application interfaces. It uses an ER diagram, which shows database entities and their relationships, plus ORM models that represent database records in code.

KLR-Pattern/pydantic-resolve · 56 tokens

fastapi-expert

Expert-level FastAPI development for high-performance Python APIs with async support. Use when the user mentions Python, API, async, REST, OpenAPI, or Pydantic, or when the task involves FastAPI Features.

personamanagmentlayer/pcl · 49 tokens

compose-python-stack

Design and generate a compatible project from the Python Template component layers or presets. Use when choosing a workload, framework, AI providers, data engines, interfaces, training and serving tools, deployment target, or IaC option; also use when a user wants a simple library, CLI, or API without AI.

leynier/python-template · 65 tokens