[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M74F3XN4BT5ADDY1RPRQVRM0":3,"skill-same:01M74F3XN4BT5ADDY1RPRQVRM0":52},{"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":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":29,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M74F3XN4BT5ADDY1RPRQVRM0","fastapi-dependency-injection",null,"FastAPI dependency-injection patterns and anti-patterns -- request-scoped auth tokens leaking into singleton DI graphs, missing `Depends()` declarations on auth-required routes, `dependency_overrides` mis-use leaking a fake identity across tests. Triggers on FastAPI route authoring (`@app.get`, `@app.post`, `Depends()` references). OWASP ASI03 (Identity & Privilege Abuse) defense for auth-token handling via DI.","MILTONADINA\u002FDevOPs","MILTONADINA","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F106546372?v=4","01M74F3R2PP4Z04DQMMBHSQAT1","Milton Adina","01M74F3R3CHTKPXJV4RP7RR3W8",0,"MIT","https:\u002F\u002Fgithub.com\u002FMILTONADINA\u002FDevOPs\u002Fblob\u002Fmain\u002Fskills\u002Fstack-specific\u002Ffastapi\u002Fdependency-injection\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: fastapi-dependency-injection\ndescription: FastAPI dependency-injection patterns and anti-patterns -- request-scoped auth tokens leaking into singleton DI graphs, missing `Depends()` declarations on auth-required routes, `dependency_overrides` mis-use leaking a fake identity across tests. Triggers on FastAPI route authoring (`@app.get`, `@app.post`, `Depends()` references). OWASP ASI03 (Identity & Privilege Abuse) defense for auth-token handling via DI.\n---\n\n# FastAPI Dependency Injection\n\n> Defends against **OWASP ASI03 (Identity & Privilege Abuse)** in\n> FastAPI applications where the DI graph carries auth-relevant state.\n> FastAPI's DI system is ergonomic for wiring shared dependencies\n> (database sessions, settings, repositories), but its scoping model is\n> per-request only by default -- and that semantic interacts subtly with\n> auth-token handling. Without the patterns here, request-scoped\n> identity can leak across requests via inadvertent caching, or\n> auth-required routes can ship without an enforced auth check because\n> the DI declaration was forgotten.\n\n**Tradeoff:** Explicit `Depends()` declarations on every auth-required\nroute is repetitive vs. relying on global middleware. Worth it:\nper-route auth dependencies are reviewable in isolation, can be\noverridden in tests for the specific route, and produce typed access\nto the authenticated identity inside the handler. Middleware-only auth\nhides the contract from the handler signature.\n\n---\n\n## Why this matters\n\nFastAPI's `Depends()` system resolves dependencies per request by\ndefault -- new database session, fresh auth check, freshly-loaded\nsettings. But the framework also supports `lru_cache`-style memoization\nfor expensive dependencies (settings loading, model loading). If an\nauth-related dependency is inadvertently memoized at the wrong scope,\nthe first request's identity propagates to all subsequent requests\nhitting the same worker process. The error is silent: the test suite\npasses (one request, one identity), production fails (many requests,\nsame memoized identity).\n\nSeparately, `dependency_overrides` -- FastAPI's testing affordance\nthat replaces a dependency for a test run -- is a global mutation on\nthe app's DI registry. A test that forgets to clean up its override\nleaves the override in place for every later test in the session, so\nthose tests exercise a fake identity instead of the real auth check.\n\n---\n\n## Pattern 1 -- Declare auth as a `Depends` on every protected route, never via middleware-only\n\n```python\nfrom fastapi import FastAPI, Depends, HTTPException, status\nfrom fastapi.security import OAuth2PasswordBearer\nfrom pydantic import BaseModel\n\napp = FastAPI()\noauth2_scheme = OAuth2PasswordBearer(tokenUrl=\"token\")\n\nclass User(BaseModel):\n    id: str\n    email: str\n\nasync def get_current_user(token: str = Depends(oauth2_scheme)) -> User:\n    \"\"\"Verify the token and return the authenticated user.\n\n    Returns a fresh User instance per request -- the function body\n    runs on each request, so no cross-request identity leakage.\n    \"\"\"\n    user = await verify_token_against_session_store(token)\n    if user is None:\n        raise HTTPException(\n            status_code=status.HTTP_401_UNAUTHORIZED,\n            detail=\"invalid or expired token\",\n        )\n    return user\n\n@app.get(\"\u002Fprofile\")\nasync def read_profile(current_user: User = Depends(get_current_user)) -> dict:\n    # current_user is the per-request authenticated identity, typed\n    # and visible in the handler signature -- a reviewer sees the auth\n    # requirement directly without reading middleware config.\n    return {\"id\": current_user.id, \"email\": current_user.email}\n```\n\nThe auth requirement appears in the route signature. A new route that\nomits `Depends(get_current_user)` is immediately reviewable as\nunauthenticated -- there's no hidden middleware behavior masking the\nabsence.\n\nFor broad-application auth requirements (e.g., every route under\n`\u002Fadmin\u002F**` requires admin role), use a `dependencies=` list on a\nsub-router or `APIRouter` so the dependency is still visible at the\nroute-group level:\n\n```python\nfrom fastapi import APIRouter, Depends\nfrom .auth import require_admin\n\nadmin_router = APIRouter(\n    prefix=\"\u002Fadmin\",\n    dependencies=[Depends(require_admin)],  # applies to every route under \u002Fadmin\n    tags=[\"admin\"],\n)\n```\n\n---\n\n## Pattern 2 -- Scope expensive-to-construct dependencies correctly\n\n```python\nfrom functools import lru_cache\nfrom fastapi import Depends\nfrom pydantic_settings import BaseSettings, SettingsConfigDict\n\nclass Settings(BaseSettings):\n    model_config = SettingsConfigDict(env_file=\".env\")\n    database_url: str\n    api_key: str\n    feature_flags: dict[str, bool] = {}\n\n@lru_cache(maxsize=1)\ndef get_settings() -> Settings:\n    \"\"\"Settings are app-wide and immutable -- safe to memoize.\"\"\"\n    return Settings()\n\n# In a route:\n@app.get(\"\u002Fconfig\")\nasync def read_config(settings: Settings = Depends(get_settings)) -> dict:\n    return {\"feature_flags\": settings.feature_flags}\n```\n\n`@lru_cache` here is correct because Settings is read-only at process\nstartup. **Do NOT apply `@lru_cache` to functions that return\nrequest-scoped state** (user identity, database sessions, request\ncontext). The cache key is the function's arguments; if the function\nhas no arguments (like `get_settings()`), the result is process-global\nand shared across every request.\n\nThe distinction is binary: process-scoped (settings, model objects,\nhttp clients with their own pool) vs. request-scoped (auth identity,\ndb session, transaction). Mix them up and request-scoped state leaks\nacross requests.\n\n---\n\n## Pattern 3 -- Yield-pattern dependencies for resources needing cleanup\n\n```python\nfrom typing import AsyncGenerator\nfrom sqlalchemy.ext.asyncio import AsyncSession\nfrom fastapi import Depends\n\nasync def get_db_session() -> AsyncGenerator[AsyncSession, None]:\n    async with async_session_factory() as session:\n        try:\n            yield session\n            await session.commit()\n        except Exception:\n            await session.rollback()\n            raise\n\n@app.post(\"\u002Fposts\")\nasync def create_post(\n    payload: PostCreateInput,\n    db: AsyncSession = Depends(get_db_session),\n    current_user: User = Depends(get_current_user),\n) -> Post:\n    post = Post(author_id=current_user.id, **payload.model_dump())\n    db.add(post)\n    return post  # commit runs in the generator's finally-equivalent\n```\n\n`yield`-pattern dependencies guarantee setup-and-teardown semantics\nper request. The transaction commits on success, rolls back on\nexception, and the session is returned to the pool exactly once. This\nis the closest FastAPI gets to a context manager at the route boundary.\n\n---\n\n## Anti-patterns\n\n### Anti-pattern 1 -- Memoizing request-scoped state with `@lru_cache`\n\n```python\n# WRONG\n@lru_cache(maxsize=1)\ndef get_current_user() -> User:\n    # A refactor moved the token lookup into a request-context helper,\n    # so the function takes no arguments and the cache has one entry.\n    return load_user_from_request_context()\n```\n\n`@lru_cache` keys on the function's arguments. With no arguments there\nis exactly one cache entry, so the first request's identity is returned\nto every later request in the worker process. The test suite passes\n(one request, one identity); production serves one user's identity to\neveryone. With a token argument the cache does not share identity, but\non an `async def` it caches the coroutine object, and a repeated token\nfails with `RuntimeError: cannot reuse already awaited coroutine`.\nNever memoize auth dependencies.\n\n### Anti-pattern 2 -- Middleware-only auth that's not visible in route signatures\n\n```python\n# WRONG\n@app.middleware(\"http\")\nasync def auth_middleware(request, call_next):\n    if not request.headers.get(\"Authorization\"):\n        return Response(status_code=401)\n    return await call_next(request)\n\n@app.get(\"\u002Finternal-data\")\nasync def read_internal():\n    # No Depends(get_current_user). Reviewer can't tell from this\n    # signature whether auth is enforced. If the middleware is later\n    # made selective (e.g., only applies to \u002Fapi\u002F**), this route\n    # silently becomes unauthenticated.\n    return {\"sensitive\": \"data\"}\n```\n\nMiddleware-only auth scales poorly: the auth contract isn't visible at\nthe route. A future change to the middleware (or a new route under a\ndifferent prefix) can silently turn off auth. Declare auth as a\n`Depends` so the route's auth requirement is in the type signature.\n\n### Anti-pattern 3 -- Leaving `dependency_overrides` in place across tests\n\n```python\n# WRONG\ndef test_admin_view():\n    app.dependency_overrides[get_current_user] = lambda: User(id=\"admin\")\n    response = client.get(\"\u002Fadmin\u002Fusers\")\n    assert response.status_code == 200\n    # No teardown -- the override persists for every later test, which\n    # then run against the fake admin identity instead of real auth.\n```\n\nUse a fixture with proper teardown:\n\n```python\nimport pytest\nfrom fastapi.testclient import TestClient\n\n@pytest.fixture\ndef admin_client():\n    app.dependency_overrides[get_current_user] = lambda: User(id=\"admin\", email=\"admin@example.test\")\n    client = TestClient(app)\n    yield client\n    app.dependency_overrides.clear()  # teardown\n```\n\nThe fixture's teardown clears the overrides regardless of test outcome.\nFor larger test suites, prefer a per-test fixture instance of the app\nrather than mutating a shared one.\n\n---\n\n## ASI\u002FAST mapping\n\nThis skill addresses **canonical OWASP ASI03 (Identity & Privilege\nAbuse)** from `governance\u002Fowasp-asi-2026\u002Fthreats.md`. Auth-token\nhandling via DI is the load-bearing identity surface in a FastAPI\napplication; the three patterns above (per-route `Depends`, correct\nscoping, yield-pattern cleanup) plus the three anti-patterns enumerate\nthe failure modes that lead to cross-request identity leakage or\nsilent auth bypass.\n\n---\n\n## Testing\n\nFor each protected route, write at least two tests:\n\n```python\ndef test_route_requires_auth():\n    response = client.get(\"\u002Fprofile\")\n    assert response.status_code == 401\n\ndef test_route_returns_authenticated_user_data(admin_client):\n    response = admin_client.get(\"\u002Fprofile\")\n    assert response.status_code == 200\n    assert response.json()[\"id\"] == \"admin\"\n```\n\nAuth-required routes that don't have a `test_route_requires_auth`-style\ntest are a review smell: a future refactor that drops the `Depends`\non the route won't be caught until production traffic hits the\nsuddenly-unauthenticated endpoint.\n\n---\n\n## See also\n\n- `governance\u002Fowasp-asi-2026\u002Fthreats.md` -- ASI03 full text\n- FastAPI docs: https:\u002F\u002Ffastapi.tiangolo.com\u002Ftutorial\u002Fdependencies\u002F\n- FastAPI security:\n  https:\u002F\u002Ffastapi.tiangolo.com\u002Ftutorial\u002Fsecurity\u002F\n","# FastAPI Dependency Injection\n\n> Defends against **OWASP ASI03 (Identity & Privilege Abuse)** in\n> FastAPI applications where the DI graph carries auth-relevant state.\n> FastAPI's DI system is ergonomic for wiring shared dependencies\n> (database sessions, settings, repositories), but its scoping model is\n> per-request only by default -- and that semantic interacts subtly with\n> auth-token handling. Without the patterns here, request-scoped\n> identity can leak across requests via inadvertent caching, or\n> auth-required routes can ship without an enforced auth check because\n> the DI declaration was forgotten.\n\n**Tradeoff:** Explicit `Depends()` declarations on every auth-required\nroute is repetitive vs. relying on global middleware. Worth it:\nper-route auth dependencies are reviewable in isolation, can be\noverridden in tests for the specific route, and produce typed access\nto the authenticated identity inside the handler. Middleware-only auth\nhides the contract from the handler signature.\n\n---\n\n## Why this matters\n\nFastAPI's `Depends()` system resolves dependencies per request by\ndefault -- new database session, fresh auth check, freshly-loaded\nsettings. But the framework also supports `lru_cache`-style memoization\nfor expensive dependencies (settings loading, model loading). If an\nauth-related dependency is inadvertently memoized at the wrong scope,\nthe first request's identity propagates to all subsequent requests\nhitting the same worker process. The error is silent: the test suite\npasses (one request, one identity), production fails (many requests,\nsame memoized identity).\n\nSeparately, `dependency_overrides` -- FastAPI's testing affordance\nthat replaces a dependency for a test run -- is a global mutation on\nthe app's DI registry. A test that forgets to clean up its override\nleaves the override in place for every later test in the session, so\nthose tests exercise a fake identity instead of the real auth check.\n\n---\n\n## Pattern 1 -- Declare auth as a `Depends` on every protected route, never via middleware-only\n\n```python\nfrom fastapi import FastAPI, Depends, HTTPException, status\nfrom fastapi.security import OAuth2PasswordBearer\nfrom pydantic import BaseModel\n\napp = FastAPI()\noauth2_scheme = OAuth2PasswordBearer(tokenUrl=\"token\")\n\nclass User(BaseModel):\n    id: str\n    email: str\n\nasync def get_current_user(token: str = Depends(oauth2_scheme)) -> User:\n    \"\"\"Verify the token and return the authenticated user.\n\n    Returns a fresh User instance per request -- the function body\n    runs on each request, so no cross-request identity leakage.\n    \"\"\"\n    user = await verify_token_against_session_store(token)\n    if user is None:\n        raise HTTPException(\n            status_code=status.HTTP_401_UNAUTHORIZED,\n            detail=\"invalid or expired token\",\n        )\n    return user\n\n@app.get(\"\u002Fprofile\")\nasync def read_profile(current_user: User = Depends(get_current_user)) -> dict:\n    # current_user is the per-request authenticated identity, typed\n    # and visible in the handler signature -- a reviewer sees the auth\n    # requirement directly without reading middleware config.\n    return {\"id\": current_user.id, \"email\": current_user.email}\n```\n\nThe auth requirement appears in the route signature. A new route that\nomits `Depends(get_current_user)` is immediately reviewable as\nunauthenticated -- there's no hidden middleware behavior masking the\nabsence.\n\nFor broad-application auth requirements (e.g., every route under\n`\u002Fadmin\u002F**` requires admin role), use a `dependencies=` list on a\nsub-router or `APIRouter` so the dependency is still visible at the\nroute-group level:\n\n```python\nfrom fastapi import APIRouter, Depends\nfrom .auth import require_admin\n\nadmin_router = APIRouter(\n    prefix=\"\u002Fadmin\",\n    dependencies=[Depends(require_admin)],  # applies to every route under \u002Fadmin\n    tags=[\"admin\"],\n)\n```\n\n---\n\n## Pattern 2 -- Scope expensive-to-construct dependencies correctly\n\n```python\nfrom functools import lru_cache\nfrom fastapi import Depends\nfrom pydantic_settings import BaseSettings, SettingsConfigDict\n\nclass Settings(BaseSettings):\n    model_config = SettingsConfigDict(env_file=\".env\")\n    database_url: str\n    api_key: str\n    feature_flags: dict[str, bool] = {}\n\n@lru_cache(maxsize=1)\ndef get_settings() -> Settings:\n    \"\"\"Settings are app-wide and immutable -- safe to memoize.\"\"\"\n    return Settings()\n\n# In a route:\n@app.get(\"\u002Fconfig\")\nasync def read_config(settings: Settings = Depends(get_settings)) -> dict:\n    return {\"feature_flags\": settings.feature_flags}\n```\n\n`@lru_cache` here is correct because Settings is read-only at process\nstartup. **Do NOT apply `@lru_cache` to functions that return\nrequest-scoped state** (user identity, database sessions, request\ncontext). The cache key is the function's arguments; if the function\nhas no arguments (like `get_settings()`), the result is process-global\nand shared across every request.\n\nThe distinction is binary: process-scoped (settings, model objects,\nhttp clients with their own pool) vs. request-scoped (auth identity,\ndb session, transaction). Mix them up and request-scoped state leaks\nacross requests.\n\n---\n\n## Pattern 3 -- Yield-pattern dependencies for resources needing cleanup\n\n```python\nfrom typing import AsyncGenerator\nfrom sqlalchemy.ext.asyncio import AsyncSession\nfrom fastapi import Depends\n\nasync def get_db_session() -> AsyncGenerator[AsyncSession, None]:\n    async with async_session_factory() as session:\n        try:\n            yield session\n            await session.commit()\n        except Exception:\n            await session.rollback()\n            raise\n\n@app.post(\"\u002Fposts\")\nasync def create_post(\n    payload: PostCreateInput,\n    db: AsyncSession = Depends(get_db_session),\n    current_user: User = Depends(get_current_user),\n) -> Post:\n    post = Post(author_id=current_user.id, **payload.model_dump())\n    db.add(post)\n    return post  # commit runs in the generator's finally-equivalent\n```\n\n`yield`-pattern dependencies guarantee setup-and-teardown semantics\nper request. The transaction commits on success, rolls back on\nexception, and the session is returned to the pool exactly once. This\nis the closest FastAPI gets to a context manager at the route boundary.\n\n---\n\n## Anti-patterns\n\n### Anti-pattern 1 -- Memoizing request-scoped state with `@lru_cache`\n\n```python\n# WRONG\n@lru_cache(maxsize=1)\ndef get_current_user() -> User:\n    # A refactor moved the token lookup into a request-context helper,\n    # so the function takes no arguments and the cache has one entry.\n    return load_user_from_request_context()\n```\n\n`@lru_cache` keys on the function's arguments. With no arguments there\nis exactly one cache entry, so the first request's identity is returned\nto every later request in the worker process. The test suite passes\n(one request, one identity); production serves one user's identity to\neveryone. With a token argument the cache does not share identity, but\non an `async def` it caches the coroutine object, and a repeated token\nfails with `RuntimeError: cannot reuse already awaited coroutine`.\nNever memoize auth dependencies.\n\n### Anti-pattern 2 -- Middleware-only auth that's not visible in route signatures\n\n```python\n# WRONG\n@app.middleware(\"http\")\nasync def auth_middleware(request, call_next):\n    if not request.headers.get(\"Authorization\"):\n        return Response(status_code=401)\n    return await call_next(request)\n\n@app.get(\"\u002Finternal-data\")\nasync def read_internal():\n    # No Depends(get_current_user). Reviewer can't tell from this\n    # signature whether auth is enforced. If the middleware is later\n    # made selective (e.g., only applies to \u002Fapi\u002F**), this route\n    # silently becomes unauthenticated.\n    return {\"sensitive\": \"data\"}\n```\n\nMiddleware-only auth scales poorly: the auth contract isn't visible at\nthe route. A future change to the middleware (or a new route under a\ndifferent prefix) can silently turn off auth. Declare auth as a\n`Depends` so the route's auth requirement is in the type signature.\n\n### Anti-pattern 3 -- Leaving `dependency_overrides` in place across tests\n\n```python\n# WRONG\ndef test_admin_view():\n    app.dependency_overrides[get_current_user] = lambda: User(id=\"admin\")\n    response = client.get(\"\u002Fadmin\u002Fusers\")\n    assert response.status_code == 200\n    # No teardown -- the override persists for every later test, which\n    # then run against the fake admin identity instead of real auth.\n```\n\nUse a fixture with proper teardown:\n\n```python\nimport pytest\nfrom fastapi.testclient import TestClient\n\n@pytest.fixture\ndef admin_client():\n    app.dependency_overrides[get_current_user] = lambda: User(id=\"admin\", email=\"admin@example.test\")\n    client = TestClient(app)\n    yield client\n    app.dependency_overrides.clear()  # teardown\n```\n\nThe fixture's teardown clears the overrides regardless of test outcome.\nFor larger test suites, prefer a per-test fixture instance of the app\nrather than mutating a shared one.\n\n---\n\n## ASI\u002FAST mapping\n\nThis skill addresses **canonical OWASP ASI03 (Identity & Privilege\nAbuse)** from `governance\u002Fowasp-asi-2026\u002Fthreats.md`. Auth-token\nhandling via DI is the load-bearing identity surface in a FastAPI\napplication; the three patterns above (per-route `Depends`, correct\nscoping, yield-pattern cleanup) plus the three anti-patterns enumerate\nthe failure modes that lead to cross-request identity leakage or\nsilent auth bypass.\n\n---\n\n## Testing\n\nFor each protected route, write at least two tests:\n\n```python\ndef test_route_requires_auth():\n    response = client.get(\"\u002Fprofile\")\n    assert response.status_code == 401\n\ndef test_route_returns_authenticated_user_data(admin_client):\n    response = admin_client.get(\"\u002Fprofile\")\n    assert response.status_code == 200\n    assert response.json()[\"id\"] == \"admin\"\n```\n\nAuth-required routes that don't have a `test_route_requires_auth`-style\ntest are a review smell: a future refactor that drops the `Depends`\non the route won't be caught until production traffic hits the\nsuddenly-unauthenticated endpoint.\n\n---\n\n## See also\n\n- `governance\u002Fowasp-asi-2026\u002Fthreats.md` -- ASI03 full text\n- FastAPI docs: https:\u002F\u002Ffastapi.tiangolo.com\u002Ftutorial\u002Fdependencies\u002F\n- FastAPI security:\n  https:\u002F\u002Ffastapi.tiangolo.com\u002Ftutorial\u002Fsecurity\u002F\n",{"name":5,"description":7},"main","5a590e92c8f62b54c96a6928215ac2145b671e03","skills\u002Fstack-specific\u002Ffastapi\u002Fdependency-injection","https:\u002F\u002Fgithub.com\u002FMILTONADINA\u002FDevOPs","https:\u002F\u002Fgithub.com\u002FMILTONADINA","https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Fmiltonadina","CS\u002FCybersecurity SWE & former Epidemiologist. Building secure, test-driven full-stack & mobile apps (TS\u002FReact\u002FNode, Java\u002FSpring, Flutter).","2026-11-14 20:03:36",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add MILTONADINA\u002FDevOPs --skill fastapi-dependency-injection",{"tool":38,"command":39},"bunx","bunx skills add MILTONADINA\u002FDevOPs --skill fastapi-dependency-injection",{"tool":41,"command":42},"pnpm","pnpm dlx skills add MILTONADINA\u002FDevOPs --skill fastapi-dependency-injection","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMILTONADINA\u002FDevOPs\u002Fblob\u002Fmain\u002Fskills\u002Fstack-specific\u002Ffastapi\u002Fdependency-injection\u002FSKILL.md",true,[46],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"SKILL.md.bundle","OTHER","其他",9707,"https:\u002F\u002Fgithub.com\u002FMILTONADINA\u002FDevOPs\u002Fblob\u002Fmain\u002Fskills\u002Fstack-specific\u002Ffastapi\u002Fdependency-injection\u002FSKILL.md.bundle",[53,60,67,74,79,86],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M74F7F3HN6J7CSFHBVQAE9S5","karpathy-guidelines","Behavioral guidelines that reduce common LLM coding mistakes. Apply whenever writing, modifying, or reviewing code. Don't assume requirements, don't overcomplicate, don't refactor unrelated code, and define success criteria before implementing. Use this skill on every non-trivial coding task to avoid bloat, silent assumptions, and completion-bias.","https:\u002F\u002Fgithub.com\u002FMILTONADINA\u002FDevOPs\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fsecurity\u002Fmodified-skill\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M74F7D60N9FRWWWHCGZMMB41","unsigned-missing-sig-fixture","Test fixture (F.09) — SKILL.md without an accompanying .sig file. Default install rejects with exit 2; --allow-unsigned --rationale=\"...\" proceeds.","https:\u002F\u002Fgithub.com\u002FMILTONADINA\u002FDevOPs\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Finstall\u002Fsource-skills\u002Funsigned-missing-sig\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M74F7BKGX67Q606QPKZV7TQV","unsigned-mismatched-sig-fixture","Test fixture (F.09) — SKILL.md whose accompanying .sig signs different content. NFR-F3 hash check catches this even with --allow-unsigned.","https:\u002F\u002Fgithub.com\u002FMILTONADINA\u002FDevOPs\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Finstall\u002Fsource-skills\u002Funsigned-mismatched-sig\u002FSKILL.md",[],[],{"skillNo":75,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":19},"01M74F793BYMX98EQC5XP4CDZK","https:\u002F\u002Fgithub.com\u002FMILTONADINA\u002FDevOPs\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Finstall\u002Fsource-skills\u002Fsigned\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":19},"01M74F7481EBD7G5471ZC4S9YB","webhook-idempotency","Defend against double-processing of webhook events across every provider (Stripe, GitHub, Slack, Twilio, SendGrid). Idempotency-key pattern + replay-window enforcement + dedupe-storage strategy. Triggers on any webhook handler authoring (route matching \u002Fwebhook(s)?\u002F, Stripe-Signature \u002F X-Hub-Signature-256 header references). Defense against OWASP ASI02 (Tool Misuse) -- a replayed webhook that re-triggers a destructive tool is the canonical control-flow-level replay attack. Universal across providers; stack-specific signature verification lives in stack-specific skills.","https:\u002F\u002Fgithub.com\u002FMILTONADINA\u002FDevOPs\u002Fblob\u002Fmain\u002Fskills\u002Funiversal\u002Fsecurity\u002Fwebhook-idempotency\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"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":19},"01M74F71Q6JKRFJ66G5T98KE8H","semgrep-scan","Run Semgrep static analysis to detect insecure code patterns - SQL injection, XSS, path traversal, weak crypto, broken auth, OWASP Top 10 issues. Use on every file change touching security-sensitive code and as part of the tiered security gate. Complements gitleaks (which catches secrets) by catching insecure logic.","https:\u002F\u002Fgithub.com\u002FMILTONADINA\u002FDevOPs\u002Fblob\u002Fmain\u002Fskills\u002Funiversal\u002Fsecurity\u002Fsemgrep-scan\u002FSKILL.md",[],[]]