Token导航 LogoToken导航

Agent Skill · 运维和基础设施

fastapi-project-structure(FastAPI project structure 测试)

用于辅助 Python 项目开发、测试、依赖管理和常见框架工作流。它适合让 Agent 阅读 Python 代码、定位测试问题、整理运行命令、生成脚本或分析数据处理逻辑。使用时需要确认项目虚拟环境、依赖版本和测试入口;涉及执行脚本、读写文件、访问数据库或调用外部 API 时,应先明确运行目录和输入输出范围,避免误改生产数据。

fastapi-project-structure 是运维和基础设施类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描已通过,按安装量在运维和基础设施类的 2,449 个 Skill 里排第 2,346。

总安装 196周安装 8GitHub Stars 10下载 63核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:fastapi-project-structure(FastAPI project structure 测试)
来源仓库:https://github.com/vanman2024/ai-dev-marketplace
仓库路径:skills/fastapi-project-structure
安装命令:
npx skills add https://github.com/vanman2024/ai-dev-marketplace --skill fastapi-project-structure
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/vanman2024/ai-dev-marketplace --skill fastapi-project-structure

这个 Skill 是做什么的

运维和基础设施类 Skill 处理部署、监控、日志和云资源,多数需要较高的执行权限。

提供标准化的 FastAPI 项目脚手架与目录结构设计。支持 minimal、standard、MCP 集成等多种模板选择。包含环境变量管理、配置分层和测试隔离方案。通过 GitHub 安装,适用于新项目快速启动。可根据团队规模灵活裁剪模块复杂度。

fastapi-project-structure 属于运维和基础设施类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/fastapi-project-structure

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/vanman2024/ai-dev-marketplace --skill fastapi-…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

fastapi-project-structure 怎么安装?

在终端执行 npx skills add https://github.com/vanman2024/ai-dev-marketplace --skill fastapi-project-st…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

fastapi-project-structure 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

fastapi-project-structure 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

fastapi-project-structure 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

fastapi-project-structure 用的人多吗?

公开数据是累计安装 196 次,近一周安装 8 次,下载 63 次,GitHub 10 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

fastapi-project-structure 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理运维和基础设施类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

运维和基础设施类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
brainstorming

头脑风暴 · Codex、Claude

3,148,776173,131操作浏览器MIT通过
copywriting

文案写作 · Codex、Claude

1,996,72425,583需要联网MIT通过
openclaw-secure-linux-cloud

OpenClaw secure linux cloud 命令行 · Codex、Claude

1,853,08840接触敏感数据未明确未通过
xget

xget 命令行 · Codex、Claude

1,799,28040执行命令未明确未通过
requesting-code-review

代码审查请求 · Codex、Claude

1,590,144173,103权限未标注MIT通过
fastapi-project-structure

FastAPI project structure 测试 · 本页

19610接触敏感数据未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

FastAPI Project Structure Skill

Production-ready FastAPI project scaffolding templates and best practices for building scalable, maintainable backend applications with MCP integration support.

Instructions

1. Choose Project Template

Select the appropriate project template based on your use case:

  • minimal: Basic FastAPI app structure (single file, quick prototypes)
  • standard: Standard production structure (API routes, models, services)
  • mcp-server: FastAPI app with MCP server integration
  • full-stack: Complete backend with auth, database, background tasks
  • microservice: Microservice-ready structure with health checks, metrics

2. Generate Project Structure

Use the setup script to scaffold a new FastAPI project:

cd /home/gotime2022/.claude/plugins/marketplaces/ai-dev-marketplace/plugins/fastapi-backend/skills/fastapi-project-structure
./scripts/setup-project.sh <project-name> <template-type>

Template types: minimal, standard, mcp-server, full-stack, microservice

Example:

./scripts/setup-project.sh my-api-service standard

What This Creates:

  • Complete directory structure
  • Configuration files (pyproject.toml,.env.example)
  • Main application entry point
  • Settings management system
  • Docker configuration (for production templates)
  • README with setup instructions

3. Configure Application Settings

The skill uses Pydantic Settings for configuration management:

Settings Structure:

# app/core/config.py
from pydantic_settings import BaseSettings

class Settings(BaseSettings):
    # App Configuration
    PROJECT_NAME: str = "FastAPI App"
    VERSION: str = "1.0.0"
    DEBUG: bool = False

    # Server Configuration
    HOST: str = "0.0.0.0"
    PORT: int = 8000

    # Database Configuration (if needed)
    DATABASE_URL: str

    # Security
    SECRET_KEY: str
    ALLOWED_ORIGINS: list[str] = ["*"]

    class Config:
        env_file = ".env"
        case_sensitive = True

Environment Variables: Copy .env.example to .env and customize:

