fastapi-development

aj-geddes/useful-ai-prompts · updated Apr 23, 2026

$npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill fastapi-development
0 commentsdiscussion
summary

Create fast, modern Python APIs using FastAPI with async/await support, automatic API documentation, type validation using Pydantic, dependency injection, JWT authentication, and SQLAlchemy ORM integration.

skill.md

FastAPI Development

Table of Contents

Overview

Create fast, modern Python APIs using FastAPI with async/await support, automatic API documentation, type validation using Pydantic, dependency injection, JWT authentication, and SQLAlchemy ORM integration.

When to Use

  • Building high-performance Python REST APIs
  • Creating async API endpoints
  • Implementing automatic OpenAPI/Swagger documentation
  • Leveraging Python type hints for validation
  • Building microservices with async support
  • Integrating Pydantic for data validation

Quick Start

Minimal working example:

# main.py
from fastapi import FastAPI, HTTPException, status
from fastapi.middleware.cors import CORSMiddleware
from contextlib import asynccontextmanager
import logging

# Setup logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

# Create FastAPI instance
app = FastAPI(
    title="API Service",
    description="A modern FastAPI application",
    version="1.0.0",
    docs_url="/api/docs",
    openapi_url="/api/openapi.json"
)

# Add CORS middleware
app.add_middleware(
    CORSMiddleware,
    allow_origins=["http://localhost:3000"],
    allow_credentials=True,
    allow_methods=["*"],
// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

Guide Contents
FastAPI Application Setup FastAPI Application Setup
Pydantic Models for Validation Pydantic Models for Validation
Async Database Models and Queries Async Database Models and Queries
Security and JWT Authentication Security and JWT Authentication
Service Layer for Business Logic Service Layer for Business Logic
API Routes with Async Endpoints API Routes with Async Endpoints

Best Practices

✅ DO

  • Use async/await for I/O operations
  • Leverage Pydantic for validation
  • Use dependency injection for services
  • Implement proper error handling with HTTPException
  • Use type hints for automatic OpenAPI documentation
  • Create service layers for business logic
  • Implement authentication on protected routes
  • Use environment variables for configuration
  • Return appropriate HTTP status codes
  • Document endpoints with docstrings and tags

❌ DON'T

  • Use synchronous database operations
  • Trust user input without validation
  • Store secrets in code
  • Ignore type hints
  • Return database models in responses
  • Implement authentication in route handlers
  • Use mutable default arguments
  • Forget to validate query parameters
  • Expose stack traces in production

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.531 reviews
  • Aditi Martin· Dec 28, 2024

    Keeps context tight: fastapi-development is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Ava Ghosh· Dec 24, 2024

    fastapi-development reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Aisha Abebe· Dec 12, 2024

    I recommend fastapi-development for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Ava Reddy· Nov 19, 2024

    Registry listing for fastapi-development matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Advait Sharma· Nov 3, 2024

    Useful defaults in fastapi-development — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Yuki Johnson· Oct 22, 2024

    Registry listing for fastapi-development matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Ava Diallo· Oct 10, 2024

    Useful defaults in fastapi-development — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Layla Li· Sep 17, 2024

    fastapi-development has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Yash Thakker· Sep 1, 2024

    Useful defaults in fastapi-development — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Hassan Bansal· Sep 1, 2024

    fastapi-development fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

showing 1-10 of 31

1 / 4