Token导航 LogoToken导航

Agent Skill · 前端设计

python-fastapi(Python FastAPI 测试)

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

python-fastapi 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 9,602。

总安装 210周安装 9GitHub Stars 1下载 73核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/karibulab/skills --skill python-fastapi

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

专为 FastAPI 框架开发提供端到端支持。适合路由设计、Pydantic 模型定义与异步处理。自动生成 OpenAPI 文档与测试用例。需明确请求/响应格式与状态码约定。python-fastapi 属于前端设计类 Skill,可作为该场景下的辅助能力补充。生产部署时应配置 HTTPS 与速率限制策略。

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

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

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

常见问题

6 条

python-fastapi 怎么安装?

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

python-fastapi 支持哪些 AI 工具?

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

python-fastapi 需要什么权限?

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

python-fastapi 是免费的吗?

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

python-fastapi 用的人多吗?

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

python-fastapi 安全吗?

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

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

值得选的地方

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

先想清楚的地方

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

适不适合你

更适合

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

不太适合

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

前端设计类 Skill 对比

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

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
python-fastapi

Python FastAPI 测试 · 本页

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

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

SKILL.md 原文

python-fastapi

This skill defines how to build APIs using FastAPI following best practices in architecture, security, maintainability, and performance. This is the minimum acceptable standard.

When to use

Use when you need to build APIs using FastAPI following best practices in architecture, security, maintainability, and performance.

Instructions

1. Core Principles

  1. Secure by default.
  2. Strict typing and strong validation.
  3. Clear separation of concerns.
  4. No business logic inside routers.
  5. Zero hardcoded secrets.
  6. Fail closed, not fail open.

If it "works but is insecure", it does not work.


2. Project Structure

Recommended minimum structure:

app/
 ├── main.py
 ├── api/
 │    ├── deps.py
 │    └── v1/
 │         ├── routes_x.py
 ├── core/
 │    ├── config.py
 │    ├── security.py
 │    └── logging.py
 ├── services/
 ├── repositories/
 ├── models/
 └── schemas/

Rules:

  • api/ → endpoints only.
  • services/ → business logic.
  • repositories/ → data access.
  • schemas/ → Pydantic request/response models.
  • core/ → configuration, security, cross-cutting concerns.

Everything inside main.py is not minimalism. It is chaos.


3. Secure Configuration

3.1 Environment Variables

Use pydantic-settings.

from pydantic_settings import BaseSettings

class Settings(BaseSettings):
    app_name: str
    environment: str
    secret_key: str
    database_url: str
    access_token_expire_minutes: int = 15

    class Config:
        env_file = ".env"

Rules:

  • No default values for secrets.
  • No secrets in the repository.
  • .env files are forbidden in production.

4. Authentication Security

4.1 Never Custom Authentication

Use: - OAuth2 + JWT - Or a trusted identity provider (Auth0, Cognito, Keycloak, etc.)

4.2 Secure JWT

  • Signed with HS256 or RS256.
  • Short expiration time.
  • Validate:

- exp - iss - aud

Never trust the payload without verifying the signature.


5. Endpoint Security

5.1 Dependency Injection for Security

from fastapi import Depends, HTTPException, status

def get_current_user(token: str = Depends(oauth2_scheme)):
    ...

Rules:

  • Every sensitive route must require authentication.
  • Separate authentication from authorization.
  • Implement explicit RBAC or ABAC.

5.2 Strict Validation with Pydantic

Always use models:

class UserCreate(BaseModel):
    email: EmailStr
    password: constr(min_length=12)

Rules:

  • Never accept raw dicts.
  • Avoid Any unless absolutely necessary.
  • Limit string sizes.
  • Validate nested structures.

6. OWASP Top 10 Protection

6.1 Injection

  • Never build SQL queries manually.
  • Use ORM or parameterized queries.
  • Enforce strict typing.

6.2 Excessive Data Exposure

Never return:

  • Password hashes
  • Tokens
  • Internal fields
  • Stack traces

Use explicit response models:

@router.get("/", response_model=UserResponse)

6.3 Error Handling

Do not expose internal errors.

@app.exception_handler(Exception)
async def global_exception_handler(request, exc):
    return JSONResponse(
        status_code=500,
        content={"detail": "Internal server error"},
    )

Log internally. Do not leak details externally.


7. Rate Limiting and Abuse Protection

Implement rate limiting:

  • SlowAPI or equivalent.
  • Or external gateway (NGINX, API Gateway).

Rules: - Never expose login without rate limiting. - Never expose public endpoints without abuse control.


8. Secure CORS

Never:

allow_origins=["*"]
allow_credentials=True

Explicitly configure allowed origins per environment.


9. Secure Logging

  • Do not log passwords.
  • Do not log tokens.
  • Do not log sensitive data.
  • Use structured logging (JSON).
  • Include request_id.

If you feel the need to log the full request body, rethink your architecture.


10. File Upload Security

If uploads are allowed:

  • Enforce size limits.
  • Validate MIME type.
  • Do not trust file extensions.
  • Never execute uploaded content.
  • Store outside public root.

11. Production Hardening

11.1 Server

Never use:

uvicorn main:app --reload

Use:

  • Gunicorn + Uvicorn workers
  • Proper worker configuration
  • Reverse proxy in front

11.2 Security Headers

Add:

  • X-Content-Type-Options
  • X-Frame-Options
  • Content-Security-Policy
  • Strict-Transport-Security

Preferably via middleware or reverse proxy.


12. Mandatory Testing

At minimum:

  • Authentication tests.
  • Authorization tests.
  • Validation tests.
  • Error handling tests.

Testing only the happy path is self-deception.


13. Code Quality Standards

  • Full typing.
  • mypy enabled.
  • ruff or flake8.
  • black mandatory.
  • No logic in decorators.
  • No side effects at import time.

14. What NOT To Do

  • Do not expose /docs in production without authentication.
  • Do not use DEBUG=True.
  • Do not return raw exceptions.
  • Do not trust frontend input.
  • Do not mix sync and async blindly.
  • Never use eval.

15. Pre-Deployment Checklist

  • Environment variables secured
  • Secrets outside repository
  • Rate limiting enabled
  • Restricted CORS
  • Logs free of sensitive data
  • JWT validates signature and expiration
  • Auth tests passing
  • Dependencies updated
  • /docs protected or disabled

If this checklist is not satisfied, it is not a deployment. It is a gamble.

平台分布

Codex

36.6%
按下载量换算27

Claude

27.49%
按下载量换算20

Cursor

20.29%
按下载量换算15

Gemini CLI

8.89%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

接触敏感数据

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

安装前确认

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

继续浏览同类 Skills