From compound-engineering-feat-python
FastAPI core patterns for routes, dependency injection, async, auth, and OpenAPI. Use when working on projects with fastapi in their dependencies.
npx claudepluginhub weorbitant/compound-engineering-feat-python-plugin --plugin compound-engineering-feat-pythonThis skill uses the workspace's default tool permissions.
Patterns and conventions for building FastAPI applications. Follow the principle of
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Designs and optimizes AI agent action spaces, tool definitions, observation formats, error recovery, and context for higher task completion rates.
Patterns and conventions for building FastAPI applications. Follow the principle of explicit dependency injection, leverage async where it matters, and use Pydantic models as the single source of truth for request/response schemas.
Depends() for database sessions, auth,
config, and shared logic instead of global state or importsasync def for I/O-bound routes with async drivers;
use plain def for CPU-bound or sync-only codeAPIRouter modules by domain, compose them
in the main app with prefixes and tagsApply these patterns when working on any project that lists fastapi in its dependencies.
Detect this by checking pyproject.toml, requirements.txt, or Pipfile for FastAPI.
Use | None instead of Optional for all type annotations:
from fastapi import Query
async def list_items(
category: str | None = Query(None, description="Filter by category"),
) -> list[ItemResponse]:
...
Use emojis as prefixes in log messages:
logger.info("✅ Request processed for %s", endpoint)
logger.warning("⚠️ Rate limit approaching for client %s", client_id)
logger.error("❌ Failed to connect to database: %s", exc)
src/
├── main.py # App factory, lifespan, router composition
├── config.py # Settings with pydantic-settings
├── dependencies.py # Shared dependencies (DB session, current user)
├── routes/
│ ├── __init__.py
│ ├── users.py # APIRouter for user endpoints
│ └── items.py # APIRouter for item endpoints
├── models/ # SQLAlchemy or ORM models
├── schemas/ # Pydantic request/response models
├── services/ # Business logic layer
└── middleware/ # Custom middleware