fastapi-expert

Generate secure FastAPI code with OAuth2/JWT, Pydantic v2, and SQLAlchemy 2.0 async.

3|1|Updated Dec 3, 2025
One-click install
npx skills add https://github.com/Probably-Group/Dev-AID --skill fastapi-expert-probably-group
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fastapi-expert
Source: https://github.com/Probably-Group/Dev-AID/tree/main/.dev-aid/skills/expert/fastapi-expert
Command: npx skills add https://github.com/Probably-Group/Dev-AID --skill fastapi-expert-probably-group

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It prevents common FastAPI production failures—security gaps, authorization mistakes, input validation issues, and unsafe database/file handling—by enforcing robust patterns for authenticated async APIs.

Core Features & Use Cases

  • Security-first API scaffolding: OAuth2/JWT auth patterns, secure cookie settings, rate-limiting, and centralized safe error responses.
  • SQLAlchemy 2.0 async correctness: Parameterized ORM queries, async session patterns, and safe object access with BOLA prevention.
  • Performance & production readiness: Async-only I/O rules, CORS whitelisting (no wildcard with credentials), and testing patterns to validate behavior before shipping.

Use case: You are implementing an authenticated API endpoint that returns user-owned records and persists them with SQLAlchemy 2.0 async—this Skill helps ensure queries are safe, inputs are validated, ownership checks are enforced, and responses don’t leak sensitive data.

Quick Start

Ask the AI: Generate production-ready FastAPI code for an authenticated API using OAuth2/JWT with SQLAlchemy 2.0 async, including Pydantic v2 validation, secure CORS, rate limiting on login, and ownership checks to prevent BOLA.

Frequently Asked Questions about fastapi-expert

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

FAQPage Schema
How do I implement OAuth2 JWT authentication in FastAPI with SQLAlchemy async?

FastAPI OAuth2 JWT authentication is implemented by generating secure token flows, using Pydantic v2 for input validation, and enforcing async database session patterns to safely persist user credentials without blocking the event loop.

What is the best way to prevent BOLA vulnerabilities in FastAPI endpoints?

Preventing BOLA vulnerabilities in FastAPI endpoints requires enforcing strict object authorization through ownership checks before returning database records, ensuring users can only access or modify data they explicitly own via parameterized SQLAlchemy ORM queries.

How do I configure secure CORS settings for a production FastAPI application?

Secure CORS settings for a production FastAPI application are configured by applying strict origin whitelisting and avoiding wildcard origins when credentials are involved, ensuring cross-origin requests are explicitly validated against approved domains.

Does Pydantic v2 validation work with SQLAlchemy 2.0 async database patterns?

Pydantic v2 validation works with SQLAlchemy 2.0 async database patterns by validating incoming request data before it reaches the database layer, ensuring async session queries receive strongly typed, safe input while maintaining non-blocking I/O operations.

Why does my FastAPI file serving endpoint allow directory traversal attacks?

FastAPI file serving endpoints allow directory traversal attacks when static file paths are not properly sanitized, requiring traversal-safe file serving patterns and bounded upload limits to prevent unauthorized access to sensitive server directories.