[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6CC13MYFPG3P7TW3NSK0P8Z":3,"skill-same:01M6CC13MYFPG3P7TW3NSK0P8Z":63},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":31,"linkOnly":32,"markdownContent":33,"markdownBody":34,"frontMatter":35,"refName":36,"commitSha":37,"skillDirectory":38,"forksCount":39,"repositoryHtmlUrl":40,"repositoryHomepageUrl":6,"ownerHtmlUrl":41,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":42,"install":43,"resources":56},"01M6CC13MYFPG3P7TW3NSK0P8Z","pydantic-ai-dependency-injection",null,"Implement dependency injection in PydanticAI agents using RunContext and deps_type. Use when agents need database connections, API clients, user context, or any external resources.","ray-manaloto\u002Fmacos-development-environment","ray-manaloto","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F227192835?v=4","01M6CBR7J13ZA01X5YB1A1QRJP","01M6CBR7P0S3NS8ZV81JYNST14",1,"MIT","https:\u002F\u002Fgithub.com\u002Fray-manaloto\u002Fmacos-development-environment\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fskills\u002Fpydantic-ai-dependency-injection\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30],"Pydantic","pydantic ai","injection","dependency","pydantic ai dependency injection","implement","database","user context","api","deps","context","user","use","2026-11-10 10:12:30",false,"---\nname: pydantic-ai-dependency-injection\ndescription: Implement dependency injection in PydanticAI agents using RunContext and deps_type. Use when agents need database connections, API clients, user context, or any external resources.\n---\n\n# PydanticAI Dependency Injection\n\n## Core Pattern\n\nDependencies flow through `RunContext`:\n\n```python\nfrom dataclasses import dataclass\nfrom pydantic_ai import Agent, RunContext\n\n@dataclass\nclass Deps:\n    db: DatabaseConn\n    api_client: HttpClient\n    user_id: int\n\nagent = Agent(\n    'openai:gpt-4o',\n    deps_type=Deps,  # Type for static analysis\n)\n\n@agent.tool\nasync def get_user_balance(ctx: RunContext[Deps]) -> float:\n    \"\"\"Get the current user's account balance.\"\"\"\n    return await ctx.deps.db.get_balance(ctx.deps.user_id)\n\n# At runtime, provide deps\nresult = await agent.run(\n    'What is my balance?',\n    deps=Deps(db=db_conn, api_client=client, user_id=123)\n)\n```\n\n## Defining Dependencies\n\nUse dataclasses or Pydantic models:\n\n```python\nfrom dataclasses import dataclass\nfrom pydantic import BaseModel\n\n# Dataclass (recommended for simplicity)\n@dataclass\nclass Deps:\n    db: DatabaseConnection\n    cache: CacheClient\n    user_context: UserContext\n\n# Pydantic model (if you need validation)\nclass Deps(BaseModel):\n    api_key: str\n    endpoint: str\n    timeout: int = 30\n```\n\n## Accessing Dependencies\n\nIn tools and instructions:\n\n```python\n@agent.tool\nasync def query_database(ctx: RunContext[Deps], query: str) -> list[dict]:\n    \"\"\"Run a database query.\"\"\"\n    return await ctx.deps.db.execute(query)\n\n@agent.instructions\nasync def add_user_context(ctx: RunContext[Deps]) -> str:\n    user = await ctx.deps.db.get_user(ctx.deps.user_id)\n    return f\"User name: {user.name}, Role: {user.role}\"\n\n@agent.system_prompt\ndef add_permissions(ctx: RunContext[Deps]) -> str:\n    return f\"User has permissions: {ctx.deps.permissions}\"\n```\n\n## Type Safety\n\nFull type checking with generics:\n\n```python\n# Explicit agent type annotation\nagent: Agent[Deps, OutputModel] = Agent(\n    'openai:gpt-4o',\n    deps_type=Deps,\n    output_type=OutputModel,\n)\n\n# Now these are type-checked:\n# - ctx.deps in tools is typed as Deps\n# - result.output is typed as OutputModel\n# - agent.run() requires deps: Deps\n```\n\n## No Dependencies Pattern\n\nWhen you don't need dependencies:\n\n```python\n# Option 1: No deps_type (defaults to NoneType)\nagent = Agent('openai:gpt-4o')\nresult = agent.run_sync('Hello')  # No deps needed\n\n# Option 2: Explicit None for type checker\nagent: Agent[None, str] = Agent('openai:gpt-4o')\nresult = agent.run_sync('Hello', deps=None)\n\n# In tool_plain, no context access\n@agent.tool_plain\ndef simple_calc(a: int, b: int) -> int:\n    return a + b\n```\n\n## Complete Example\n\n```python\nfrom dataclasses import dataclass\nfrom httpx import AsyncClient\nfrom pydantic import BaseModel\nfrom pydantic_ai import Agent, RunContext\n\n@dataclass\nclass WeatherDeps:\n    client: AsyncClient\n    api_key: str\n\nclass WeatherReport(BaseModel):\n    location: str\n    temperature: float\n    conditions: str\n\nagent: Agent[WeatherDeps, WeatherReport] = Agent(\n    'openai:gpt-4o',\n    deps_type=WeatherDeps,\n    output_type=WeatherReport,\n    instructions='You are a weather assistant.',\n)\n\n@agent.tool\nasync def get_weather(\n    ctx: RunContext[WeatherDeps],\n    city: str\n) -> dict:\n    \"\"\"Fetch weather data for a city.\"\"\"\n    response = await ctx.deps.client.get(\n        f'https:\u002F\u002Fapi.weather.com\u002F{city}',\n        headers={'Authorization': ctx.deps.api_key}\n    )\n    return response.json()\n\nasync def main():\n    async with AsyncClient() as client:\n        deps = WeatherDeps(client=client, api_key='secret')\n        result = await agent.run('Weather in London?', deps=deps)\n        print(result.output.temperature)\n```\n\n## Override for Testing\n\n```python\nfrom pydantic_ai.models.test import TestModel\n\n# Create mock dependencies\nmock_deps = Deps(\n    db=MockDatabase(),\n    api_client=MockClient(),\n    user_id=999\n)\n\n# Override model and deps for testing\nwith agent.override(model=TestModel(), deps=mock_deps):\n    result = agent.run_sync('Test prompt')\n```\n\n## Best Practices\n\n1. **Keep deps immutable**: Use frozen dataclasses or Pydantic models\n2. **Pass connections, not credentials**: Deps should hold initialized clients\n3. **Type your agents**: Use `Agent[DepsType, OutputType]` for full type safety\n4. **Scope deps appropriately**: Create deps at the start of a request, close after\n","# PydanticAI Dependency Injection\n\n## Core Pattern\n\nDependencies flow through `RunContext`:\n\n```python\nfrom dataclasses import dataclass\nfrom pydantic_ai import Agent, RunContext\n\n@dataclass\nclass Deps:\n    db: DatabaseConn\n    api_client: HttpClient\n    user_id: int\n\nagent = Agent(\n    'openai:gpt-4o',\n    deps_type=Deps,  # Type for static analysis\n)\n\n@agent.tool\nasync def get_user_balance(ctx: RunContext[Deps]) -> float:\n    \"\"\"Get the current user's account balance.\"\"\"\n    return await ctx.deps.db.get_balance(ctx.deps.user_id)\n\n# At runtime, provide deps\nresult = await agent.run(\n    'What is my balance?',\n    deps=Deps(db=db_conn, api_client=client, user_id=123)\n)\n```\n\n## Defining Dependencies\n\nUse dataclasses or Pydantic models:\n\n```python\nfrom dataclasses import dataclass\nfrom pydantic import BaseModel\n\n# Dataclass (recommended for simplicity)\n@dataclass\nclass Deps:\n    db: DatabaseConnection\n    cache: CacheClient\n    user_context: UserContext\n\n# Pydantic model (if you need validation)\nclass Deps(BaseModel):\n    api_key: str\n    endpoint: str\n    timeout: int = 30\n```\n\n## Accessing Dependencies\n\nIn tools and instructions:\n\n```python\n@agent.tool\nasync def query_database(ctx: RunContext[Deps], query: str) -> list[dict]:\n    \"\"\"Run a database query.\"\"\"\n    return await ctx.deps.db.execute(query)\n\n@agent.instructions\nasync def add_user_context(ctx: RunContext[Deps]) -> str:\n    user = await ctx.deps.db.get_user(ctx.deps.user_id)\n    return f\"User name: {user.name}, Role: {user.role}\"\n\n@agent.system_prompt\ndef add_permissions(ctx: RunContext[Deps]) -> str:\n    return f\"User has permissions: {ctx.deps.permissions}\"\n```\n\n## Type Safety\n\nFull type checking with generics:\n\n```python\n# Explicit agent type annotation\nagent: Agent[Deps, OutputModel] = Agent(\n    'openai:gpt-4o',\n    deps_type=Deps,\n    output_type=OutputModel,\n)\n\n# Now these are type-checked:\n# - ctx.deps in tools is typed as Deps\n# - result.output is typed as OutputModel\n# - agent.run() requires deps: Deps\n```\n\n## No Dependencies Pattern\n\nWhen you don't need dependencies:\n\n```python\n# Option 1: No deps_type (defaults to NoneType)\nagent = Agent('openai:gpt-4o')\nresult = agent.run_sync('Hello')  # No deps needed\n\n# Option 2: Explicit None for type checker\nagent: Agent[None, str] = Agent('openai:gpt-4o')\nresult = agent.run_sync('Hello', deps=None)\n\n# In tool_plain, no context access\n@agent.tool_plain\ndef simple_calc(a: int, b: int) -> int:\n    return a + b\n```\n\n## Complete Example\n\n```python\nfrom dataclasses import dataclass\nfrom httpx import AsyncClient\nfrom pydantic import BaseModel\nfrom pydantic_ai import Agent, RunContext\n\n@dataclass\nclass WeatherDeps:\n    client: AsyncClient\n    api_key: str\n\nclass WeatherReport(BaseModel):\n    location: str\n    temperature: float\n    conditions: str\n\nagent: Agent[WeatherDeps, WeatherReport] = Agent(\n    'openai:gpt-4o',\n    deps_type=WeatherDeps,\n    output_type=WeatherReport,\n    instructions='You are a weather assistant.',\n)\n\n@agent.tool\nasync def get_weather(\n    ctx: RunContext[WeatherDeps],\n    city: str\n) -> dict:\n    \"\"\"Fetch weather data for a city.\"\"\"\n    response = await ctx.deps.client.get(\n        f'https:\u002F\u002Fapi.weather.com\u002F{city}',\n        headers={'Authorization': ctx.deps.api_key}\n    )\n    return response.json()\n\nasync def main():\n    async with AsyncClient() as client:\n        deps = WeatherDeps(client=client, api_key='secret')\n        result = await agent.run('Weather in London?', deps=deps)\n        print(result.output.temperature)\n```\n\n## Override for Testing\n\n```python\nfrom pydantic_ai.models.test import TestModel\n\n# Create mock dependencies\nmock_deps = Deps(\n    db=MockDatabase(),\n    api_client=MockClient(),\n    user_id=999\n)\n\n# Override model and deps for testing\nwith agent.override(model=TestModel(), deps=mock_deps):\n    result = agent.run_sync('Test prompt')\n```\n\n## Best Practices\n\n1. **Keep deps immutable**: Use frozen dataclasses or Pydantic models\n2. **Pass connections, not credentials**: Deps should hold initialized clients\n3. **Type your agents**: Use `Agent[DepsType, OutputType]` for full type safety\n4. **Scope deps appropriately**: Create deps at the start of a request, close after\n",{"name":5,"description":7},"main","716b17df3ef6719d88aeac180015008b7ddfff6f",".claude\u002Fskills\u002Fskills\u002Fpydantic-ai-dependency-injection",0,"https:\u002F\u002Fgithub.com\u002Fray-manaloto\u002Fmacos-development-environment","https:\u002F\u002Fgithub.com\u002Fray-manaloto","2026-08-03 16:55:50",{"source":8,"skillName":5,"commands":44,"prompt":54,"zipAvailable":55},[45,48,51],{"tool":46,"command":47},"npx","npx skills add ray-manaloto\u002Fmacos-development-environment --skill pydantic-ai-dependency-injection",{"tool":49,"command":50},"bunx","bunx skills add ray-manaloto\u002Fmacos-development-environment --skill pydantic-ai-dependency-injection",{"tool":52,"command":53},"pnpm","pnpm dlx skills add ray-manaloto\u002Fmacos-development-environment --skill pydantic-ai-dependency-injection","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fray-manaloto\u002Fmacos-development-environment\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fskills\u002Fpydantic-ai-dependency-injection\u002FSKILL.md",true,[57],{"path":58,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":61,"sourceHtmlUrl":62},"agents\u002Fopenai.yaml","REFERENCE","参考文档",121,"https:\u002F\u002Fgithub.com\u002Fmalinskibeniamin\u002Fskills\u002Fblob\u002Fmain\u002Fcodex-skills\u002Fplan-arbiter\u002Fagents\u002Fopenai.yaml",[64,80,98,117,134,148],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":31},"01M6CC8DXNJ39YWERYTWCGGCGG","next-workflow-step","Use this skill when the user wants to transition to the next workflow step, wrap up a session cleanly, prepare a handoff, or says things like \"next step\", \"continue the workflow\", \"wrap up\", \"hand off\", \"move to the next phase\", \"what's next in embrace\", or \"prepare for \u002Fclear\". Also triggers when the current octo:embrace phase appears complete and no explicit next action is set.","https:\u002F\u002Fgithub.com\u002Fray-manaloto\u002Fmacos-development-environment\u002Fblob\u002Fmain\u002Frsm-subagents\u002Fplugins\u002Fworkflow-toolkit\u002Fskills\u002Fnext-workflow-step\u002FSKILL.md",[],[71,72,73,30,74,29,75,76,77,78,79],"next workflow step","workflow","up","session","wrap up","continue","handoff","prepare","SET",{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":31},"01M6CC8BRZBQHEBXGMKPDM422P","source-discovery","This skill should be used when the user asks to \"find sources\", \"discover URLs\", \"catalog a source\", \"classify a URL\", \"search for libraries\", \"check what exists\", or mentions source discovery, URL cataloging, source classification, or research source management.","https:\u002F\u002Fgithub.com\u002Fray-manaloto\u002Fmacos-development-environment\u002Fblob\u002Fmain\u002Frsm-subagents\u002Fplugins\u002Fresearch-review-toolkit\u002Fskills\u002Fsource-discovery\u002FSKILL.md",[],[87,88,89,90,91,92,93,94,95,29,96,97],"discovery","source discovery","research","libraries","search","classification","find","check","management","catalog","find sources",{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":31},"01M6CC89CGJP69A0PS22G2H1FV","review-synthesis","This skill should be used when the user asks to \"summarize review findings\", \"prioritize fixes\", \"rank review issues\", \"combine reviewer feedback\", \"create action items from review\", or mentions review synthesis, finding prioritization, severity ranking, or review result summarization.","https:\u002F\u002Fgithub.com\u002Fray-manaloto\u002Fmacos-development-environment\u002Fblob\u002Fmain\u002Frsm-subagents\u002Fplugins\u002Fresearch-review-toolkit\u002Fskills\u002Freview-synthesis\u002FSKILL.md",[],[105,106,107,108,109,110,111,29,112,113,114,115,116],"review","review synthesis","Synthesis","prioritize","create action","feedback","reviewer","summarize","prioritization","create","issues","severity",{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":123,"publishedAt":31},"01M6CC872EZ9GRJY0HRCG0RT2M","research-scoring","This skill should be used when the user asks to \"score research\", \"check research quality\", \"evaluate coverage\", \"measure improvement\", \"assess research completeness\", or mentions research scoring, quality metrics, coverage gaps, improvement baseline, or research pipeline status.","https:\u002F\u002Fgithub.com\u002Fray-manaloto\u002Fmacos-development-environment\u002Fblob\u002Fmain\u002Frsm-subagents\u002Fplugins\u002Fresearch-review-toolkit\u002Fskills\u002Fresearch-scoring\u002FSKILL.md",[],[124,89,125,126,127,128,129,130,94,29,131,132,133],"research scoring","status","coverage gaps","metrics","pipeline","baseline","quality","coverage","pipeline status","research quality",{"skillNo":135,"name":136,"nameZh":6,"description":137,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":138,"categories":139,"keywords":140,"publishedAt":31},"01M6CC852HSDS1FE4EJAT0RHGR","notebooklm-integration","This skill should be used when the user asks to \"ingest into NotebookLM\", \"query NotebookLM\", \"add sources to notebook\", \"cross-source synthesis\", \"check stale sources\", or mentions NotebookLM, notebook integration, source ingestion, or knowledge consolidation.","https:\u002F\u002Fgithub.com\u002Fray-manaloto\u002Fmacos-development-environment\u002Fblob\u002Fmain\u002Frsm-subagents\u002Fplugins\u002Fresearch-review-toolkit\u002Fskills\u002Fnotebooklm-integration\u002FSKILL.md",[],[141,142,143,144,94,29,145,146,147,107],"notebooklm integration","notebooklm","integration","knowledge","ingestion","ingest","stale",{"skillNo":149,"name":150,"nameZh":6,"description":151,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":152,"categories":153,"keywords":154,"publishedAt":31},"01M6CC82Z4V3205KCJWQZPS2VG","evidence-synthesis","This skill should be used when the user asks to \"synthesize findings\", \"combine research\", \"cross-reference sources\", \"summarize evidence\", \"write a deep review\", or mentions evidence synthesis, finding consolidation, cross-source analysis, or research summarization.","https:\u002F\u002Fgithub.com\u002Fray-manaloto\u002Fmacos-development-environment\u002Fblob\u002Fmain\u002Frsm-subagents\u002Fplugins\u002Fresearch-review-toolkit\u002Fskills\u002Fevidence-synthesis\u002FSKILL.md",[],[155,107,156,112,89,157,158,159,29,160,105],"evidence synthesis","evidence","deep review","analysis","write","reference"]