Skip to content
cccskills
FreePublished on GitHub

fastapi-python

Build Python APIs with FastAPI using clear routes, validated inputs, and consistent error handling. It guides asynchronous database and API calls, reusable dependencies, caching, and code organization to support readable implementations and responsive services.

OriginalShow the original description

Expert in FastAPI Python development with best practices for APIs and async operations

See how to install

Good for

  • Designing API routes and input validation
  • Reviewing asynchronous database and API calls
  • Organizing error handling and logging
  • Improving response performance with caching

Files included (1)

  • SKILL.md2.4 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

FastAPI Python

You are an expert in FastAPI and Python backend development.

Key Principles

  • Write concise, technical responses with accurate Python examples
  • Favor functional, declarative programming over class-based approaches
  • Prioritize modularization to eliminate code duplication
  • Use descriptive variable names with auxiliary verbs (e.g., is_active, has_permission)
  • Employ lowercase with underscores for file/directory naming (e.g., routers/user_routes.py)
  • Export routes and utilities explicitly
  • Follow the RORO (Receive an Object, Return an Object) pattern

Python/FastAPI Standards

  • Use def for pure functions, async def for asynchronous operations
  • Use type hints for all function signatures. Prefer Pydantic models over raw dictionaries
  • Structure: exported router, sub-routes, utilities, static content, types (models, schemas)
  • Use ordinary Python control flow; prefer readability over compressed one-line conditionals

Error Handling

  • Handle edge cases at function entry points
  • Employ early returns for error conditions
  • Place happy path logic last
  • Avoid unnecessary else statements; use if-return patterns
  • Implement guard clauses for preconditions
  • Provide proper error logging and user-friendly messaging

FastAPI-Specific Guidelines

  • Use functional components (plain functions) and Pydantic models for input validation
  • Declare routes with clear return type annotations
  • Prefer lifespan context managers for managing startup and shutdown events
  • Leverage middleware for logging, error monitoring, and optimization
  • Use HTTPException for expected errors and model them as specific HTTP responses
  • Apply Pydantic's BaseModel consistently for validation

Performance Optimization

  • Minimize blocking I/O. In async def handlers, use awaitable database/API clients; put synchronous SQLite or other blocking work in synchronous routes or explicitly offload it
  • Implement caching with Redis or in-memory stores
  • Optimize Pydantic serialization/deserialization
  • Use lazy loading for large datasets

Key Conventions

  1. Rely on FastAPI's dependency injection system
  2. Prioritize API performance metrics (response time, latency, throughput)
  3. Structure routes and dependencies for readability and maintainability

Dependencies

FastAPI, Pydantic v2, asyncpg/aiomysql, SQLAlchemy 2.0

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

vite

FreeSummary

Set up and refine web projects with Vite, a tool for running development servers and building production files. It covers framework integration, environment settings, live code updates, testing configuration, and splitting code to improve loading.

  • Setting up React, Vue, or Svelte projects
  • Configuring environment variables and API proxies
  • Splitting production code into smaller files
debpalash/VoiceStudio75.2KUpdated Oct 18, 2026

voicestudio

FreeSummary

Connect agents and automated workflows to VoiceStudio to generate speech with saved or designed voices, transcribe recordings, create subtitles, and manage dubbing or narration. It uses the running backend and checks available models and capabilities.

  • Generating narration with a saved voice
  • Transcribing recordings and creating subtitles
  • Managing dubbing while preserving timing and background audio
debpalash/VoiceStudio75.2KUpdated Oct 18, 2026

Maintain VoiceStudio by investigating reported bugs, reviewing contributed changes, diagnosing automated check failures, and preparing requested releases. It guides focused fixes, testing, and packaging verification for the Electron app and Python backend.

  • Investigating reported VoiceStudio bugs
  • Reviewing contributor pull requests
  • Diagnosing automated check failures
debpalash/VoiceStudio75.2KUpdated Oct 18, 2026

See all skills by debpalash

Report a problem with this skill