Agent skill

FastAPI Project Templates

by wshobson in wshobson/agents

Scaffolds FastAPI projects with a layered app layout, dependency injection through Depends, async handlers and database access, middleware and pytest setup.

MITAuto-check passedBackend & APIs

Install FastAPI Project Templates

skills CLI
$ npx skills add wshobson/agents --skill fastapi-templates -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install wshobson/agents fastapi-templates --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/wshobson/agents.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/api-scaffolding/skills/fastapi-templates .claude/skills/fastapi-templates && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
fastapi-templates
GitHub stars
40k
Used in
11 other repos
Token cost
~901 tokens
SKILL.md length
125 words
Files
2 (incl. references)
Skills in repo
142
Repo updated
First seen
Licence
MIT

At a glance

Scaffolds FastAPI projects with a layered app layout, dependency injection through Depends, async handlers and database access, middleware and pytest setup.

  • Works in 3 steps: Project Structure → Dependency Injection → Async Patterns
  • Starting a new FastAPI service with a sensible folder structure
  • SKILL.md covers When to Use This Skill, Core Concepts, Detailed worked examples and… and Testing
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

The skill gives an agent a recommended directory layout for FastAPI services, with versioned API routes, and explains the framework's built-in dependency injection through `Depends` for database sessions, authentication and authorization, shared business logic and configuration.

Async patterns cover route handlers, database operations, background tasks and middleware, with PostgreSQL and MongoDB named as typical backends. A testing section starts from a `tests/conftest.py` that uses pytest and asyncio. Longer worked examples under an implementation patterns heading live in `references/details.md`.

When your agent uses it

  • Starting a new FastAPI service with a sensible folder structure
  • Wiring database sessions and auth into routes with dependency injection
  • Writing async route handlers and background tasks
  • Setting up pytest fixtures for an async FastAPI app

Example prompts

  • “Scaffold a FastAPI project with v1 routes, a PostgreSQL session dependency and a pytest setup.”
  • “Add an authentication dependency to my FastAPI routes using Depends.”
  • “Convert these synchronous endpoints to async handlers with an async database session.”

Workflow steps

3 steps, taken from the step headings in SKILL.md.

  1. Project Structure
  2. Dependency Injection
  3. Async Patterns

What it can do on your machine

Read from SKILL.md and the folder at commit 46891e7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

FastAPI Project Templates loads about 901 tokens when it runs, and up to ~3.8k if it reads all its reference files. Until then it costs about 54 tokens; SKILL.md has 125 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~54
When it runs · the whole SKILL.md, loaded when a task matches
~901
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from wshobson/agents at commit 46891e7, republished under its MIT licence (© wshobson). 125 words, ~901 tokens.

Download SKILL.mdSave it as .claude/skills/fastapi-templates/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
fastapi-templates
description
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 Project Templates

Production-ready FastAPI project structures with async patterns, dependency injection, middleware, and best practices for building high-performance APIs.

When to Use This Skill

  • Starting new FastAPI projects from scratch
  • Implementing async REST APIs with Python
  • Building high-performance web services and microservices
  • Creating async applications with PostgreSQL, MongoDB
  • Setting up API projects with proper structure and testing

Core Concepts

1. Project Structure

Recommended Layout:

app/
├── api/                    # API routes
│   ├── v1/
│   │   ├── endpoints/
│   │   │   ├── users.py
│   │   │   ├── auth.py
│   │   │   └── items.py
│   │   └── router.py
│   └── dependencies.py     # Shared dependencies
├── core/                   # Core configuration
│   ├── config.py
│   ├── security.py
│   └── database.py
├── models/                 # Database models
│   ├── user.py
│   └── item.py
├── schemas/                # Pydantic schemas
│   ├── user.py
│   └── item.py
├── services/               # Business logic
│   ├── user_service.py
│   └── auth_service.py
├── repositories/           # Data access
│   ├── user_repository.py
│   └── item_repository.py
└── main.py                 # Application entry
2. Dependency Injection

FastAPI's built-in DI system using Depends:

  • Database session management
  • Authentication/authorization
  • Shared business logic
  • Configuration injection
3. Async Patterns

Proper async/await usage:

  • Async route handlers
  • Async database operations
  • Async background tasks
  • Async middleware

Detailed worked examples and patterns