cp .env.example .env
# Edit .env with your configuration

4. Project Structure Patterns

Standard Structure
my-api-service/
├── app/
│   ├── __init__.py
│   ├── main.py              # Application entry point
│   ├── core/
│   │   ├── __init__.py
│   │   ├── config.py        # Settings management
│   │   └── dependencies.py  # Dependency injection
│   ├── api/
│   │   ├── __init__.py
│   │   ├── routes/          # API route handlers
│   │   │   ├── __init__.py
│   │   │   ├── health.py
│   │   │   └── users.py
│   │   └── deps.py          # Route dependencies
│   ├── models/              # Pydantic models
│   │   ├── __init__.py
│   │   └── user.py
│   ├── schemas/             # Request/Response schemas
│   │   ├── __init__.py
│   │   └── user.py
│   └── services/            # Business logic
│       ├── __init__.py
│       └── user_service.py
├── tests/
│   ├── __init__.py
│   ├── conftest.py
│   └── test_api/
├── .env.example
├── .gitignore
├── pyproject.toml
├── README.md
└── Dockerfile (optional)
MCP Server Integration Structure
my-mcp-api/
├── app/
│   ├── main.py              # FastAPI + MCP server
│   ├── core/
│   │   ├── config.py
│   │   └── mcp_config.py    # MCP-specific settings
│   ├── api/
│   │   └── routes/
│   ├── mcp/
│   │   ├── __init__.py
│   │   ├── server.py        # MCP server instance
│   │   ├── tools/           # MCP tools
│   │   ├── resources/       # MCP resources
│   │   └── prompts/         # MCP prompts
│   └── services/
├── .mcp.json                # MCP configuration
├── pyproject.toml
└── README.md

5. Validate Project Structure

Run validation to ensure proper structure and dependencies:

./scripts/validate-structure.sh <project-directory>

Validation Checks:

  • Directory structure compliance
  • Required files present (main.py, config.py, pyproject.toml)
  • Python syntax validation
  • Dependency declarations
  • Environment variable configuration
  • Import structure validity
  • Type hints presence

6. Development Setup

Initialize the development environment:

# Navigate to project
cd <project-name>

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -e ".[dev]"

# Run development server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

7. MCP Server Integration (Optional)

For projects with MCP server support:

# Configure MCP settings
cp templates/mcp-config-template.json .mcp.json

# Edit MCP configuration
# Add tools, resources, and prompts

# Run as MCP server (STDIO mode)
python -m app.main --mcp

# Run as HTTP server
uvicorn app.main:app --host 0.0.0.0 --port 8000

Available Templates

Core Templates

  • pyproject.toml: Modern Python project configuration with dependencies
  • main.py: Application entry point with FastAPI initialization
  • config.py: Pydantic Settings-based configuration management
  • dependencies.py: Dependency injection patterns
  • health.py: Health check endpoints with database/service checks
  • docker-template: Multi-stage Docker build for production
  • nginx-template: Nginx reverse proxy configuration

MCP Integration Templates

  • mcp-server.py: MCP server initialization with FastAPI
  • mcp-tool-template.py: MCP tool implementation pattern
  • mcp-resource-template.py: MCP resource pattern
  • mcp-config.json: MCP server configuration

Settings & Configuration

  • .env.example: Environment variables template
  • settings-dev.py: Development-specific settings
  • settings-prod.py: Production-specific settings
  • logging-config.yaml: Structured logging configuration

Key Features

Settings Management

  • Pydantic-based type-safe configuration
  • Environment-specific settings (dev, staging, prod)
  • Automatic validation and type conversion
  • Secret management with environment variables
  • Nested configuration support

Dependency Injection

  • FastAPI's built-in DI system
  • Reusable dependencies for auth, database, services
  • Request-scoped and application-scoped dependencies
  • Easy testing with dependency overrides

Project Organization

  • Clear separation of concerns (routes, models, services)
  • Scalable directory structure
  • Consistent naming conventions
  • Module-based organization for large projects

MCP Integration

  • Dual-mode operation (HTTP + MCP STDIO)
  • MCP tools, resources, and prompts
  • Configuration management via.mcp.json
  • FastMCP framework compatibility

Production-Ready

  • Docker multi-stage builds
  • Health check endpoints
  • Structured logging
  • Error handling middleware
  • CORS configuration
  • Security headers

Examples

See the examples directory for:

  • minimal-api/: Simple FastAPI application
  • crud-api/: Complete CRUD API with database
  • mcp-integrated-api/: FastAPI + MCP server
  • microservice-template/: Production microservice
  • auth-api/: API with JWT authentication

Configuration Files Generated

pyproject.toml

