一键导入
fastapi-patterns
FastAPI core patterns for routes, dependency injection, async, auth, and OpenAPI. Use when working on projects with fastapi in their dependencies.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
FastAPI core patterns for routes, dependency injection, async, auth, and OpenAPI. Use when working on projects with fastapi in their dependencies.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Configure which review agents and workflow skills run for a project by auto-detecting the Python stack and writing py-micro-superpowers.local.md. Use when setting up the plugin in a new project or reconfiguring review agents and workflow skills.
Build applications where agents are first-class citizens. Use this skill when designing autonomous agents, creating MCP tools, implementing self-modifying systems, or building apps where features are outcomes achieved by agents operating in a loop.
Implement async task queues with Celery and real-time WebSocket support with Django Channels. Use when a Django project includes celery or channels in its dependencies, or when implementing background processing, periodic tasks, WebSocket connections, or real-time features.
Django REST Framework patterns for serializers, viewsets, routers, permissions, and authentication. Use when building or reviewing projects with djangorestframework in dependencies.
Django core patterns for models, views, admin, signals, middleware, and Django Ninja APIs. Use when working on projects with django in their dependencies.
Refines brainstorm or plan documents through structured review before proceeding to the next workflow step. Use when a brainstorm or plan document exists and needs improvement.
| name | fastapi-patterns |
| description | FastAPI core patterns for routes, dependency injection, async, auth, and OpenAPI. Use when working on projects with fastapi in their dependencies. |
| model | haiku |
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