Token导航 LogoToken导航TokenDH.com
研究检索需要联网clawhub未标认证来源可访问clear审计通过

fastapi-code-reviewFastAPI 代码审查

Agent Skill

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

总安装

6,610

周安装

270

GitHub Stars

公开资料未说明

下载量

2,117
OpenClaw

安装说明

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

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

ClawHubOpenClaw
openclaw skills install fastapi-code-review

简介

fastapi-code-review 用于检查 FastAPI 路由、依赖注入和异步处理逻辑。

  • 适合审核 APIRouter 配置和数据验证实现。
  • 可识别依赖项生命周期和异常处理问题。fastapi-code-review 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 使用前需确认项目是否使用 FastAPI 框架。
  • 建议区分开发和生产环境的依赖版本差异。

SKILL.md

name
fastapi-code-review
description
Reviews FastAPI code for routing patterns, dependency injection, validation, and async handlers. Use when reviewing FastAPI apps, checking APIRouter setup, Depends() usage, or response models.

FastAPI Code Review

Quick Reference

Issue TypeReference
APIRouter setup, response_model, status codesreferences/routes.md
Depends(), yield deps, cleanup, shared depsreferences/dependencies.md
Pydantic models, HTTPException, 422 handlingreferences/validation.md
Async handlers, blocking I/O, background tasksreferences/async.md

Review Checklist

  • [ ] APIRouter with proper prefix and tags
  • [ ] All routes specify response_model for type safety
  • [ ] Correct HTTP methods (GET, POST, PUT, DELETE, PATCH)
  • [ ] Proper status codes (200, 201, 204, 404, etc.)
  • [ ] Dependencies use Depends() not manual calls
  • [ ] Yield dependencies have proper cleanup
  • [ ] Request/Response models use Pydantic
  • [ ] HTTPException with status code and detail
  • [ ] All route handlers are async def
  • [ ] No blocking I/O (requests, time.sleep, open())
  • [ ] Background tasks for non-blocking operations
  • [ ] No bare except in route handlers

Valid Patterns (Do NOT Flag)

These are idiomatic FastAPI patterns that may appear problematic but are correct:

  • Pydantic validates request body automatically - No manual validation needed when using typed Pydantic models as parameters
  • Dependency injection for database sessions - Sessions come from Depends(), not passed as function arguments
  • HTTPException for all HTTP errors - FastAPI handles conversion to proper HTTP responses
  • Async def endpoint without await - May be using sync dependencies or simple operations; FastAPI handles this
  • Type annotation on Depends() - This is documentation/IDE support, not a type assertion
  • Query/Path/Body defaults - FastAPI processes these at runtime, not traditional Python defaults
  • Returning dict from endpoint - Pydantic converts automatically if response_model is set

Context-Sensitive Rules

Only flag issues when the context warrants it:

  • Flag missing validation ONLY IF the field isn't already in a Pydantic model with validators
  • Flag missing auth ONLY IF the endpoint isn't using Depends() with an auth dependency
  • Flag missing error handling ONLY IF HTTPException isn't raised appropriately for error cases
  • Flag sync in async ONLY IF the operation is actually blocking (file I/O, network calls, CPU-bound), not just non-async

Gates (FastAPI-specific)

Run once per FastAPI-related finding, after you can anchor file:line for the handler (see review-verification-protocol) and before the finding text ships. If a step’s pass condition is not met, do not assert the finding as written—gather evidence, withdraw, downgrade severity, or rephrase as a question.

Gate 1 — Route decorator and response surface

StepActionPass condition
1aOpen the handler’s route decorator in the repo (not from memory).file:line for @router.* / @app.* (or the site that registers this handler).
1bRecord HTTP method, response_model=, and status_code= on that decorator (or note they are absent).Snippet from that line or explicit absent with the same file:line.

Gate 2 — Blocking or “should be async”

StepActionPass condition
2aRead the full handler body.file:line range covering the body.
2bIf claiming blocking I/O: name each blocking call (e.g. requests., open(, time.sleep, sync DB/ORM).Each call has file:line, or withdraw the finding if none after the read.

Gate 3 — Depends, validation, auth

StepActionPass condition
3aList parameters: Depends / Annotated[..., Depends], Pydantic models, Body/Query/Path, Request/Response.Names + mechanism tied to file:line on the signature.
3bIf claiming missing auth: search the handler file (and its APIRouter module if separate) for Depends, Security, HTTPBearer, or project auth dependencies.Citation to an existing hook, or search result: paths searched + N matches (zero is allowed).
3cIf claiming missing validation: confirm the argument is not already a Pydantic model or constrained Query/Path/Body.Type/source with file:line, or withdraw if validation already applies.

FastAPI Framework Behaviors

FastAPI + Pydantic handle many concerns automatically:

  • Request validation via Pydantic models
  • Response serialization via response_model
  • Dependency injection for cross-cutting concerns
  • Exception handling via exception handlers

Before flagging "missing" functionality, verify FastAPI isn't handling it.

When to Load References

  • Reviewing route definitions → routes.md
  • Reviewing dependency injection → dependencies.md
  • Reviewing Pydantic models/validation → validation.md
  • Reviewing async route handlers → async.md

Review Questions

  1. Do all routes have explicit response models and status codes?
  2. Are dependencies injected via Depends() with proper cleanup?
  3. Do all Pydantic models validate inputs correctly?
  4. Are all route handlers async and non-blocking?

Before Submitting Findings

  1. For each FastAPI-related finding, complete Gates (FastAPI-specific) above.
  2. Load and follow review-verification-protocol (Pre-Report checklist and Verification by Issue Type) before reporting any issue.

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

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

04

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

补充不同宿主或平台的使用分布数据

能力 5

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

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

平台分布

OpenClaw

77.76%
按下载量换算1,646

安全审计

VirusTotal

未展示

ClawScan

通过

Static analysis

通过

权限和风险

需要联网

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

安装前确认

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

来源信息

继续浏览同类 Skills