fastapi

Audit FastAPI code for incorrect patterns and enforce Pydantic v2 practices.

13|Updated Mar 15, 2019
One-click install
npx skills add https://github.com/WTFox/dotfiles --skill fastapi-wtfox
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fastapi
Source: https://github.com/WTFox/dotfiles/tree/main/claude/.claude/skills/fastapi
Command: npx skills add https://github.com/WTFox/dotfiles --skill fastapi-wtfox

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps identify and fix dangerous or incorrect FastAPI code patterns that commonly appear in production to improve reliability and safety.

Core Features & Use Cases

  • Ensure route handlers remain thin and delegate to a service layer.
  • Enforce declared response models, proper dependency injection with Annotated types, correct HTTP status codes, and robust exception handling.
  • Promote and enforce modern FastAPI practices, including lifespan management with async context managers and compliant Pydantic v2 usage.

Quick Start

Provide Claude with a FastAPI code sample and request an audit to surface non-idiomatic patterns and suggested fixes.

Frequently Asked Questions about fastapi

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

FAQPage Schema
How do I audit FastAPI code for dangerous production patterns?

Auditing FastAPI code for production safety involves analyzing route handlers, dependency injection, and response models to identify dangerous patterns. The audit enforces safer patterns by suggesting structural fixes for reliability and correct HTTP status codes.

Why should FastAPI route handlers delegate to a service layer?

FastAPI route handlers should delegate to a service layer to keep endpoints thin and maintainable. This pattern separates HTTP request handling from business logic, enforcing correct response models and robust exception handling for production safety.

What's the best way to manage FastAPI lifespan events with async context managers?

The best way to manage FastAPI lifespan events is using modern async context managers. This approach ensures proper startup and shutdown procedures, replacing deprecated event handlers to maintain robust application lifecycle management.

How do I fix incorrect dependency injection in FastAPI using Annotated types?

Fix incorrect FastAPI dependency injection by using Annotated types for proper type hints. This modern approach enforces declared response models and ensures safer DI patterns compared to older syntax, improving code reliability.

Does the Skill enforce Pydantic v2 patterns for FastAPI response models?

The Skill enforces Pydantic v2 patterns for FastAPI response models to ensure type safety and validation. It identifies non-compliant usage and suggests modern fixes for robust data serialization and correct HTTP status codes.

When should I not use background tasks in FastAPI route handlers?

Avoid using FastAPI background tasks in route handlers when the task requires strict transactional integrity or complex lifespan management. The Skill identifies these edge cases and suggests safer architectural patterns for production reliability.