Detailed sections (starting with ## Implementation Patterns) live in references/details.md. Read that file when the navigation summary above is insufficient.

Testing

python
# tests/conftest.py
import pytest
import asyncio
from httpx import AsyncClient
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
from sqlalchemy.orm import sessionmaker

from app.main import app
from app.core.database import get_db, Base

TEST_DATABASE_URL = "sqlite+aiosqlite:///:memory:"

@pytest.fixture(scope="session")
def event_loop():
    loop = asyncio.get_event_loop_policy().new_event_loop()
    yield loop
    loop.close()

@pytest.fixture
async def db_session():
    engine = create_async_engine(TEST_DATABASE_URL, echo=True)
    async with engine.begin() as conn:
        await conn.run_sync(Base.metadata.create_all)

    AsyncSessionLocal = sessionmaker(
        engine, class_=AsyncSession, expire_on_commit=False
    )

    async with AsyncSessionLocal() as session:
        yield session

@pytest.fixture
async def client(db_session):
    async def override_get_db():
        yield db_session

    app.dependency_overrides[get_db] = override_get_db

    async with AsyncClient(app=app, base_url="http://test") as client:
        yield client

# tests/test_users.py
import pytest

@pytest.mark.asyncio
async def test_create_user(client):
    response = await client.post(
        "/api/v1/users/",
        json={
            "email": "test@example.com",
            "password": "testpass123",
            "name": "Test User"
        }
    )
    assert response.status_code == 201
    data = response.json()
    assert data["email"] == "test@example.com"
    assert "id" in data

© wshobson, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in plugins/api-scaffolding/skills/fastapi-templates of wshobson/agents.

  • SKILL.md
  • references/details.md

Open the folder on GitHubat commit 46891e7

Used in 11 other repositories

We found 48 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 11 other GitHub owners. This page covers the copy in wshobson/agents, which our catalogue first saw on October 7, 2026.

Compare with similar skills

FastAPI Project Templates next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

FastAPI Project Templates compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
FastAPI Project Templates this skillwshobson/agents40k11 repos~901Automated safety check: PassMIT
Fastapi Init Skilljiushiwon/wg-skills110—~1.8kAutomated safety check: NotesApache-2.0
FastAPI ExpertJeffallan/claude-skills12k—~1.8kAutomated safety check: PassMIT
Senior Backenddavila7/claude-code-templates32k1 repos~1.1kAutomated safety check: NotesMIT
Python API Endpoint Creatorc0x12c/ai-toolkit106—~764Automated safety check: PassNone
Scaffolding Fastapi Dapraiskillstore/marketplace430—~2.2kAutomated safety check: PassNone

Similar skills

  • Fastapi Init Skill

    jiushiwon/wg-skills

    FastAPI 项目一键初始化技能。面向零基础小白,提供环境探测、自动安装、完整 Web 骨架生成、SSE 流式框架、JWT 鉴权、统一响应封装、文件上传接口、一键启动/重启脚本、Swagger 文档,内置 MySQL(默认)/ PostgreSQL / MongoDB 数据库选择。用户只需说"帮我搭一个 FastAPI 项目"即可一条命令完成从零到跑的完整链路。触发词:"FastAPI…

    110 GitHub stars~1.8k tokensUpdated 3 days ago
    Backend & APIsAuto-check: notes
  • FastAPI Expert

    Jeffallan/claude-skills

    Builds async Python APIs with FastAPI and Pydantic V2, covering endpoints, JWT authentication, async SQLAlchemy, WebSockets and pytest checks against the OpenAPI docs.

    12k GitHub stars~1.8k tokensUpdated 3 days ago
    Backend & APIsAuto-check passed
  • Senior Backend

    davila7/claude-code-templates

    Comprehensive backend development skill for building scalable backend systems using NodeJS, Express, Go, Python, Postgres, GraphQL, REST APIs.

    32k GitHub starsUsed in 1 repo~1.1k tokens
    Backend & APIsAuto-check: notes
  • Creates FastAPI endpoints with layered architecture (Router → Service → Repository).

    106 GitHub stars~764 tokensUpdated 3 mo ago
    Backend & APIsAuto-check passed
  • Scaffolding Fastapi Dapr

    aiskillstore/marketplace

    Build production-grade FastAPI backends with SQLModel, Dapr integration, and JWT authentication.

    430 GitHub stars~2.2k tokensUpdated today
    Backend & APIsAuto-check passed
  • Fastcrud

    benavlabs/fastcrud

    A skill your agent uses when building or modifying CRUD endpoints with FastCRUD (the fastcrud PyPI package) in a FastAPI project — covers FastCRUD, crudrouter, EndpointCreator, FilterConfig…

    1.6k GitHub stars~5k tokensUpdated 12 days ago
    Backend & APIsAuto-check passed

More from wshobson/agents

All 142 skills in this repo
  • Cuts cloud spend across AWS, Azure, GCP and OCI with cost tagging, rightsizing, commitment and spot pricing models, and architecture changes.

    40k GitHub starsUsed in 13 repos~1.7k tokens
    Auto-check passed
  • Billing Automation

    wshobson/agents

    Covers building subscription billing: billing cycles, subscription states, invoice generation, proration, tax handling and dunning for failed payments.

    40k GitHub starsUsed in 12 repos~473 tokens
    Auto-check passed
  • Profiles slow Python code with cProfile and memory profilers, then applies targeted fixes for CPU, memory, I/O and query bottlenecks.

    40k GitHub starsUsed in 12 repos~814 tokens
    Auto-check passed
  • Portfolio Risk Metrics

    wshobson/agents

    Covers portfolio risk measurement with VaR, CVaR, Sharpe, Sortino and drawdown, plus guidance on limits, stress tests and tail risk.

    40k GitHub starsUsed in 12 repos~502 tokens
    Auto-check passed
  • Plans memory headroom, works through out-of-memory failures and watches temperature and power during long ML training jobs on NVIDIA DGX Spark.

    40k GitHub starsUsed in 1 repo~2k tokens
    Auto-check passed
  • Writes unit tests for shell scripts with Bats: error-condition tests, fixtures and mocks, cross-shell checks, parallel runs, helper files and CI integration.

    40k GitHub starsUsed in 11 repos~1.3k tokens
    Auto-check passed

Categories

Questions about FastAPI Project Templates

What does FastAPI Project Templates do?

Scaffolds FastAPI projects with a layered app layout, dependency injection through Depends, async handlers and database access, middleware and pytest setup. The skill gives an agent a recommended directory layout for FastAPI services, with versioned API routes, and explains the framework's built-in dependency injection through `Depends` for database sessions, authentication and authorization, shared business logic and configuration.

When should I use FastAPI Project Templates?

FastAPI Project Templates fits situations like: starting a new FastAPI service with a sensible folder structure; wiring database sessions and auth into routes with dependency injection; writing async route handlers and background tasks; setting up pytest fixtures for an async FastAPI app.

How do I install FastAPI Project Templates in Claude Code?

Run `npx skills add wshobson/agents --skill fastapi-templates -a claude-code`. Or copy the skill folder (plugins/api-scaffolding/skills/fastapi-templates in wshobson/agents) into .claude/skills/fastapi-templates in your project. Claude Code loads it when a task matches its description.

How do I install FastAPI Project Templates in Codex?

Run `npx skills add wshobson/agents --skill fastapi-templates -a codex`. Or copy the skill folder (plugins/api-scaffolding/skills/fastapi-templates in wshobson/agents) into .agents/skills/fastapi-templates in your project. Codex loads it when a task matches its description.

Can I use FastAPI Project Templates in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add wshobson/agents --skill fastapi-templates -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/fastapi-templates, .gemini/skills/fastapi-templates, .github/skills/fastapi-templates and .opencode/skills/fastapi-templates in your project.

What does FastAPI Project Templates need to run?

SKILL.md names no scripts, command-line tools or credentials: FastAPI Project Templates is instructions for the agent only.

Does FastAPI Project Templates access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is FastAPI Project Templates safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does FastAPI Project Templates use?

FastAPI Project Templates is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does FastAPI Project Templates use?

About 901 tokens (SKILL.md is roughly 3.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 2.9k tokens, read only when the agent opens those files.

What are the alternatives to FastAPI Project Templates?

Skills that share tags, products or a category with FastAPI Project Templates: Fastapi Init Skill (jiushiwon/wg-skills, 110 stars), FastAPI Expert (Jeffallan/claude-skills, 12k stars), Senior Backend (davila7/claude-code-templates, 32k stars) and Python API Endpoint Creator (c0x12c/ai-toolkit, 106 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains FastAPI Project Templates?

wshobson (a GitHub user) maintains it in wshobson/agents, which has 40,254 GitHub stars. The repository holds 142 skills in this directory. The repository was last updated on October 5, 2026.

Source: wshobson/agents on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.