FastAPI Router Builder
Create consistent FastAPI CRUD routes with authentication and typed responses.
The skill provides a FastAPI code template without credential theft, covert exfiltration, or malicious behavior, and it shows authentication dependencies. However, list and detail endpoints allow anonymous access by default, ownership enforcement is commented out as optional, the delete endpoint does not actually verify ownership, and there is no sensitive-data guidance, confirmation, rollback, or data-flow disclosure, so points are deducted.
The instructions, template, and reference file are broadly consistent and cover authentication, status codes, pagination, and async-I/O concerns. However, the template depends on unspecified project modules, constructs a service per request without demonstrating lifecycle management, and gives limited abnormal-input, concurrency, exception, and diagnostic-feedback guidance. Static calibration caps this score at 10, so it is scored 8.
The audience and trigger scenarios are reasonably clear for generating CRUD routers in an existing FastAPI project. Input assumptions, non-fit boundaries, project-layout variation, authorization models, and Chinese-language support are not defined; the fixed app-package layout also limits environment fit, so the score is reduced.
The SKILL.md is concise and layered with quick start, a reference file, integration steps, license metadata, and a version field. It lacks dependency installation notes, stable parameter conventions, complete examples, FAQs, known limitations, changelog information, and a clear maintenance/update path. The repository MIT license and official organization provenance help governance evidence but do not fill the skill's documentation gaps.
The template is a useful CRUD starting point with response models, pagination, authentication dependencies, and basic 404 handling. It still requires placeholder replacement plus creation of models, services, router mounting, and frontend functions; ownership protection is incomplete and delete authorization may require revision. Therefore it plausibly completes the core task but is not directly production-ready. Static calibration caps this score at 7, so it is scored 6.
The skill files, template, and capability checklist are auditable, and the repository shows general CI and test infrastructure. The supplied material contains no skill-specific committed tests, real generated-output examples, or third-party execution evidence, so key-path reproduction remains limited. Static calibration caps this score at 5, so it is scored 4.
- The template's claim of required authentication and ownership is inconsistent with its code: update only checks existence, and delete performs no ownership check. Add mandatory authorization according to the application policy before deployment.
- Optional authentication on list and detail endpoints may unintentionally expose resources; explicitly define public versus private semantics and apply least privilege.
- The template assumes fixed app.auth, app.models, and app.services modules plus async service methods; verify project structure, dependency versions, and resource lifetimes before copying.
- Repository-level CI and test material does not demonstrate execution coverage for this specific skill's key paths.
What it does & when to use it
This Python Agent Skill helps developers build REST API routers for FastAPI applications. It covers CRUD operations, optional and required authentication dependencies, response models, and HTTP status codes. It includes a copyable router template with naming placeholders and a sequence for integrating the router into an application. It is useful for standardizing backend endpoints, but it is not a complete FastAPI tutorial or standalone generator.
It instructs developers to copy assets/template.py and replace resource-name placeholders; shape FastAPI routers with CRUD operations, authentication dependencies, response models, and HTTP status codes; place routers in src/backend/app/routers/ and mount them from src/backend/app/main.py; add corresponding Pydantic models, a service layer when needed, and frontend API functions; and choose def or async def according to async I/O usage while managing long-lived resources through lifespan.
- A backend developer needs a standard CRUD router for a new resource in a FastAPI application.
- A team needs endpoints with either optional user context or mandatory authentication dependencies.
- A developer wants GET, POST, and DELETE routes to declare response models and appropriate HTTP status codes.
- A maintainer is adding routes to an existing FastAPI project and needs guidance on router, application, model, and service-layer integration.
Pros & cons
- Covers core router concerns: CRUD operations, authentication dependencies, response models, and common HTTP status codes.
- Provides naming placeholders and concrete integration locations for getting started quickly.
- Explicitly addresses sync versus async handlers and avoiding blocking I/O in async endpoints.
- Licensed under MIT and authored by Microsoft.
- Focuses on router structure rather than providing a complete database, authentication, or service-layer implementation.
- Does not specify supported FastAPI or Pydantic versions.
- The supplied material does not show skill-specific tests or acceptance scenarios.
- Installation is documented for the repository collection, not as a standalone command for this skill.
How to install
Install the repository's skill collection with: npx skills add microsoft/skills. Select the required skill in the wizard; skills are installed into the chosen agent directory, such as .github/skills/ for GitHub Copilot. The source does not provide a separate installation command for this individual skill or commands for installing FastAPI and Pydantic.
How to use
In an Agent Skills-compatible coding agent, try: “Create a FastAPI CRUD router for Project with required authentication, Pydantic response models, and correct HTTP status codes.” The agent should use assets/template.py, replace {{ResourceName}}, {{resource_name}}, and {{resource_plural}}, then follow the documented router mounting and model or service integration steps.