fastapi-project
Scaffold and evolve FastAPI projects with uv-based tooling, structured settings, and production-ready observability, resilience, availability, and security patterns aligned with python.instructions.md.
Best use case
fastapi-project is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Scaffold and evolve FastAPI projects with uv-based tooling, structured settings, and production-ready observability, resilience, availability, and security patterns aligned with python.instructions.md.
Teams using fastapi-project should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/fastapi-project/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How fastapi-project Compares
| Feature / Agent | fastapi-project | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Scaffold and evolve FastAPI projects with uv-based tooling, structured settings, and production-ready observability, resilience, availability, and security patterns aligned with python.instructions.md.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# FastAPI Project Skill 🧩
This skill scaffolds new FastAPI projects or upgrades existing ones with a production-ready layout and operational practices suitable for large systems.
## Scope and alignment 🧭
Mandatory reads (must be loaded before using this skill):
- [Python instructions](../../instructions/python.instructions.md) — use its identifiers when describing compliance.
- [Local-first dev baseline](../../instructions/includes/local-first-dev-baseline.include.md)
- [Quality gates baseline](../../instructions/includes/quality-gates-baseline.include.md)
- [Observability logging baseline](../../instructions/includes/observability-baseline.include.md)
- [AI-assisted change baseline](../../instructions/includes/ai-assisted-change-baseline.include.md)
## Inputs to confirm ✅
- Project name and Python version
- API surface (REST only, GraphQL, or mixed)
- Database (SQLite/PostgreSQL) and cache (Redis/none)
- Background jobs (Celery/Arq/RQ/none) and async worker needs
- Deployment target (container, PaaS, serverless)
- Environment split (local/staging/prod) and secrets strategy
## Quick reference 🧠
| Capability | Purpose | Key Outputs |
| --------------------------- | -------------------------------------------------------------------- | ----------------------------------------------------- |
| Project scaffold | Create a working FastAPI foundation aligned with Python instructions | `pyproject.toml`, `src/` layout, app core, routers |
| Large-system structure | Keep growth manageable with clear boundaries | Domain routers, service layers, adapters |
| Observability baseline | Operational visibility from day one | Structured logs, request IDs, health endpoints |
| Security baseline | Protect data and reduce risk | Secure defaults, auth boundaries, dependency scanning |
| Resilience and availability | Survive failures and scale safely | Timeouts, retries, graceful degradation |
| Quality gates | Enforce fast feedback | `make` targets or uv commands for lint/typecheck/test |
---
## Capabilities 🧰
### 1. Project scaffold (foundation)
Use this for new projects or to align an existing project with the standard layout.
Core requirements:
- Use `pyproject.toml` as the single source of truth. If available, start from [the template](../../instructions/templates/pyproject.toml) and set:
- project metadata (name, version, requires-python)
- dependency groups for dev tooling
- ruff, mypy, pytest configuration
- Use `uv` for deterministic installs and lockfile management.
- Pin Python in `.python-version` and `requires-python`.
- Scaffold with a `src/` layout so imports are explicit and testable.
- Define app settings with `pydantic-settings` and environment variables.
- Keep the ASGI entrypoint thin; wire routers and dependencies in `main.py`.
Recommended layout:
```text
.
├── .python-version
├── pyproject.toml
├── src/
│ ├── app/
│ │ ├── __init__.py
│ │ ├── main.py
│ │ ├── api/
│ │ │ ├── __init__.py
│ │ │ ├── v1/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── routes/
│ │ │ │ └── schemas/
│ │ ├── core/
│ │ │ ├── config.py
│ │ │ ├── logging.py
│ │ │ └── observability.py
│ │ ├── services/
│ │ ├── adapters/
│ │ └── health.py
└── tests/
```
Dependency defaults (adjust to requirements):
- `fastapi`
- `uvicorn` (or `gunicorn` + `uvicorn` workers for production)
- `pydantic-settings`
- `httpx` (for outbound HTTP)
- `pytest`
- `ruff`, `mypy`
### 2. Large-system structure and boundaries
Use these patterns when the system is expected to grow:
- Group routers by domain in `api/v1/routes/<domain>.py`; keep routing thin.
- Put business logic in services; keep I/O inside adapters/selectors.
- Use dependency injection for shared concerns (auth, DB sessions, clients).
- Use explicit schemas at boundaries; avoid leaking ORM models.
- Separate infrastructure wiring (clients, pools) from request handling.
### 3. Observability baseline
Observability is non-negotiable for production workloads:
- Configure structured logging and include required fields from the structured logging baseline.
- Add request ID/correlation ID middleware and propagate IDs into logs.
- Provide health endpoints (`/healthz`, `/readyz`) with clear dependency checks.
- Add optional hooks for metrics and tracing (Prometheus or OpenTelemetry) but keep them toggled by configuration.
- Never log secrets or raw personal data.
### 4. Security baseline
Protect data and enforce secure defaults:
- Load secrets from environment or a secret manager; never commit or log secrets.
- Configure CORS narrowly; never use `*` in production for credentialed routes.
- Enforce authn/authz at router boundaries; keep public vs private APIs explicit.
- Disable or restrict interactive docs in production when required.
- Use dependency pinning and vulnerability scanning; keep lock files updated.
### 5. Resilience and availability baseline
Build for failure and recovery:
- Set explicit timeouts on outbound HTTP/DB calls; never rely on defaults.
- Use retries with bounded backoff and jitter for transient failures; avoid retrying non-idempotent operations without safeguards.
- Use connection pooling and sensible concurrency limits for the ASGI server.
- Provide graceful shutdown and ensure background tasks are interruptible.
- Use caching for hot paths and provide safe fallbacks when caches fail.
### 6. Quality gates and verification
Align with Python quality gates:
- Prefer `make format`, `make lint`, `make typecheck`, `make test` when Makefile targets exist.
- Otherwise use `uv run ruff format .`, `uv run ruff check .`, `uv run mypy .`, `uv run pytest`.
- Add a lightweight ASGI startup check (import app, load settings) before shipping.
---
## Output expectations 📦
When executing this skill, produce:
- A scaffolded FastAPI project or a concrete refactor plan for an existing codebase
- A list of decisions made for observability, security, resilience, and availability
- A short validation checklist using the canonical quality gates
When information is missing, record **Unknown from code – {suggested action}** instead of guessing.
---
> **Version**: 1.0.0
> **Last Amended**: 2026-01-18Related Skills
fastapi-workflow
Docs-first development workflow for Python + FastAPI + Pydantic v2 projects with async APIs, dependency injection, and SQLAlchemy. Fetches current documentation via MCP before any implementation. Use when building or modifying FastAPI backends, API endpoints, Pydantic models, or database operations. Trigger phrases - "fastapi", "python api", "backend api", "pydantic", "sqlalchemy", "async api", "dependency injection". NOT for frontend work (use frontend-app/frontend-lp) or non-Python backends.
fastapi-templates
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
fastapi-sqlmodel-arq-backend
构建或改造基于 FastAPI + SQLModel(异步 SQLAlchemy) + Arq + Redis 的后端系统。用于新增/重构 RESTful API、实现异步数据库访问、编写服务层与依赖注入、配置 OAuth2 + JWT(Argon2) 认证、生成 Alembic 迁移建议、统一 loguru 日志规范等后端任务;不用于纯前端页面样式开发或仅做 OpenAPI 客户端同步的任务。
fastapi-python-expert
Use this agent when you need to design, implement, or optimize FastAPI backend applications. This includes API endpoint creation, database integration, authentication/authorization implementation, cloud deployment strategies, business logic architecture, performance optimization, and following FastAPI best practices.
fastapi-pro
Build high-performance async APIs with FastAPI, SQLAlchemy 2.0, and Pydantic V2. Master microservices, WebSockets, and modern Python async patterns. Use PROACTIVELY for FastAPI development, async optimization, or API architecture.
fastapi-patterns
FastAPI patterns with Pydantic, async operations, and dependency injection
fastapi
FastAPI Python framework. Covers REST APIs, validation, dependencies, security. Keywords: Pydantic, async, OAuth2, JWT.
fastapi-expert
Use when building high-performance async Python APIs with FastAPI and Pydantic V2. Invoke for async SQLAlchemy, JWT authentication, WebSockets, OpenAPI documentation.
fastapi-development
Modern Python API development with FastAPI covering async patterns, Pydantic validation, dependency injection, and production deployment
fastapi-best-practices
FastAPI best practices e convenções baseadas em produção real. Aplicar em todos os projetos FastAPI.
custom-project-standards
Hệ thống tiêu chuẩn dự án đa năng (Standard Platform). Hỗ trợ Frontend, Backend, DevOps với nhiều tùy chọn ngôn ngữ/framework.
create-spring-boot-kotlin-project
Create Spring Boot Kotlin Project Skeleton