fastapi

Solid

Use when building APIs with FastAPI. Covers dependency injection, Pydantic v2 validation, async database access, authentication, background tasks, and testing.

API & Backend 23 stars 2 forks Updated today MIT

Install

View on GitHub

Quality Score: 84/100

Stars 20%
46
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# FastAPI ## Purpose Build FastAPI services that use the framework's strengths — declarative validation and dependency injection — without falling into its two standard traps: blocking calls inside `async def`, and business logic in the route handler. ## When to Use - Building or reviewing a FastAPI application. - Structuring dependencies, authentication, and database sessions. - Diagnosing latency that appears only under concurrency. - Writing tests for FastAPI endpoints. ## Capabilities - Route and router organization. - Pydantic v2 models for request, response, and settings. - Dependency injection with scoped lifecycles. - Async SQLAlchemy sessions, correctly scoped per request. - Authentication and authorization dependencies. - Testing with `httpx.AsyncClient` and dependency overrides. ## Inputs - The API contract and the data layer. - Whether the workload is I/O-bound (nearly always) or CPU-bound. ## Outputs - Thin route handlers delegating to service functions. - Response models that control exactly what is serialized. - A test suite that overrides dependencies rather than mocking internals. ## Workflow 1. **Define the schemas** — Separate request, response, and internal models. Never return an ORM object directly; a `response_model` is your defense against leaking a password hash. 2. **Build the dependencies** — Database session, current user, feature flags. These are the injection points that make the app testable. 3. **Keep handlers thin** — Parse, author...

Details

Author
nimadorostkar
Repository
nimadorostkar/Claude-Skills-collection
Created
1 weeks ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category