Token导航 LogoToken导航TokenDH.com
开发需要联网github未标认证来源可访问许可证需确认审计通过

fastapiFastAPI 开发

Agent Skill

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

总安装

847

周安装

36

GitHub Stars

4

下载量

297
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/eyadsibai/ltk --skill FastAPI

简介

fastapi 用于辅助 Python 项目开发、测试、依赖管理和常见框架工作流。

  • 适合让 Agent 阅读 Python 代码、定位测试问题、整理运行命令、生成脚本或分析数据处理逻辑。
  • 使用时需要确认项目虚拟环境、依赖版本和测试入口。
  • 涉及执行脚本、读写文件、访问数据库或调用外部 API 时,应先明确运行目录和输入输出范围。
  • fastapi 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

FastAPI Development

Guidance for building APIs with FastAPI following best practices.


Core Concepts

Route Decorators

DecoratorHTTP MethodUse Case
@app.get()GETRetrieve data
@app.post()POSTCreate resource
@app.put()PUTFull update
@app.patch()PATCHPartial update
@app.delete()DELETERemove resource

Response Status Codes

CodeMeaningWhen to Use
200OKSuccessful GET/PUT/PATCH
201CreatedSuccessful POST
204No ContentSuccessful DELETE
400Bad RequestInvalid input
401UnauthorizedAuthentication required
403ForbiddenNo permission
404Not FoundResource doesn't exist
422UnprocessableValidation failed

Dependency Injection

Key concept: Dependencies are functions that FastAPI calls before your route handler. Use yield for cleanup logic.

PatternUse Case
Simple functionGet config, compute values
Generator (yield)Database sessions, connections
Class-basedComplex dependencies with state
Nested dependenciesDependencies that depend on other dependencies

Common Dependencies

DependencyPurpose
get_dbDatabase session (yield for cleanup)
get_current_userAuthentication + user retrieval
get_settingsConfiguration singleton
rate_limiterRequest throttling

Key concept: Use Annotated[Type, Depends(func)] for cleaner type hints and reusability.


Pydantic Models

Model Patterns

PatternPurpose
Base modelShared fields
Create modelInput for POST (no id)
Update modelPartial updates (all Optional)
Response modelOutput (includes id, timestamps)
DB modelInternal with from_attributes = True

Validation Features

FeaturePurpose
Field(...)Required with constraints
Field(default=...)Optional with default
field_validatorCustom validation logic
model_validatorCross-field validation
pattern=Regex validation
ge=, le=Numeric bounds
min_length=, max_length=String/list length

Error Handling

ApproachUse Case
HTTPExceptionSimple errors with status code
Custom exception classStructured error responses
@app.exception_handlerGlobal error handling
RequestValidationErrorCustomize validation errors

Key concept: Create custom exception classes for consistent error response format across your API.


Router Organization

ConceptPurpose
APIRouterGroup related endpoints
prefixURL prefix for all routes
tagsOpenAPI documentation grouping
dependenciesRouter-level dependencies

Project Structure

DirectoryContents
routers/Route handlers by domain
models/SQLAlchemy/database models
schemas/Pydantic request/response models
services/Business logic
dependencies.pyShared dependencies
config.pySettings and configuration

Background Tasks

MethodUse Case
BackgroundTasksSimple async tasks (email, logging)
CeleryHeavy tasks, retries, scheduling
ARQAsync Redis queue

Key concept: BackgroundTasks run after response is sent—good for non-critical operations that shouldn't block the response.


Testing Patterns

ClientUse Case
TestClientSync tests (most common)
AsyncClient (httpx)Async tests, lifespan events

Dependency Override Pattern

  1. Create test version of dependency
  2. Set app.dependency_overrides[original] = test_version
  3. Run tests
  4. Clear overrides after

Key concept: Override get_db for test database, get_current_user for auth bypass.


Best Practices

PracticeWhy
Use response_modelControl output, hide internal fields
Use dependency injectionTestable, reusable code
Separate schemas from DB modelsDecouple API from database
Use routers for organizationMaintainable as API grows
Add OpenAPI descriptionsSelf-documenting API
Use async for I/OBetter concurrency

Resources

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.62%
按下载量换算103

Claude

29.38%
按下载量换算87

Cursor

19.73%
按下载量换算59

Gemini CLI

9.75%
按下载量换算29

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

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

来源信息

继续浏览同类 Skills