fastapi-endpoint_skill

This skill plans and scaffolds production-ready FastAPI endpoints with async SQLAlchemy, Pydantic v2, DI for auth, and tests.
  • Python

20.6k

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill davila7/claude-code-templates --skill fastapi-endpoint

  • SKILL.md15.2 KB

Overview

This skill helps plan and build production-ready FastAPI endpoints using async SQLAlchemy, Pydantic v2 models, dependency-injected authentication, and pytest tests. It uses an interview-driven planning flow to clarify data models, auth, pagination, and caching before any code is written. The goal is runnable, well-tested endpoints that match existing project patterns.

How this skill works

First, the skill inspects the project structure and existing patterns (app entrypoint, routers, models, auth, and test conventions). Then it runs an interactive interview in rounds to capture the resource shape, HTTP methods, auth and RBAC, pagination, and caching choices. After approval it generates a concrete implementation plan (files, schemas, SQLAlchemy model, CRUD layer, router, dependencies, and tests) and can implement code in the prescribed order.

When to use it

  • Adding new endpoints or CRUD for an existing FastAPI service
  • Creating authenticated endpoints with role or ownership checks
  • Implementing async SQLAlchemy 2.0 queries and cursor pagination
  • Generating Pydantic v2 schemas and response models
  • Producing pytest async tests with database and auth fixtures

Best practices

  • Start in plan mode: examine app entrypoint, routers, models, and test conventions before coding
  • Ask incremental questions (interview rounds) to avoid rework and align on auth, pagination, and caching
  • Prefer cursor-based pagination for large or live datasets; use offset/limit for simple admin pages
  • Use dependency injection for get_db and get_current_user to keep handlers thin and testable
  • Write tests for happy path, auth failures, validation errors, pagination, and not-found cases

Example use cases

  • Add a new /resources CRUD set with cursor pagination and JWT auth to an existing FastAPI app
  • Expose a read-only reports endpoint with Cache-Control headers for clients
  • Create nested endpoints like /users/{id}/orders with ownership checks
  • Implement a small admin API using API key header auth and offset/limit pagination
  • Generate pytest async tests that run against an in-memory or test Postgres DB

FAQ

Yes. The plan phase detects current get_db and auth dependencies and reuses them or proposes minimal adapters.

Which pagination should I choose?

Choose cursor-based for stable ordering and large datasets; offset/limit is fine for small admin UIs or legacy paging.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
fastapi-endpoint skill by davila7/claude-code-templates | VeilStrat