用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/johnalbertini14-glitch/openclaw-skills --skill fastapi命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Use this skill to create a Polymarket wallet for your agent and trade on prediction markets. Browse markets, place bets, manage positions — all without exposing private keys.
ClawSec suite manager with embedded advisory-feed monitoring, cryptographic signature verification, approval-gated malicious-skill response, and guided setup for additional security skills.
Automated daily security audits for OpenClaw agents with email reporting. Runs deep audits and sends formatted reports.
基于 SOC 职业分类
正在显示 SKILL.md
| name | FastAPI |
| description | Build fast, production-ready Python APIs with type hints, validation, and async support. |
| metadata | {"clawdbot":{"emoji":"⚡","requires":{"bins":["python3"]},"os":["linux","darwin","win32"]}} |
run_in_executortime.sleep() in async endpoints blocks everything — use await asyncio.sleep() insteadProcessPoolExecutor or background workersitems: list = [] shares the same list across requests — use Field(default_factory=list)Optional[str] doesn't make a field optional in the request — add = None or use Field(default=None)model_validate() not parse_obj(), and model_dump() not .dict() — v1 methods are deprecatedAnnotated[str, Field(min_length=1)] for reusable validated types instead of repeating constraintslru_cache on expensive dependencies or cache in app.state for singletonsDepends() without an argument reuses the type hint as the dependency — clean but can confuse readersyield dependencies for cleanup (DB sessions, file handles) — code after yield runs even if the endpoint raises@app.on_event("startup") is deprecated — use lifespan async context managerapp.state during lifespan, not as global variablesfrom contextlib import asynccontextmanager
@asynccontextmanager
async def lifespan(app):
app.state.db = await create_pool()
yield
await app.state.db.close()
app = FastAPI(lifespan=lifespan)
dict from endpoints, not Pydantic models directly — FastAPI handles serialization and it's fasterstatus_code=201 on POST endpoints returning created resources — 200 is the default but semantically wrongResponse with media_type="text/plain" for non-JSON responses — returning a string still gets JSON-encoded otherwiseresponse_model_exclude_unset=True to omit None fields from response — cleaner API outputraise HTTPException(status_code=404) — don't return Response objects for errors, it bypasses middleware@app.exception_handler(CustomError) — but remember they don't catch HTTPExceptiondetail= for user-facing messages, log the actual error separately — don't leak stack tracesBackgroundTasks runs after the response is sent but still in the same process — not suitable for long-running jobsOAuth2PasswordBearer is for documentation only — it doesn't validate tokens, you must implement that in the dependencyDepends(get_current_user) in path operation, not in router — dependencies on routers affect all routes including health checksTestClient runs sync even for async endpoints — use httpx.AsyncClient with ASGITransport for true async testingapp.dependency_overrides[get_db] = mock_db — cleaner than monkeypatchingTestClient context manager ensures lifespan runs — without with TestClient(app) as client: startup/shutdown hooks don't fire