[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ECAP6TDC6RMFRE1HK9ZSE0":3,"skill-same:01M7ECAP6TDC6RMFRE1HK9ZSE0":79},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":35,"commitSha":36,"skillDirectory":37,"forksCount":38,"repositoryHtmlUrl":39,"repositoryHomepageUrl":6,"ownerHtmlUrl":40,"ownerBlogUrl":6,"ownerDescription":41,"updatedAt":42,"install":43,"resources":56},"01M7ECAP6TDC6RMFRE1HK9ZSE0","fastapi",null,"Use when building, reviewing, testing, securing or shipping a FastAPI \u002F async Python service — routers, Pydantic v2 schemas, dependency injection, async SQLAlchemy 2.0, OAuth2\u002FJWT, ASGITransport tests, production wiring. NOT language-level Python or packaging (that is `python`), NOT engine-level SQL (that is `postgresdb`), NOT framework-agnostic REST contracts (that is `api-design`).","lza6\u002FArmor-piercing-system-prompts","lza6","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F128880206?v=4","01M7EB3K7WPX5T28EJ2NVHE6EG","Chinese-tingfeng","01M7EB3K97E1KQ16QWKJMFNGX8",11,"MIT","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F03-逆向工程\u002Ffastapi\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: fastapi\ndescription: \"Use when building, reviewing, testing, securing or shipping a FastAPI \u002F async Python service — routers, Pydantic v2 schemas, dependency injection, async SQLAlchemy 2.0, OAuth2\u002FJWT, ASGITransport tests, production wiring. NOT language-level Python or packaging (that is `python`), NOT engine-level SQL (that is `postgresdb`), NOT framework-agnostic REST contracts (that is `api-design`).\"\ntags: [python, api, async, backend, rest]\nrecommends: [postgresdb, secure-coding, deployment]\norigin: risco\n---\n\n# FastAPI & modern Python services\n\nThe single authoritative skill for building, reviewing, testing, securing and shipping an\nasync FastAPI service on Python 3.12+. The mental model: **the app is a thin async HTTP\nlayer over typed dependencies, a service\u002Frepository core, and explicit DB sessions. Routes\nvalidate and delegate; they never own business logic, raw SQL, or secrets.**\n\nPinned stack: Python 3.12+, FastAPI 0.136+, Starlette 1.0+ (FastAPI 0.136 requires it;\navoid \u003C1.0.1, GHSA-86qp-5c8j-p5mr), Pydantic v2 (2.7+) + pydantic-settings 2.x,\nSQLAlchemy 2.0 async, Alembic 1.13+, asyncpg 0.30 \u002F psycopg 3, httpx 0.28+,\npytest 8 + pytest-asyncio 1.0+ (`asyncio_mode=auto`), ruff 0.7+, mypy 1.13+ strict,\nuv 0.5+, uvicorn 0.32+ \u002F gunicorn 23+ + uvicorn-worker 0.3+, PyJWT 2.10+, argon2-cffi 23+,\npip-audit 2.7+, PostgreSQL 16. (All lower bounds; install the latest in each line.)\n\n> **⚠️ SDD new-feature gate — read this first.** If this skill fired on a **new, non-trivial feature or behaviour change** and there is **no approved spec + plan** under `02-DOCS\u002Fwiki\u002Fsdd\u002F`, STOP — do **not** write feature code yet. Hand off to `..\u002Fspecify\u002FSKILL.md` first: it runs brainstorm → spec → plan → tasks before any code, then routes back here once the plan is approved. Build here directly only for a genuinely one-line \u002F low-risk change. Method: `..\u002Fsdd\u002FSKILL.md`.\n\nOut of scope, and where it goes instead: [`django`](..\u002Fdjango\u002FSKILL.md) for Django; Flask \u002F sync WSGI,\nnotebooks and CLI-only scripts (no skill); language-level Python, typing and packaging →\n[`python`](..\u002Fpython\u002FSKILL.md); framework-agnostic REST contracts — status codes, URL naming, versioning,\ncursor vs offset → [`api-design`](..\u002Fapi-design\u002FSKILL.md) (this skill covers their FastAPI *implementation*);\nengine-level schema, indexing, EXPLAIN, zero-downtime migrations, PgBouncer →\n[`postgresdb`](..\u002Fpostgresdb\u002FSKILL.md); language-agnostic injection \u002F secret \u002F authz theory →\n[`secure-coding`](..\u002Fsecure-coding\u002FSKILL.md); Dockerfile, Compose and CI\u002FCD mechanics →\n[`deployment`](..\u002Fdeployment\u002FSKILL.md) (this skill keeps only a Docker *note*).\n\n## Decision rules\n\n1. `async def` for any I\u002FO route + async drivers (asyncpg, httpx); never `requests`\u002F`psycopg2`\u002Fblocking calls on the loop (offload via `await anyio.to_thread.run_sync`).\n2. Three Pydantic models per resource — `XCreate`\u002F`XUpdate`\u002F`XResponse` (`from_attributes=True`); responses never leak hashes\u002Ftokens\u002Finternal flags.\n3. Request-scoped resources via `Annotated[T, Depends(...)]`, never built inline — so tests can override them.\n4. One DB session per request via `get_db` (commit-on-success \u002F rollback-on-exception); handlers never commit.\n5. One error envelope `{\"error\":{\"code\",\"message\",\"details?\"}}` via centralized handlers; never leak stack traces \u002F SQL.\n6. Settings from `pydantic-settings` (`BaseSettings`), never scattered `os.getenv`.\n7. Validate JWT `exp`\u002F`iss`\u002F`aud` and pin `algorithms=[\"RS256\"|\"HS256\"]` explicitly.\n8. Tests: `ASGITransport` + `dependency_overrides` on a transactional DB; CI gates on `ruff`, `mypy --strict`, `pytest --cov`, `pip-audit`.\n\n## Project layout\n\n```text\napp\u002F\n├── main.py            # create_app() factory + lifespan; app = create_app()\n├── core\u002F\n│   ├── config.py      # Settings(BaseSettings) + get_settings()\n│   ├── security.py    # hashing, JWT encode\u002Fdecode\n│   └── logging.py     # structlog \u002F JSON logging setup\n├── api\u002F\n│   ├── deps.py        # get_db, get_current_user, Pagination, require_roles\n│   └── routers\u002F\n│       ├── users.py\n│       └── health.py\n├── schemas\u002F           # Pydantic v2 models (Create\u002FUpdate\u002FResponse)\n│   └── user.py\n├── models\u002F            # SQLAlchemy 2.0 DeclarativeBase models\n│   └── user.py\n├── db\u002F\n│   ├── base.py        # engine, async_sessionmaker, Base\n│   └── repository.py  # generic async Repository[ModelT]\n├── services\u002F          # business logic (no FastAPI imports)\n│   └── user_service.py\n├── exceptions.py      # AppError hierarchy + register_exception_handlers\ntests\u002F                 # pytest-asyncio + ASGITransport\nalembic\u002F               # async env.py + versions\u002F\npyproject.toml         # ruff + mypy strict + pytest config\n```\n\nRouters stay thin, services hold the logic, the repository\u002FCRUD layer owns persistence.\n\n## Application factory + lifespan\n\n```python\nfrom contextlib import asynccontextmanager\n\nfrom fastapi import FastAPI\nfrom fastapi.middleware.cors import CORSMiddleware\n\nfrom app.api.routers import health, users\nfrom app.core.config import Settings, get_settings\nfrom app.db.base import engine\nfrom app.exceptions import register_exception_handlers\n\n# Routers paired with their mount prefix + OpenAPI tag, declared once so the factory\n# stays a flat loop instead of a wall of include_router() calls.\nROUTERS = (\n    (health.router, \"\u002Fhealth\", \"health\"),\n    (users.router, \"\u002Fapi\u002Fv1\u002Fusers\", \"users\"),\n)\n\n\n@asynccontextmanager\nasync def lifespan(_app: FastAPI):\n    # Open pools\u002Fcaches on startup (here), never at import time, so importing the module has\n    # no side effects (tests and Alembic import it freely).\n    yield\n    await engine.dispose()   # release pooled DB connections so workers exit cleanly\n\n\ndef _install_cors(app: FastAPI, settings: Settings) -> None:\n    if not settings.cors_origins:\n        return  # no browser clients configured -> skip the middleware entirely\n    app.add_middleware(\n        CORSMiddleware,\n        allow_origins=settings.cors_origins,   # explicit per-env list, never [\"*\"] with creds\n        allow_credentials=True,\n        allow_methods=[\"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\"],\n        allow_headers=[\"Authorization\", \"Content-Type\"],\n    )\n\n\ndef create_app(settings: Settings | None = None) -> FastAPI:\n    settings = settings or get_settings()\n    app = FastAPI(title=settings.api_title, version=settings.api_version, lifespan=lifespan)\n\n    register_exception_handlers(app)\n    _install_cors(app, settings)\n    for router, prefix, tag in ROUTERS:\n        app.include_router(router, prefix=prefix, tags=[tag])\n    return app\n\n\napp = create_app()\n```\n\nAccepting an optional `settings` argument lets tests build the app with overridden config\nwithout touching the `get_settings` cache. **Bad** = `allow_origins=[\"*\"]` with\n`allow_credentials=True` — browsers reject it and Starlette refuses to echo `*` for\ncredentialed requests. → [`references\u002Fproduction.md`](references\u002Fproduction.md) for proxy headers \u002F logging wiring at\nstartup.\n\nTo inject servers \u002F security schemes \u002F a logo into the generated OpenAPI doc, assign a\ncustom builder to `app.openapi` inside `create_app()`. → [`references\u002Fproduction.md`](references\u002Fproduction.md)\n(Customizing the OpenAPI schema).\n\n## Configuration (pydantic-settings)\n\n```python\nfrom functools import lru_cache\n\nfrom pydantic import PostgresDsn, SecretStr\nfrom pydantic_settings import BaseSettings, SettingsConfigDict\n\n\nclass Settings(BaseSettings):\n    model_config = SettingsConfigDict(env_file=\".env\", env_prefix=\"APP_\", extra=\"ignore\")\n\n    api_title: str = \"Service API\"\n    api_version: str = \"1.0.0\"\n    environment: str = \"development\"\n    database_url: PostgresDsn\n    jwt_secret: SecretStr\n    jwt_algorithm: str = \"HS256\"\n    jwt_issuer: str = \"service-api\"\n    jwt_audience: str = \"service-clients\"\n    access_token_ttl_seconds: int = 900\n    cors_origins: list[str] = []\n\n\n@lru_cache\ndef get_settings() -> Settings:\n    return Settings()  # type: ignore[call-arg]  # values come from env\u002F.env\n```\n\n**Bad** = `DB_URL = os.environ[\"DB_URL\"]` at import time (crashes on import, untyped,\nunmockable). **Good** = inject `get_settings` as a dependency so tests override it.\n\n## Pydantic v2 models (Create\u002FUpdate\u002FResponse split)\n\n```python\nfrom datetime import datetime\nfrom typing import Annotated\nfrom uuid import UUID\n\nfrom pydantic import BaseModel, ConfigDict, EmailStr, Field, computed_field\n\n# Reusable constrained types keep the same rule in one place across the three models.\nFullName = Annotated[str, Field(min_length=1, max_length=100)]\nRawPassword = Annotated[str, Field(min_length=12, max_length=128)]\n\n\nclass UserInput(BaseModel):\n    \"\"\"Fields a client may send. Create\u002FUpdate narrow this; Response never inherits it.\"\"\"\n\n    email: EmailStr\n    full_name: FullName\n\n\nclass UserCreate(UserInput):\n    password: RawPassword\n\n\nclass UserUpdate(BaseModel):\n    # Every field optional: a PATCH sends only what changes.\n    email: EmailStr | None = None\n    full_name: FullName | None = None\n\n\nclass UserResponse(BaseModel):\n    model_config = ConfigDict(from_attributes=True)  # populate straight off ORM attributes\n\n    id: UUID\n    email: EmailStr\n    full_name: str\n    created_at: datetime\n\n    @computed_field  # type: ignore[prop-decorator]\n    @property\n    def label(self) -> str:\n        return f\"{self.full_name} \u003C{self.email}>\"\n```\n\nv2 migration cheats: use `.model_dump()` not `.dict()`; `.model_validate(obj)` not\n`.from_orm()`; `model_config = ConfigDict(...)` not class `Config`;\n`field_validator`\u002F`model_validator` not `@validator`\u002F`@root_validator`.\n\n**Bad** = a response model with `hashed_password: str` (leaks the hash). **Good** = the\n`UserResponse` above (no secret fields). → [`references\u002Fsecurity.md`](references\u002Fsecurity.md).\n\n## Dependency injection\n\n```python\nfrom collections.abc import AsyncIterator\nfrom dataclasses import dataclass\nfrom typing import Annotated\n\nfrom fastapi import Depends, Query\nfrom sqlalchemy.ext.asyncio import AsyncSession\n\nfrom app.db.base import async_session_factory\n\n\nasync def get_db() -> AsyncIterator[AsyncSession]:\n    session = async_session_factory()\n    try:\n        yield session\n        await session.commit()   # commit only if the handler returned without raising\n    except Exception:\n        await session.rollback()  # any error (incl. HTTP exceptions) unwinds the txn\n        raise\n    finally:\n        await session.close()    # always release the connection back to the pool\n\n\nDbSession = Annotated[AsyncSession, Depends(get_db)]\n\n\n@dataclass(frozen=True)\nclass Pagination:\n    limit: int\n    offset: int\n\n\ndef get_pagination(\n    limit: Annotated[int, Query(ge=1, le=100)] = 50,\n    offset: Annotated[int, Query(ge=0)] = 0,\n) -> Pagination:\n    return Pagination(limit=limit, offset=offset)\n\n\nPageParams = Annotated[Pagination, Depends(get_pagination)]\n```\n\n→ [`references\u002Fdatabase.md`](references\u002Fdatabase.md) for `async_session_factory` wiring; → [`references\u002Fsecurity.md`](references\u002Fsecurity.md)\nfor `get_current_user` and `require_roles`.\n\n## Routers & endpoints\n\n```python\nfrom fastapi import APIRouter, Response, status\n\nfrom app.api.deps import CurrentUser, DbSession, PageParams\nfrom app.schemas.user import UserCreate, UserResponse\nfrom app.services import user_service\n\nrouter = APIRouter()\n\n\n@router.get(\"\", response_model=list[UserResponse])\nasync def list_users(db: DbSession, page: PageParams) -> list[UserResponse]:\n    return await user_service.list_users(db, limit=page.limit, offset=page.offset)\n\n\n@router.post(\"\", response_model=UserResponse, status_code=status.HTTP_201_CREATED)\nasync def create_user(payload: UserCreate, db: DbSession, response: Response) -> UserResponse:\n    user = await user_service.create_user(db, payload)\n    response.headers[\"Location\"] = f\"\u002Fapi\u002Fv1\u002Fusers\u002F{user.id}\"\n    return user\n```\n\n**Bad** = hashing the password + building `select()` + business rules inline in the route.\n**Good** = `await user_service.create_user(db, payload)` (route stays thin). `CurrentUser`\nis defined in `references\u002Fsecurity.md`.\n\n## Error handling & envelope\n\n```python\nfrom fastapi import FastAPI, Request, status\nfrom fastapi.exceptions import RequestValidationError\nfrom fastapi.responses import JSONResponse\n\nfrom app.core.logging import logger\n\n\nclass AppError(Exception):\n    def __init__(self, message: str, code: str, status_code: int = 500,\n                 details: list[dict] | None = None) -> None:\n        super().__init__(message)\n        self.message = message\n        self.code = code\n        self.status_code = status_code\n        self.details = details or []\n\n\nclass NotFoundError(AppError):\n    def __init__(self, resource: str, ident: str) -> None:\n        super().__init__(f\"{resource} not found: {ident}\", \"not_found\", 404)\n\n\ndef register_exception_handlers(app: FastAPI) -> None:\n    @app.exception_handler(AppError)\n    async def _app_error(request: Request, exc: AppError) -> JSONResponse:\n        return JSONResponse(\n            status_code=exc.status_code,\n            content={\"error\": {\"code\": exc.code, \"message\": exc.message, \"details\": exc.details}},\n        )\n\n    @app.exception_handler(RequestValidationError)\n    async def _validation(request: Request, exc: RequestValidationError) -> JSONResponse:\n        details = [{\"field\": \".\".join(map(str, e[\"loc\"][1:])), \"message\": e[\"msg\"], \"code\": e[\"type\"]}\n                   for e in exc.errors()]\n        return JSONResponse(\n            status_code=422,\n            content={\"error\": {\"code\": \"validation_error\", \"message\": \"Request validation failed\",\n                               \"details\": details}},\n        )\n\n    @app.exception_handler(Exception)\n    async def _unhandled(request: Request, exc: Exception) -> JSONResponse:\n        logger.exception(\"unhandled_error\", path=request.url.path)\n        return JSONResponse(\n            status_code=500,\n            content={\"error\": {\"code\": \"internal_error\", \"message\": \"An unexpected error occurred\"}},\n        )\n```\n\nKeep this envelope identical across every handler — one `code`\u002F`message`\u002F`details` shape so\nclients parse errors once. Subclass `AppError` per failure (each fixes a `code` + status):\n`NotFoundError` (404), `ConflictError` (409), `Unauthorized` (401), `Forbidden` (403) — full\nhierarchy in → [`references\u002Fproduction.md`](references\u002Fproduction.md) (AppError subclasses).\n[`secure-coding`](..\u002Fsecure-coding\u002FSKILL.md) has the why: error responses must never leak internals\n(stack traces, SQL, secrets).\n\n## Async SQLAlchemy 2.0 (essentials)\n\n```python\nfrom datetime import datetime\nfrom uuid import UUID, uuid4\n\nfrom sqlalchemy import func, select\nfrom sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine\nfrom sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column\n\nfrom app.core.config import get_settings\n\nengine = create_async_engine(str(get_settings().database_url), pool_pre_ping=True)\nasync_session_factory = async_sessionmaker(engine, expire_on_commit=False)\n\n\nclass Base(DeclarativeBase):\n    pass\n\n\nclass User(Base):\n    __tablename__ = \"users\"\n\n    id: Mapped[UUID] = mapped_column(primary_key=True, default=uuid4)\n    email: Mapped[str] = mapped_column(unique=True, index=True)\n    full_name: Mapped[str]\n    hashed_password: Mapped[str]\n    created_at: Mapped[datetime] = mapped_column(server_default=func.now())\n\n\nasync def list_users(db: AsyncSession, limit: int, offset: int) -> list[User]:\n    result = await db.execute(\n        select(User).order_by(User.created_at.desc()).limit(limit).offset(offset)\n    )\n    return list(result.scalars().all())\n```\n\nFetch by PK with `await db.get(Model, pk)`, by unique key with `.scalar_one_or_none()`; eager-load with\n`selectinload` (collections) \u002F `joinedload` (many-to-one).\n→ [`references\u002Fdatabase.md`](references\u002Fdatabase.md) for relationships, N+1 \u002F eager loading, repository, Alembic, pooling.\n\n## Background tasks vs real queues\n\n```python\nfrom fastapi import BackgroundTasks\n\n\n# Good: in-request, non-durable side effect (best-effort email).\n@router.post(\"\u002Fsignup\")\nasync def signup(background: BackgroundTasks) -> dict[str, str]:\n    background.add_task(send_welcome_email, \"user@example.com\")\n    return {\"status\": \"accepted\"}\n```\n\nAnything needing **retries, durability, or cross-process execution** (payment webhooks, large\njobs) goes to a real broker (Celery \u002F Arq \u002F Dramatiq), **never** `BackgroundTasks` — it runs\nin-process and dies with the worker, with no retry or visibility.\n\n## Testing\n\nDrive the app in-process with `httpx.AsyncClient(transport=ASGITransport(app=create_app()))`\nand swap real dependencies via `app.dependency_overrides[get_db] = lambda: db_session` against\na transactional fixture — so every test rolls back. Use `pytest-asyncio` with\n`asyncio_mode = \"auto\"` (no `@pytest.mark.asyncio`), and assert secrets never serialize (e.g.\n`assert \"hashed_password\" not in resp.json()`). TDD red→green→refactor. Full fixtures\n(transactional `begin_nested`, auth overrides, respx, coverage gate) in\n→ [`references\u002Ftesting.md`](references\u002Ftesting.md).\n\n## Security\n\nFull hardening playbook — argon2 hashing, OAuth2 + JWT (claims validated, `algorithms`\npinned), `get_current_user`\u002F`require_roles` RBAC, CORS, shared-store rate limiting, injection,\n`SecretStr` + log redaction, security headers, `pip-audit` — lives in\n→ [`references\u002Fsecurity.md`](references\u002Fsecurity.md) — including the exact `argon2.PasswordHasher().hash(pw)` and\n`jwt.decode(t, key, algorithms=[...], audience=..., issuer=...)` calls. See\n[`secure-coding`](..\u002Fsecure-coding\u002FSKILL.md) for the language-agnostic theory.\n\n## Production\n\nASGI\u002Fworker math, structured JSON logging + request-id, liveness vs readiness probes, graceful\nshutdown, keyset pagination, caching, `ORJSONResponse` and proxy headers all live in\n→ [`references\u002Fproduction.md`](references\u002Fproduction.md). See [`deployment`](..\u002Fdeployment\u002FSKILL.md) for the\nDockerfile and CI\u002FCD pipeline.\n\n## Anti-patterns\n\n| Anti-pattern | Why it breaks → do this |\n|---|---|\n| `requests` (or any blocking call) inside an `async def` route | Blocks the event loop → use `httpx.AsyncClient`. |\n| `.dict()` \u002F `from_orm()` on a model | Pydantic v2: use `.model_dump()`; `.dict()`\u002F`from_orm` are deprecated. |\n| Returning the ORM object with no `response_model` | Leaks columns + lazy-loads in serializer → declare `response_model`. |\n| `allow_origins=['*']` together with credentials | Browser rejects it; Starlette blocks it. Pin origins. |\n| Decoding a JWT without checking `exp`\u002F`aud` | Forged\u002Freplayed tokens. Validate exp\u002Fiss\u002Faud + pin alg. |\n| Building the WHERE clause with an f-string | SQLi. Bound params \u002F SQLAlchemy expressions only. |\n| One global session shared by the whole app | Cross-request data bleed + concurrency bugs. One session per request. |\n| Catching `Exception` and returning its message | Leaks internals. Log it, return generic 500. |\n| `BackgroundTasks` for a payment-webhook retry | No durability\u002Fretry. Use a real broker. |\n| Skipping `mypy --strict` because it is noisy | Strict catches the bugs FastAPI's runtime won't. Keep it. |\n| Committing inside the handler | Let `get_db` own commit\u002Frollback; handlers stay thin. |\n| Default-mutable arg \u002F engine built at import time | Mutable defaults bite; engine must live in lifespan. |\n\n## Project grounding\n\nIn a project with a `02-DOCS\u002F` layer ([`harness`](..\u002Fharness\u002FSKILL.md)), read\n`02-DOCS\u002Fwiki\u002Fstack\u002Ffastapi.md` first and stay consistent with it; create or update it with this\nproject's real choices — auth model (JWT\u002FOAuth2 provider, token TTLs), DB session + migration tool,\nerror-envelope shape, settings\u002Fsecrets approach, deployment target — bump its `Updated` date, and index\nit in `02-DOCS\u002Fwiki\u002Findex.md`. No `02-DOCS\u002F`? Skip silently. Conventions are *recorded, not gated* —\nnever block the task on this.\n\nVerify gate: [`scripts\u002Fverify.sh`](scripts\u002Fverify.sh).\n","# FastAPI & modern Python services\n\nThe single authoritative skill for building, reviewing, testing, securing and shipping an\nasync FastAPI service on Python 3.12+. The mental model: **the app is a thin async HTTP\nlayer over typed dependencies, a service\u002Frepository core, and explicit DB sessions. Routes\nvalidate and delegate; they never own business logic, raw SQL, or secrets.**\n\nPinned stack: Python 3.12+, FastAPI 0.136+, Starlette 1.0+ (FastAPI 0.136 requires it;\navoid \u003C1.0.1, GHSA-86qp-5c8j-p5mr), Pydantic v2 (2.7+) + pydantic-settings 2.x,\nSQLAlchemy 2.0 async, Alembic 1.13+, asyncpg 0.30 \u002F psycopg 3, httpx 0.28+,\npytest 8 + pytest-asyncio 1.0+ (`asyncio_mode=auto`), ruff 0.7+, mypy 1.13+ strict,\nuv 0.5+, uvicorn 0.32+ \u002F gunicorn 23+ + uvicorn-worker 0.3+, PyJWT 2.10+, argon2-cffi 23+,\npip-audit 2.7+, PostgreSQL 16. (All lower bounds; install the latest in each line.)\n\n> **⚠️ SDD new-feature gate — read this first.** If this skill fired on a **new, non-trivial feature or behaviour change** and there is **no approved spec + plan** under `02-DOCS\u002Fwiki\u002Fsdd\u002F`, STOP — do **not** write feature code yet. Hand off to `..\u002Fspecify\u002FSKILL.md` first: it runs brainstorm → spec → plan → tasks before any code, then routes back here once the plan is approved. Build here directly only for a genuinely one-line \u002F low-risk change. Method: `..\u002Fsdd\u002FSKILL.md`.\n\nOut of scope, and where it goes instead: [`django`](..\u002Fdjango\u002FSKILL.md) for Django; Flask \u002F sync WSGI,\nnotebooks and CLI-only scripts (no skill); language-level Python, typing and packaging →\n[`python`](..\u002Fpython\u002FSKILL.md); framework-agnostic REST contracts — status codes, URL naming, versioning,\ncursor vs offset → [`api-design`](..\u002Fapi-design\u002FSKILL.md) (this skill covers their FastAPI *implementation*);\nengine-level schema, indexing, EXPLAIN, zero-downtime migrations, PgBouncer →\n[`postgresdb`](..\u002Fpostgresdb\u002FSKILL.md); language-agnostic injection \u002F secret \u002F authz theory →\n[`secure-coding`](..\u002Fsecure-coding\u002FSKILL.md); Dockerfile, Compose and CI\u002FCD mechanics →\n[`deployment`](..\u002Fdeployment\u002FSKILL.md) (this skill keeps only a Docker *note*).\n\n## Decision rules\n\n1. `async def` for any I\u002FO route + async drivers (asyncpg, httpx); never `requests`\u002F`psycopg2`\u002Fblocking calls on the loop (offload via `await anyio.to_thread.run_sync`).\n2. Three Pydantic models per resource — `XCreate`\u002F`XUpdate`\u002F`XResponse` (`from_attributes=True`); responses never leak hashes\u002Ftokens\u002Finternal flags.\n3. Request-scoped resources via `Annotated[T, Depends(...)]`, never built inline — so tests can override them.\n4. One DB session per request via `get_db` (commit-on-success \u002F rollback-on-exception); handlers never commit.\n5. One error envelope `{\"error\":{\"code\",\"message\",\"details?\"}}` via centralized handlers; never leak stack traces \u002F SQL.\n6. Settings from `pydantic-settings` (`BaseSettings`), never scattered `os.getenv`.\n7. Validate JWT `exp`\u002F`iss`\u002F`aud` and pin `algorithms=[\"RS256\"|\"HS256\"]` explicitly.\n8. Tests: `ASGITransport` + `dependency_overrides` on a transactional DB; CI gates on `ruff`, `mypy --strict`, `pytest --cov`, `pip-audit`.\n\n## Project layout\n\n```text\napp\u002F\n├── main.py            # create_app() factory + lifespan; app = create_app()\n├── core\u002F\n│   ├── config.py      # Settings(BaseSettings) + get_settings()\n│   ├── security.py    # hashing, JWT encode\u002Fdecode\n│   └── logging.py     # structlog \u002F JSON logging setup\n├── api\u002F\n│   ├── deps.py        # get_db, get_current_user, Pagination, require_roles\n│   └── routers\u002F\n│       ├── users.py\n│       └── health.py\n├── schemas\u002F           # Pydantic v2 models (Create\u002FUpdate\u002FResponse)\n│   └── user.py\n├── models\u002F            # SQLAlchemy 2.0 DeclarativeBase models\n│   └── user.py\n├── db\u002F\n│   ├── base.py        # engine, async_sessionmaker, Base\n│   └── repository.py  # generic async Repository[ModelT]\n├── services\u002F          # business logic (no FastAPI imports)\n│   └── user_service.py\n├── exceptions.py      # AppError hierarchy + register_exception_handlers\ntests\u002F                 # pytest-asyncio + ASGITransport\nalembic\u002F               # async env.py + versions\u002F\npyproject.toml         # ruff + mypy strict + pytest config\n```\n\nRouters stay thin, services hold the logic, the repository\u002FCRUD layer owns persistence.\n\n## Application factory + lifespan\n\n```python\nfrom contextlib import asynccontextmanager\n\nfrom fastapi import FastAPI\nfrom fastapi.middleware.cors import CORSMiddleware\n\nfrom app.api.routers import health, users\nfrom app.core.config import Settings, get_settings\nfrom app.db.base import engine\nfrom app.exceptions import register_exception_handlers\n\n# Routers paired with their mount prefix + OpenAPI tag, declared once so the factory\n# stays a flat loop instead of a wall of include_router() calls.\nROUTERS = (\n    (health.router, \"\u002Fhealth\", \"health\"),\n    (users.router, \"\u002Fapi\u002Fv1\u002Fusers\", \"users\"),\n)\n\n\n@asynccontextmanager\nasync def lifespan(_app: FastAPI):\n    # Open pools\u002Fcaches on startup (here), never at import time, so importing the module has\n    # no side effects (tests and Alembic import it freely).\n    yield\n    await engine.dispose()   # release pooled DB connections so workers exit cleanly\n\n\ndef _install_cors(app: FastAPI, settings: Settings) -> None:\n    if not settings.cors_origins:\n        return  # no browser clients configured -> skip the middleware entirely\n    app.add_middleware(\n        CORSMiddleware,\n        allow_origins=settings.cors_origins,   # explicit per-env list, never [\"*\"] with creds\n        allow_credentials=True,\n        allow_methods=[\"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\"],\n        allow_headers=[\"Authorization\", \"Content-Type\"],\n    )\n\n\ndef create_app(settings: Settings | None = None) -> FastAPI:\n    settings = settings or get_settings()\n    app = FastAPI(title=settings.api_title, version=settings.api_version, lifespan=lifespan)\n\n    register_exception_handlers(app)\n    _install_cors(app, settings)\n    for router, prefix, tag in ROUTERS:\n        app.include_router(router, prefix=prefix, tags=[tag])\n    return app\n\n\napp = create_app()\n```\n\nAccepting an optional `settings` argument lets tests build the app with overridden config\nwithout touching the `get_settings` cache. **Bad** = `allow_origins=[\"*\"]` with\n`allow_credentials=True` — browsers reject it and Starlette refuses to echo `*` for\ncredentialed requests. → [`references\u002Fproduction.md`](references\u002Fproduction.md) for proxy headers \u002F logging wiring at\nstartup.\n\nTo inject servers \u002F security schemes \u002F a logo into the generated OpenAPI doc, assign a\ncustom builder to `app.openapi` inside `create_app()`. → [`references\u002Fproduction.md`](references\u002Fproduction.md)\n(Customizing the OpenAPI schema).\n\n## Configuration (pydantic-settings)\n\n```python\nfrom functools import lru_cache\n\nfrom pydantic import PostgresDsn, SecretStr\nfrom pydantic_settings import BaseSettings, SettingsConfigDict\n\n\nclass Settings(BaseSettings):\n    model_config = SettingsConfigDict(env_file=\".env\", env_prefix=\"APP_\", extra=\"ignore\")\n\n    api_title: str = \"Service API\"\n    api_version: str = \"1.0.0\"\n    environment: str = \"development\"\n    database_url: PostgresDsn\n    jwt_secret: SecretStr\n    jwt_algorithm: str = \"HS256\"\n    jwt_issuer: str = \"service-api\"\n    jwt_audience: str = \"service-clients\"\n    access_token_ttl_seconds: int = 900\n    cors_origins: list[str] = []\n\n\n@lru_cache\ndef get_settings() -> Settings:\n    return Settings()  # type: ignore[call-arg]  # values come from env\u002F.env\n```\n\n**Bad** = `DB_URL = os.environ[\"DB_URL\"]` at import time (crashes on import, untyped,\nunmockable). **Good** = inject `get_settings` as a dependency so tests override it.\n\n## Pydantic v2 models (Create\u002FUpdate\u002FResponse split)\n\n```python\nfrom datetime import datetime\nfrom typing import Annotated\nfrom uuid import UUID\n\nfrom pydantic import BaseModel, ConfigDict, EmailStr, Field, computed_field\n\n# Reusable constrained types keep the same rule in one place across the three models.\nFullName = Annotated[str, Field(min_length=1, max_length=100)]\nRawPassword = Annotated[str, Field(min_length=12, max_length=128)]\n\n\nclass UserInput(BaseModel):\n    \"\"\"Fields a client may send. Create\u002FUpdate narrow this; Response never inherits it.\"\"\"\n\n    email: EmailStr\n    full_name: FullName\n\n\nclass UserCreate(UserInput):\n    password: RawPassword\n\n\nclass UserUpdate(BaseModel):\n    # Every field optional: a PATCH sends only what changes.\n    email: EmailStr | None = None\n    full_name: FullName | None = None\n\n\nclass UserResponse(BaseModel):\n    model_config = ConfigDict(from_attributes=True)  # populate straight off ORM attributes\n\n    id: UUID\n    email: EmailStr\n    full_name: str\n    created_at: datetime\n\n    @computed_field  # type: ignore[prop-decorator]\n    @property\n    def label(self) -> str:\n        return f\"{self.full_name} \u003C{self.email}>\"\n```\n\nv2 migration cheats: use `.model_dump()` not `.dict()`; `.model_validate(obj)` not\n`.from_orm()`; `model_config = ConfigDict(...)` not class `Config`;\n`field_validator`\u002F`model_validator` not `@validator`\u002F`@root_validator`.\n\n**Bad** = a response model with `hashed_password: str` (leaks the hash). **Good** = the\n`UserResponse` above (no secret fields). → [`references\u002Fsecurity.md`](references\u002Fsecurity.md).\n\n## Dependency injection\n\n```python\nfrom collections.abc import AsyncIterator\nfrom dataclasses import dataclass\nfrom typing import Annotated\n\nfrom fastapi import Depends, Query\nfrom sqlalchemy.ext.asyncio import AsyncSession\n\nfrom app.db.base import async_session_factory\n\n\nasync def get_db() -> AsyncIterator[AsyncSession]:\n    session = async_session_factory()\n    try:\n        yield session\n        await session.commit()   # commit only if the handler returned without raising\n    except Exception:\n        await session.rollback()  # any error (incl. HTTP exceptions) unwinds the txn\n        raise\n    finally:\n        await session.close()    # always release the connection back to the pool\n\n\nDbSession = Annotated[AsyncSession, Depends(get_db)]\n\n\n@dataclass(frozen=True)\nclass Pagination:\n    limit: int\n    offset: int\n\n\ndef get_pagination(\n    limit: Annotated[int, Query(ge=1, le=100)] = 50,\n    offset: Annotated[int, Query(ge=0)] = 0,\n) -> Pagination:\n    return Pagination(limit=limit, offset=offset)\n\n\nPageParams = Annotated[Pagination, Depends(get_pagination)]\n```\n\n→ [`references\u002Fdatabase.md`](references\u002Fdatabase.md) for `async_session_factory` wiring; → [`references\u002Fsecurity.md`](references\u002Fsecurity.md)\nfor `get_current_user` and `require_roles`.\n\n## Routers & endpoints\n\n```python\nfrom fastapi import APIRouter, Response, status\n\nfrom app.api.deps import CurrentUser, DbSession, PageParams\nfrom app.schemas.user import UserCreate, UserResponse\nfrom app.services import user_service\n\nrouter = APIRouter()\n\n\n@router.get(\"\", response_model=list[UserResponse])\nasync def list_users(db: DbSession, page: PageParams) -> list[UserResponse]:\n    return await user_service.list_users(db, limit=page.limit, offset=page.offset)\n\n\n@router.post(\"\", response_model=UserResponse, status_code=status.HTTP_201_CREATED)\nasync def create_user(payload: UserCreate, db: DbSession, response: Response) -> UserResponse:\n    user = await user_service.create_user(db, payload)\n    response.headers[\"Location\"] = f\"\u002Fapi\u002Fv1\u002Fusers\u002F{user.id}\"\n    return user\n```\n\n**Bad** = hashing the password + building `select()` + business rules inline in the route.\n**Good** = `await user_service.create_user(db, payload)` (route stays thin). `CurrentUser`\nis defined in `references\u002Fsecurity.md`.\n\n## Error handling & envelope\n\n```python\nfrom fastapi import FastAPI, Request, status\nfrom fastapi.exceptions import RequestValidationError\nfrom fastapi.responses import JSONResponse\n\nfrom app.core.logging import logger\n\n\nclass AppError(Exception):\n    def __init__(self, message: str, code: str, status_code: int = 500,\n                 details: list[dict] | None = None) -> None:\n        super().__init__(message)\n        self.message = message\n        self.code = code\n        self.status_code = status_code\n        self.details = details or []\n\n\nclass NotFoundError(AppError):\n    def __init__(self, resource: str, ident: str) -> None:\n        super().__init__(f\"{resource} not found: {ident}\", \"not_found\", 404)\n\n\ndef register_exception_handlers(app: FastAPI) -> None:\n    @app.exception_handler(AppError)\n    async def _app_error(request: Request, exc: AppError) -> JSONResponse:\n        return JSONResponse(\n            status_code=exc.status_code,\n            content={\"error\": {\"code\": exc.code, \"message\": exc.message, \"details\": exc.details}},\n        )\n\n    @app.exception_handler(RequestValidationError)\n    async def _validation(request: Request, exc: RequestValidationError) -> JSONResponse:\n        details = [{\"field\": \".\".join(map(str, e[\"loc\"][1:])), \"message\": e[\"msg\"], \"code\": e[\"type\"]}\n                   for e in exc.errors()]\n        return JSONResponse(\n            status_code=422,\n            content={\"error\": {\"code\": \"validation_error\", \"message\": \"Request validation failed\",\n                               \"details\": details}},\n        )\n\n    @app.exception_handler(Exception)\n    async def _unhandled(request: Request, exc: Exception) -> JSONResponse:\n        logger.exception(\"unhandled_error\", path=request.url.path)\n        return JSONResponse(\n            status_code=500,\n            content={\"error\": {\"code\": \"internal_error\", \"message\": \"An unexpected error occurred\"}},\n        )\n```\n\nKeep this envelope identical across every handler — one `code`\u002F`message`\u002F`details` shape so\nclients parse errors once. Subclass `AppError` per failure (each fixes a `code` + status):\n`NotFoundError` (404), `ConflictError` (409), `Unauthorized` (401), `Forbidden` (403) — full\nhierarchy in → [`references\u002Fproduction.md`](references\u002Fproduction.md) (AppError subclasses).\n[`secure-coding`](..\u002Fsecure-coding\u002FSKILL.md) has the why: error responses must never leak internals\n(stack traces, SQL, secrets).\n\n## Async SQLAlchemy 2.0 (essentials)\n\n```python\nfrom datetime import datetime\nfrom uuid import UUID, uuid4\n\nfrom sqlalchemy import func, select\nfrom sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine\nfrom sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column\n\nfrom app.core.config import get_settings\n\nengine = create_async_engine(str(get_settings().database_url), pool_pre_ping=True)\nasync_session_factory = async_sessionmaker(engine, expire_on_commit=False)\n\n\nclass Base(DeclarativeBase):\n    pass\n\n\nclass User(Base):\n    __tablename__ = \"users\"\n\n    id: Mapped[UUID] = mapped_column(primary_key=True, default=uuid4)\n    email: Mapped[str] = mapped_column(unique=True, index=True)\n    full_name: Mapped[str]\n    hashed_password: Mapped[str]\n    created_at: Mapped[datetime] = mapped_column(server_default=func.now())\n\n\nasync def list_users(db: AsyncSession, limit: int, offset: int) -> list[User]:\n    result = await db.execute(\n        select(User).order_by(User.created_at.desc()).limit(limit).offset(offset)\n    )\n    return list(result.scalars().all())\n```\n\nFetch by PK with `await db.get(Model, pk)`, by unique key with `.scalar_one_or_none()`; eager-load with\n`selectinload` (collections) \u002F `joinedload` (many-to-one).\n→ [`references\u002Fdatabase.md`](references\u002Fdatabase.md) for relationships, N+1 \u002F eager loading, repository, Alembic, pooling.\n\n## Background tasks vs real queues\n\n```python\nfrom fastapi import BackgroundTasks\n\n\n# Good: in-request, non-durable side effect (best-effort email).\n@router.post(\"\u002Fsignup\")\nasync def signup(background: BackgroundTasks) -> dict[str, str]:\n    background.add_task(send_welcome_email, \"user@example.com\")\n    return {\"status\": \"accepted\"}\n```\n\nAnything needing **retries, durability, or cross-process execution** (payment webhooks, large\njobs) goes to a real broker (Celery \u002F Arq \u002F Dramatiq), **never** `BackgroundTasks` — it runs\nin-process and dies with the worker, with no retry or visibility.\n\n## Testing\n\nDrive the app in-process with `httpx.AsyncClient(transport=ASGITransport(app=create_app()))`\nand swap real dependencies via `app.dependency_overrides[get_db] = lambda: db_session` against\na transactional fixture — so every test rolls back. Use `pytest-asyncio` with\n`asyncio_mode = \"auto\"` (no `@pytest.mark.asyncio`), and assert secrets never serialize (e.g.\n`assert \"hashed_password\" not in resp.json()`). TDD red→green→refactor. Full fixtures\n(transactional `begin_nested`, auth overrides, respx, coverage gate) in\n→ [`references\u002Ftesting.md`](references\u002Ftesting.md).\n\n## Security\n\nFull hardening playbook — argon2 hashing, OAuth2 + JWT (claims validated, `algorithms`\npinned), `get_current_user`\u002F`require_roles` RBAC, CORS, shared-store rate limiting, injection,\n`SecretStr` + log redaction, security headers, `pip-audit` — lives in\n→ [`references\u002Fsecurity.md`](references\u002Fsecurity.md) — including the exact `argon2.PasswordHasher().hash(pw)` and\n`jwt.decode(t, key, algorithms=[...], audience=..., issuer=...)` calls. See\n[`secure-coding`](..\u002Fsecure-coding\u002FSKILL.md) for the language-agnostic theory.\n\n## Production\n\nASGI\u002Fworker math, structured JSON logging + request-id, liveness vs readiness probes, graceful\nshutdown, keyset pagination, caching, `ORJSONResponse` and proxy headers all live in\n→ [`references\u002Fproduction.md`](references\u002Fproduction.md). See [`deployment`](..\u002Fdeployment\u002FSKILL.md) for the\nDockerfile and CI\u002FCD pipeline.\n\n## Anti-patterns\n\n| Anti-pattern | Why it breaks → do this |\n|---|---|\n| `requests` (or any blocking call) inside an `async def` route | Blocks the event loop → use `httpx.AsyncClient`. |\n| `.dict()` \u002F `from_orm()` on a model | Pydantic v2: use `.model_dump()`; `.dict()`\u002F`from_orm` are deprecated. |\n| Returning the ORM object with no `response_model` | Leaks columns + lazy-loads in serializer → declare `response_model`. |\n| `allow_origins=['*']` together with credentials | Browser rejects it; Starlette blocks it. Pin origins. |\n| Decoding a JWT without checking `exp`\u002F`aud` | Forged\u002Freplayed tokens. Validate exp\u002Fiss\u002Faud + pin alg. |\n| Building the WHERE clause with an f-string | SQLi. Bound params \u002F SQLAlchemy expressions only. |\n| One global session shared by the whole app | Cross-request data bleed + concurrency bugs. One session per request. |\n| Catching `Exception` and returning its message | Leaks internals. Log it, return generic 500. |\n| `BackgroundTasks` for a payment-webhook retry | No durability\u002Fretry. Use a real broker. |\n| Skipping `mypy --strict` because it is noisy | Strict catches the bugs FastAPI's runtime won't. Keep it. |\n| Committing inside the handler | Let `get_db` own commit\u002Frollback; handlers stay thin. |\n| Default-mutable arg \u002F engine built at import time | Mutable defaults bite; engine must live in lifespan. |\n\n## Project grounding\n\nIn a project with a `02-DOCS\u002F` layer ([`harness`](..\u002Fharness\u002FSKILL.md)), read\n`02-DOCS\u002Fwiki\u002Fstack\u002Ffastapi.md` first and stay consistent with it; create or update it with this\nproject's real choices — auth model (JWT\u002FOAuth2 provider, token TTLs), DB session + migration tool,\nerror-envelope shape, settings\u002Fsecrets approach, deployment target — bump its `Updated` date, and index\nit in `02-DOCS\u002Fwiki\u002Findex.md`. No `02-DOCS\u002F`? Skip silently. Conventions are *recorded, not gated* —\nnever block the task on this.\n\nVerify gate: [`scripts\u002Fverify.sh`](scripts\u002Fverify.sh).\n",{"name":5,"tags":24,"origin":30,"recommends":31,"description":7},[25,26,27,28,29],"python","api","async","backend","rest","risco",[32,33,34],"postgresdb","secure-coding","deployment","main","d69096e239f2a89aabc2cd078c47664a9d3b1e11","03-逆向工程\u002Ffastapi",3,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts","https:\u002F\u002Fgithub.com\u002Flza6","个人vx：Tf00798\r\n个人✈：@TFGY999","2026-10-08 14:29:22",{"source":8,"skillName":5,"commands":44,"prompt":54,"zipAvailable":55},[45,48,51],{"tool":46,"command":47},"npx","npx skills add lza6\u002FArmor-piercing-system-prompts --skill fastapi",{"tool":49,"command":50},"bunx","bunx skills add lza6\u002FArmor-piercing-system-prompts --skill fastapi",{"tool":52,"command":53},"pnpm","pnpm dlx skills add lza6\u002FArmor-piercing-system-prompts --skill fastapi","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F03-逆向工程\u002Ffastapi\u002FSKILL.md",true,[57,63,67,71,75],{"path":58,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":61,"sourceHtmlUrl":62},"evals\u002Fcases.yaml","REFERENCE","参考文档",5250,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F03-逆向工程\u002Ffastapi\u002Fevals\u002Fcases.yaml",{"path":64,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":65,"sourceHtmlUrl":66},"evals\u002FREADME.md",2786,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F03-逆向工程\u002Ffastapi\u002Fevals\u002FREADME.md",{"path":68,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":69,"sourceHtmlUrl":70},"references\u002Fdatabase.md",11947,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F03-逆向工程\u002Ffastapi\u002Freferences\u002Fdatabase.md",{"path":72,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":73,"sourceHtmlUrl":74},"references\u002Fproduction.md",13157,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F03-逆向工程\u002Ffastapi\u002Freferences\u002Fproduction.md",{"path":76,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":77,"sourceHtmlUrl":78},"references\u002Ftesting.md",11811,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F03-逆向工程\u002Ffastapi\u002Freferences\u002Ftesting.md",[80,88,93,100,107,114],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":87},"01M7FFG485KY83TD6HSC4YPCMC","obsidian-clipper-template-creator","Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator\u002FSKILL.md",[],[],"2026-11-16 10:05:34",{"skillNo":89,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":87},"01M7FFG0T6AZ0STEJPSB3CX84K","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator-antigravity-awesome-skills-main\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":87},"01M7FFFY0QEM14SKWPDYGMXM2P","python-api","Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP\u002FmAP semantics, and source-style import diagnostics.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Fpython-api\u002FSKILL.md",[],[],{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":87},"01M7FFFVZQZ2GJ0C0TGP7JHD20","file-evaluation","Folder-based PASCAL VOC AP\u002FmAP evaluation from ground-truth and detection text files.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Ffile-evaluation\u002FSKILL.md",[],[],{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":87},"01M7FFFSFNYSE77SJ6PE1CK2DA","object-detection-metrics","Guides legacy Object-Detection-Metrics PASCAL VOC AP\u002FmAP evaluation from detection text folders and direct Python API classes.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002FSKILL.md",[],[],{"skillNo":115,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":87},"01M7FFFP0GCK1RVXBCPQ8APBMT","nx-workspace-patterns","Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fnx-workspace-patterns\u002FSKILL.md",[],[]]