home / skills / feiwanghub / playground / fastapi-templates-skill

fastapi-templates-skill skill

/skills/.trae/skills/fastapi-templates-skill

This skill quickly scaffolds a boilerplate FastAPI project with main.py, requirements, and README, including hello world and item endpoints.

npx playbooks add skill feiwanghub/playground --skill fastapi-templates-skill

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
530 B
---
name: fastapi-templates-skill
description: "Scaffold new FastAPI projects with standard directory structure and configuration."
---

# FastAPI Templates Skill

This skill allows you to quickly generate a boilerplate FastAPI project.

## Capabilities

- Create a new directory with `main.py`, `requirements.txt`, and `README.md`.
- Includes a basic "Hello World" endpoint and item lookup endpoint.

## Usage

Create a new project:

```bash
python3 .shared/fastapi-templates-skill/scripts/create_fastapi.py "my-api-project"
```

Overview

This skill scaffolds a new FastAPI project with a standard, production-ready directory layout and basic configuration files. It generates an entry point, dependency list, and documentation stub so you can start building API endpoints immediately. The output is minimal and focused on common FastAPI patterns to reduce repetitive setup work.

How this skill works

Running the provided script creates a project folder containing main.py with a Hello World endpoint and an item lookup endpoint, a requirements.txt listing core dependencies, and a README.md with quick start instructions. The scaffold follows a simple, extensible structure so you can add routers, models, and tests without reworking the layout. Generated files are plain text and easy to customize to your team’s conventions.

When to use it

  • Starting a new FastAPI microservice or prototype quickly
  • Onboarding new developers with a consistent project template
  • Creating reproducible demo projects or tutorials
  • Standardizing basic project files across multiple APIs
  • Saving time on repetitive project initialization tasks

Best practices

  • Rename and adapt the scaffolded main.py to match your app’s package structure before adding many routes
  • Pin dependency versions in requirements.txt for reproducible builds
  • Add CI/CD and test scaffolding early to prevent diverging project setups
  • Organize larger projects into app, api, and models subpackages from the start
  • Use virtual environments and document setup steps in the README

Example use cases

  • Generate a new API called my-api-project to demonstrate endpoint patterns in a workshop
  • Bootstrap a small internal microservice that exposes a few REST endpoints
  • Create a sample app for a technical blog post showing FastAPI basics
  • Quickly produce a consistent project baseline for a multi-team API onboarding
  • Build a prototype to validate API design before investing in full architecture

FAQ

What files does the scaffold create?

It creates main.py with example endpoints, requirements.txt, and README.md in a new project folder.

How do I run the generated app?

Install dependencies from requirements.txt in a virtual environment and run the app with Uvicorn, e.g., uvicorn main:app --reload.