[project]
name = "my-api-service"
version = "1.0.0"
description = "FastAPI application"
requires-python = ">=3.11"
dependencies = [
    "fastapi>=0.115.0",
    "uvicorn[standard]>=0.32.0",
    "pydantic>=2.0.0",
    "pydantic-settings>=2.0.0",
]

[project.optional-dependencies]
dev = [
    "pytest>=8.0.0",
    "pytest-asyncio>=0.24.0",
    "httpx>=0.27.0",
    "ruff>=0.6.0",
    "mypy>=1.11.0",
]
mcp = [
    "mcp>=1.0.0",
]

[tool.ruff]
line-length = 100
target-version = "py311"

[tool.mypy]
python_version = "3.11"
strict = true

main.py (Standard Template)

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.core.config import settings
from app.api.routes import health, users

app = FastAPI(
    title=settings.PROJECT_NAME,
    version=settings.VERSION,
    debug=settings.DEBUG,
)

# CORS
app.add_middleware(
    CORSMiddleware,
    allow_origins=settings.ALLOWED_ORIGINS,
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

# Include routers
app.include_router(health.router, prefix="/health", tags=["health"])
app.include_router(users.router, prefix="/api/v1/users", tags=["users"])

@app.get("/")
async def root():
    return {"message": f"Welcome to {settings.PROJECT_NAME}"}

Dockerfile (Production Template)

FROM python:3.11-slim as builder
WORKDIR /app
COPY pyproject.toml .
RUN pip install --no-cache-dir build && \
    python -m build --wheel

FROM python:3.11-slim
WORKDIR /app
COPY --from=builder /app/dist/*.whl .
RUN pip install --no-cache-dir *.whl && rm *.whl
COPY app/ ./app/
EXPOSE 8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]

Best Practices

Project Structure:

  1. Keep business logic in services, not routes
  2. Use schemas for request/response validation
  3. Separate models (DB) from schemas (API)
  4. Implement dependency injection for services
  5. Use async/await for I/O-bound operations

Configuration:

  1. Never commit secrets (.env in.gitignore)
  2. Use Pydantic Settings for type safety
  3. Separate dev/staging/prod configurations
  4. Validate all environment variables at startup
  5. Document required environment variables in.env.example

Code Organization:

  1. One router per resource (users.py, posts.py)
  2. Group related endpoints in routers
  3. Keep route handlers thin (delegate to services)
  4. Use consistent naming conventions
  5. Type-hint all function parameters and returns

Testing:

  1. Use TestClient for API testing
  2. Override dependencies for mocking
  3. Separate unit and integration tests
  4. Use fixtures for common test data
  5. Test both success and error cases

Security:

  1. Validate all inputs with Pydantic
  2. Implement proper CORS configuration
  3. Use environment variables for secrets
  4. Enable security headers middleware
  5. Implement rate limiting for public APIs

Performance:

  1. Use async route handlers for I/O
  2. Implement connection pooling for databases
  3. Add response caching where appropriate
  4. Use background tasks for non-critical operations
  5. Monitor with health check endpoints

Common Workflows

Creating a New API Endpoint

# 1. Generate project structure
./scripts/setup-project.sh my-api standard

# 2. Add new route file
# Create app/api/routes/items.py

# 3. Add schemas
# Create app/schemas/item.py

# 4. Add service logic
# Create app/services/item_service.py

# 5. Register router in main.py
# app.include_router(items.router, prefix="/api/v1/items")

Setting Up MCP Integration

# 1. Generate MCP-enabled project
./scripts/setup-project.sh my-mcp-api mcp-server

# 2. Configure .mcp.json
cp templates/mcp-config-template.json my-mcp-api/.mcp.json

# 3. Add MCP tools
# Copy from templates/mcp-tool-template.py to app/mcp/tools/

# 4. Run in MCP mode
cd my-mcp-api
python -m app.main --mcp

Production Deployment

# 1. Build Docker image
docker build -t my-api:latest .

# 2. Run container
docker run -d -p 8000:8000 \
  --env-file .env.prod \
  --name my-api \
  my-api:latest

# 3. Health check
curl http://localhost:8000/health

Troubleshooting

Import errors: Ensure virtual environment is activated and dependencies installed

Port already in use: Change PORT in.env or use different port with --port flag

Environment variables not loading: Check.env file location and syntax, ensure pydantic-settings installed

MCP server not starting: Verify.mcp.json configuration and mcp package installed

Type checking errors: Run mypy app/ to see detailed type errors, ensure all dependencies have type stubs


Plugin: fastapi-backend Version: 1.0.0 Category: Project Structure & Scaffolding Skill Type: Templates & Automation

平台分布

Codex

35.54%
按下载量换算22

Claude

34.08%
按下载量换算21

Cursor

18.48%
按下载量换算12

Gemini CLI

8.96%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills