[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M781VN71B98VN50625MS78X1":3,"skill-same:01M781VN71B98VN50625MS78X1":49},{"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":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":31,"ownerHtmlUrl":32,"ownerBlogUrl":6,"ownerDescription":33,"updatedAt":34,"install":35,"resources":48},"01M781VN71B98VN50625MS78X1","agentic-development",null,"Build AI agents with Pydantic AI (Python) and Claude SDK (Node.js)","Lord1Egypt\u002Fawesome-skill-forge","Lord1Egypt","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99746359?v=4","01M7592YDNT0XK9WJ0T2MQVPDN","Mohamed Mounir Ali AL Keshita","01M75GRFNHC8VZNWEB8DKDE433",3,"MIT","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fskills_sh\u002Fs\u002Fskills-sh_alinaqi_claude-bootstrap_agentic-development\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: agentic-development\ndescription: Build AI agents with Pydantic AI (Python) and Claude SDK (Node.js)\nwhen-to-use: When building AI agents, tool-using LLM systems, or agentic workflows\nuser-invocable: false\neffort: high\n---\n\n# Agentic Development Skill\n\n\nFor building autonomous AI agents that perform multi-step tasks with tools.\n\n**Sources:** [Claude Agent SDK](https:\u002F\u002Fdocs.anthropic.com\u002Fen\u002Fdocs\u002Fagents-and-tools\u002Fclaude-agent-sdk) | [Anthropic Claude Code Best Practices](https:\u002F\u002Fwww.anthropic.com\u002Fengineering\u002Fclaude-code-best-practices) | [Pydantic AI](https:\u002F\u002Fai.pydantic.dev\u002F) | [Google Gemini Agent Development](https:\u002F\u002Fdevelopers.googleblog.com\u002Fen\u002Fbuilding-agents-google-gemini-open-source-frameworks\u002F) | [OpenAI Building Agents](https:\u002F\u002Fdevelopers.openai.com\u002Ftracks\u002Fbuilding-agents\u002F)\n\n---\n\n## Framework Selection by Language\n\n| Language\u002FFramework | Default | Why |\n|-------------------|---------|-----|\n| **Python** | **Pydantic AI** | Type-safe, Pydantic validation, multi-model, production-ready |\n| **Node.js \u002F Next.js** | **Claude Agent SDK** | Official Anthropic SDK, tools, multi-agent, native streaming |\n\n### Python: Pydantic AI (Default)\n```python\nfrom pydantic_ai import Agent\nfrom pydantic import BaseModel\n\nclass SearchResult(BaseModel):\n    title: str\n    url: str\n    summary: str\n\nagent = Agent(\n    'claude-sonnet-4-20250514',\n    result_type=list[SearchResult],\n    system_prompt='You are a research assistant.',\n)\n\n# Type-safe result\nresult = await agent.run('Find articles about AI agents')\nfor item in result.data:\n    print(f\"{item.title}: {item.url}\")\n```\n\n### Node.js \u002F Next.js: Claude Agent SDK (Default)\n```typescript\nimport Anthropic from \"@anthropic-ai\u002Fsdk\";\n\nconst client = new Anthropic();\n\n\u002F\u002F Define tools\nconst tools: Anthropic.Tool[] = [\n  {\n    name: \"web_search\",\n    description: \"Search the web for information\",\n    input_schema: {\n      type: \"object\",\n      properties: {\n        query: { type: \"string\", description: \"Search query\" },\n      },\n      required: [\"query\"],\n    },\n  },\n];\n\n\u002F\u002F Agentic loop\nasync function runAgent(prompt: string) {\n  const messages: Anthropic.MessageParam[] = [\n    { role: \"user\", content: prompt },\n  ];\n\n  while (true) {\n    const response = await client.messages.create({\n      model: \"claude-sonnet-4-20250514\",\n      max_tokens: 4096,\n      tools,\n      messages,\n    });\n\n    \u002F\u002F Check for tool use\n    if (response.stop_reason === \"tool_use\") {\n      const toolUse = response.content.find((b) => b.type === \"tool_use\");\n      if (toolUse) {\n        const result = await executeTool(toolUse.name, toolUse.input);\n        messages.push({ role: \"assistant\", content: response.content });\n        messages.push({\n          role: \"user\",\n          content: [{ type: \"tool_result\", tool_use_id: toolUse.id, content: result }],\n        });\n        continue;\n      }\n    }\n\n    \u002F\u002F Done - return final response\n    return response.content.find((b) => b.type === \"text\")?.text;\n  }\n}\n```\n\n---\n\n## Core Principle\n\n**Plan first, act incrementally, verify always.**\n\nAgents that research and plan before executing consistently outperform those that jump straight to action. Break complex tasks into verifiable steps, use tools judiciously, and maintain clear state throughout execution.\n\n---\n\n## Agent Architecture\n\n### Three Components (OpenAI)\n```\n┌─────────────────────────────────────────────────┐\n│                    AGENT                        │\n├─────────────────────────────────────────────────┤\n│  Model (Brain)      │ LLM for reasoning &       │\n│                     │ decision-making           │\n├─────────────────────┼───────────────────────────┤\n│  Tools (Arms\u002FLegs)  │ APIs, functions, external │\n│                     │ systems for action        │\n├─────────────────────┼───────────────────────────┤\n│  Instructions       │ System prompts defining   │\n│  (Rules)            │ behavior & boundaries     │\n└─────────────────────┴───────────────────────────┘\n```\n\n### Project Structure\n```\nproject\u002F\n├── src\u002F\n│   ├── agents\u002F\n│   │   ├── orchestrator.ts    # Main agent coordinator\n│   │   ├── specialized\u002F       # Task-specific agents\n│   │   │   ├── researcher.ts\n│   │   │   ├── coder.ts\n│   │   │   └── reviewer.ts\n│   │   └── base.ts            # Shared agent interface\n│   ├── tools\u002F\n│   │   ├── definitions\u002F       # Tool schemas\n│   │   ├── implementations\u002F   # Tool logic\n│   │   └── registry.ts        # Tool discovery\n│   ├── prompts\u002F\n│   │   ├── system\u002F            # Agent instructions\n│   │   └── templates\u002F         # Task templates\n│   └── memory\u002F\n│       ├── conversation.ts    # Short-term context\n│       └── persistent.ts      # Long-term storage\n├── tests\u002F\n│   ├── agents\u002F                # Agent behavior tests\n│   ├── tools\u002F                 # Tool unit tests\n│   └── evals\u002F                 # End-to-end evaluations\n└── skills\u002F                    # Agent skills (Anthropic pattern)\n    ├── skill-name\u002F\n    │   ├── instructions.md\n    │   ├── scripts\u002F\n    │   └── resources\u002F\n```\n\n---\n\n## Workflow Pattern: Explore-Plan-Execute-Verify\n\n### 1. Explore Phase\n```typescript\n\u002F\u002F Gather context before acting\nasync function explore(task: Task): Promise\u003CContext> {\n  const relevantFiles = await agent.searchCodebase(task.query);\n  const existingPatterns = await agent.analyzePatterns(relevantFiles);\n  const dependencies = await agent.identifyDependencies(task);\n\n  return { relevantFiles, existingPatterns, dependencies };\n}\n```\n\n### 2. Plan Phase (Critical)\n```typescript\n\u002F\u002F Plan explicitly before execution\nasync function plan(task: Task, context: Context): Promise\u003CPlan> {\n  const prompt = `\n    Task: ${task.description}\n    Context: ${JSON.stringify(context)}\n\n    Create a step-by-step plan. For each step:\n    1. What action to take\n    2. What tools to use\n    3. How to verify success\n    4. What could go wrong\n\n    Output JSON with steps array.\n  `;\n\n  return await llmCall({ prompt, schema: PlanSchema });\n}\n```\n\n### 3. Execute Phase\n```typescript\n\u002F\u002F Execute with verification at each step\nasync function execute(plan: Plan): Promise\u003CResult[]> {\n  const results: Result[] = [];\n\n  for (const step of plan.steps) {\n    \u002F\u002F Execute single step\n    const result = await executeStep(step);\n\n    \u002F\u002F Verify before continuing\n    if (!await verify(step, result)) {\n      \u002F\u002F Self-correct or escalate\n      const corrected = await selfCorrect(step, result);\n      if (!corrected.success) {\n        return handleFailure(step, results);\n      }\n    }\n\n    results.push(result);\n  }\n\n  return results;\n}\n```\n\n### 4. Verify Phase\n```typescript\n\u002F\u002F Independent verification prevents overfitting\nasync function verify(step: Step, result: Result): Promise\u003Cboolean> {\n  \u002F\u002F Run tests if available\n  if (step.testCommand) {\n    const testResult = await runCommand(step.testCommand);\n    if (!testResult.success) return false;\n  }\n\n  \u002F\u002F Use LLM to verify against criteria\n  const verification = await llmCall({\n    prompt: `\n      Step: ${step.description}\n      Expected: ${step.successCriteria}\n      Actual: ${JSON.stringify(result)}\n\n      Does the result satisfy the success criteria?\n      Respond with { \"passes\": boolean, \"reasoning\": string }\n    `,\n    schema: VerificationSchema\n  });\n\n  return verification.passes;\n}\n```\n\n---\n\n## Tool Design\n\n### Tool Definition Pattern\n```typescript\n\u002F\u002F tools\u002Fdefinitions\u002Ffile-operations.ts\nimport { z } from 'zod';\n\nexport const ReadFileTool = {\n  name: 'read_file',\n  description: 'Read contents of a file. Use before modifying any file.',\n  parameters: z.object({\n    path: z.string().describe('Absolute path to the file'),\n    startLine: z.number().optional().describe('Start line (1-indexed)'),\n    endLine: z.number().optional().describe('End line (1-indexed)'),\n  }),\n  \u002F\u002F Risk level for guardrails (OpenAI pattern)\n  riskLevel: 'low' as const,\n};\n\nexport const WriteFileTool = {\n  name: 'write_file',\n  description: 'Write content to a file. Always read first to understand context.',\n  parameters: z.object({\n    path: z.string().describe('Absolute path to the file'),\n    content: z.string().describe('Complete file content'),\n  }),\n  riskLevel: 'medium' as const,\n  \u002F\u002F Require confirmation for high-risk operations\n  requiresConfirmation: true,\n};\n```\n\n### Tool Implementation\n```typescript\n\u002F\u002F tools\u002Fimplementations\u002Ffile-operations.ts\nexport async function readFile(\n  params: z.infer\u003Ctypeof ReadFileTool.parameters>\n): Promise\u003CToolResult> {\n  try {\n    const content = await fs.readFile(params.path, 'utf-8');\n    const lines = content.split('\\n');\n\n    const start = (params.startLine ?? 1) - 1;\n    const end = params.endLine ?? lines.length;\n\n    return {\n      success: true,\n      data: lines.slice(start, end).join('\\n'),\n      metadata: { totalLines: lines.length }\n    };\n  } catch (error) {\n    return {\n      success: false,\n      error: `Failed to read file: ${error.message}`\n    };\n  }\n}\n```\n\n### Prefer Built-in Tools (OpenAI)\n```typescript\n\u002F\u002F Use platform-provided tools when available\nconst agent = createAgent({\n  tools: [\n    \u002F\u002F Built-in tools (handled by platform)\n    { type: 'web_search' },\n    { type: 'code_interpreter' },\n\n    \u002F\u002F Custom tools only when needed\n    { type: 'function', function: customDatabaseTool },\n  ],\n});\n```\n\n---\n\n## Multi-Agent Patterns\n\n### Single Agent (Default)\nUse one agent for most tasks. Multiple agents add complexity.\n\n### Agent-as-Tool Pattern (OpenAI)\n```typescript\n\u002F\u002F Expose specialized agents as callable tools\nconst researchAgent = createAgent({\n  name: 'researcher',\n  instructions: 'You research topics and return structured findings.',\n  tools: [webSearchTool, documentReadTool],\n});\n\nconst mainAgent = createAgent({\n  tools: [\n    {\n      type: 'function',\n      function: {\n        name: 'research_topic',\n        description: 'Delegate research to specialized agent',\n        parameters: ResearchQuerySchema,\n        handler: async (query) => researchAgent.run(query),\n      },\n    },\n  ],\n});\n```\n\n### Handoff Pattern (OpenAI)\n```typescript\n\u002F\u002F One-way transfer between agents\nconst customerServiceAgent = createAgent({\n  tools: [\n    \u002F\u002F Handoff to specialist when needed\n    {\n      name: 'transfer_to_billing',\n      description: 'Transfer to billing specialist for payment issues',\n      handler: async (context) => {\n        return { handoff: 'billing_agent', context };\n      },\n    },\n  ],\n});\n```\n\n### When to Use Multiple Agents\n- Separate task domains with non-overlapping tools\n- Different authorization levels needed\n- Complex workflows with clear handoff points\n- Parallel execution of independent subtasks\n\n---\n\n## Memory & State\n\n### Conversation Memory\n```typescript\n\u002F\u002F memory\u002Fconversation.ts\ninterface ConversationMemory {\n  messages: Message[];\n  maxTokens: number;\n\n  add(message: Message): void;\n  getContext(): Message[];\n  summarize(): Promise\u003Cstring>;\n}\n\n\u002F\u002F Maintain state across tool calls (Gemini pattern)\ninterface AgentState {\n  thoughtSignature?: string;  \u002F\u002F Encrypted reasoning state\n  conversationId: string;     \u002F\u002F For shared memory\n  currentPlan?: Plan;\n  completedSteps: Step[];\n}\n```\n\n### Persistent Memory\n```typescript\n\u002F\u002F memory\u002Fpersistent.ts\ninterface PersistentMemory {\n  \u002F\u002F Store learnings across sessions\n  store(key: string, value: any): Promise\u003Cvoid>;\n  retrieve(key: string): Promise\u003Cany>;\n\n  \u002F\u002F Semantic search over past interactions\n  search(query: string, limit: number): Promise\u003CMemory[]>;\n}\n```\n\n---\n\n## Guardrails & Safety\n\n### Multi-Layer Protection (OpenAI)\n```typescript\n\u002F\u002F guards\u002Findex.ts\ninterface GuardrailConfig {\n  \u002F\u002F Input validation\n  inputClassifier: (input: string) => Promise\u003CSafetyResult>;\n\n  \u002F\u002F Output validation\n  outputValidator: (output: string) => Promise\u003CSafetyResult>;\n\n  \u002F\u002F Tool risk assessment\n  toolRiskLevels: Record\u003Cstring, 'low' | 'medium' | 'high'>;\n\n  \u002F\u002F Actions requiring human approval\n  humanInTheLoop: string[];\n}\n\nasync function executeWithGuardrails(\n  agent: Agent,\n  input: string,\n  config: GuardrailConfig\n): Promise\u003CResult> {\n  \u002F\u002F 1. Check input safety\n  const inputCheck = await config.inputClassifier(input);\n  if (!inputCheck.safe) {\n    return { blocked: true, reason: inputCheck.reason };\n  }\n\n  \u002F\u002F 2. Execute with tool monitoring\n  const result = await agent.run(input, {\n    beforeTool: async (tool, params) => {\n      const risk = config.toolRiskLevels[tool.name];\n      if (risk === 'high' || config.humanInTheLoop.includes(tool.name)) {\n        return await requestHumanApproval(tool, params);\n      }\n      return { approved: true };\n    },\n  });\n\n  \u002F\u002F 3. Validate output\n  const outputCheck = await config.outputValidator(result.output);\n  if (!outputCheck.safe) {\n    return { blocked: true, reason: outputCheck.reason };\n  }\n\n  return result;\n}\n```\n\n### Scope Enforcement (OpenAI)\n```typescript\n\u002F\u002F Agent must stay within defined scope\nconst agentInstructions = `\nYou are a customer service agent for Acme Corp.\n\nSCOPE BOUNDARIES (non-negotiable):\n- Only answer questions about Acme products and services\n- Never provide legal, medical, or financial advice\n- Never access or modify data outside your authorized scope\n- If a request is out of scope, politely decline and explain why\n\nIf you cannot complete a task within scope, notify the user\nand request explicit approval before proceeding.\n`;\n```\n\n---\n\n## Model Selection\n\n### Match Model to Task\n| Task Complexity | Recommended Model | Notes |\n|-----------------|-------------------|-------|\n| Simple, fast | gpt-5-mini, claude-haiku | Low latency |\n| General purpose | gpt-4.1, claude-sonnet | Balance |\n| Complex reasoning | o4-mini, claude-opus | Higher accuracy |\n| Deep planning | gpt-5 + reasoning, ultrathink | Maximum capability |\n\n### Gemini-Specific\n```typescript\n\u002F\u002F Use thinking_level for reasoning depth\nconst response = await gemini.generate({\n  model: 'gemini-3',\n  thinking_level: 'high',  \u002F\u002F For complex planning\n  temperature: 1.0,        \u002F\u002F Optimized for reasoning engine\n});\n\n\u002F\u002F Preserve thought state across tool calls\nconst nextResponse = await gemini.generate({\n  thoughtSignature: response.thoughtSignature,  \u002F\u002F Required for function calling\n  \u002F\u002F ... rest of params\n});\n```\n\n### Claude-Specific (Thinking Modes)\n```typescript\n\u002F\u002F Trigger extended thinking with keywords\nconst thinkingLevels = {\n  'think': 'standard analysis',\n  'think hard': 'deeper reasoning',\n  'think harder': 'extensive analysis',\n  'ultrathink': 'maximum reasoning budget',\n};\n\nconst prompt = `\nThink hard about this problem before proposing a solution.\n\nTask: ${task.description}\n`;\n```\n\n---\n\n## Testing Agents\n\n### Unit Tests (Tools)\n```typescript\ndescribe('readFile tool', () => {\n  it('reads file content correctly', async () => {\n    const result = await readFile({ path: '\u002Ftest\u002Ffile.txt' });\n    expect(result.success).toBe(true);\n    expect(result.data).toContain('expected content');\n  });\n});\n```\n\n### Behavior Tests (Agent Decisions)\n```typescript\ndescribe('agent planning', () => {\n  it('creates plan before executing file modifications', async () => {\n    const trace = await agent.runWithTrace('Refactor the auth module');\n\n    \u002F\u002F Verify planning happened first\n    const firstToolCall = trace.toolCalls[0];\n    expect(firstToolCall.name).toBe('read_file');\n\n    \u002F\u002F Verify no writes without reads\n    const writeIndex = trace.toolCalls.findIndex(t => t.name === 'write_file');\n    const readIndex = trace.toolCalls.findIndex(t => t.name === 'read_file');\n    expect(readIndex).toBeLessThan(writeIndex);\n  });\n});\n```\n\n### Evaluation Tests\n```typescript\n\u002F\u002F Run nightly, not in regular CI\ndescribe('Agent Accuracy (Eval)', () => {\n  const testCases = loadTestCases('.\u002Fevals\u002Fcoding-tasks.json');\n\n  it.each(testCases)('completes $name correctly', async (testCase) => {\n    const result = await agent.run(testCase.input);\n\n    \u002F\u002F Verify against expected outcomes\n    expect(result.filesModified).toEqual(testCase.expectedFiles);\n    expect(await runTests(testCase.testCommand)).toBe(true);\n  }, 120000);\n});\n```\n\n---\n\n## Pydantic AI Patterns (Python Default)\n\n### Project Structure (Python)\n```\nproject\u002F\n├── src\u002F\n│   ├── agents\u002F\n│   │   ├── __init__.py\n│   │   ├── researcher.py       # Research agent\n│   │   ├── coder.py            # Coding agent\n│   │   └── orchestrator.py     # Main coordinator\n│   ├── tools\u002F\n│   │   ├── __init__.py\n│   │   ├── web.py              # Web search tools\n│   │   ├── files.py            # File operations\n│   │   └── database.py         # DB queries\n│   ├── models\u002F\n│   │   ├── __init__.py\n│   │   └── schemas.py          # Pydantic models\n│   └── deps.py                 # Dependencies\n├── tests\u002F\n│   ├── test_agents.py\n│   └── test_tools.py\n└── pyproject.toml\n```\n\n### Agent with Tools\n```python\nfrom pydantic_ai import Agent, RunContext\nfrom pydantic import BaseModel\nfrom httpx import AsyncClient\n\nclass SearchResult(BaseModel):\n    title: str\n    url: str\n    snippet: str\n\nclass ResearchDeps(BaseModel):\n    http_client: AsyncClient\n    api_key: str\n\nresearch_agent = Agent(\n    'claude-sonnet-4-20250514',\n    deps_type=ResearchDeps,\n    result_type=list[SearchResult],\n    system_prompt='You are a research assistant. Use tools to find information.',\n)\n\n@research_agent.tool\nasync def web_search(ctx: RunContext[ResearchDeps], query: str) -> list[dict]:\n    \"\"\"Search the web for information.\"\"\"\n    response = await ctx.deps.http_client.get(\n        'https:\u002F\u002Fapi.search.com\u002Fsearch',\n        params={'q': query},\n        headers={'Authorization': f'Bearer {ctx.deps.api_key}'},\n    )\n    return response.json()['results']\n\n@research_agent.tool\nasync def read_webpage(ctx: RunContext[ResearchDeps], url: str) -> str:\n    \"\"\"Read and extract content from a webpage.\"\"\"\n    response = await ctx.deps.http_client.get(url)\n    return response.text[:5000]  # Truncate for context\n\n# Usage\nasync def main():\n    async with AsyncClient() as client:\n        deps = ResearchDeps(http_client=client, api_key='...')\n        result = await research_agent.run(\n            'Find recent articles about LLM agents',\n            deps=deps,\n        )\n        for item in result.data:\n            print(f\"- {item.title}\")\n```\n\n### Structured Output with Validation\n```python\nfrom pydantic import BaseModel, Field\nfrom pydantic_ai import Agent\n\nclass CodeReview(BaseModel):\n    summary: str = Field(description=\"Brief summary of the review\")\n    issues: list[str] = Field(description=\"List of issues found\")\n    suggestions: list[str] = Field(description=\"Improvement suggestions\")\n    approval: bool = Field(description=\"Whether code is approved\")\n    confidence: float = Field(ge=0, le=1, description=\"Confidence score\")\n\nreview_agent = Agent(\n    'claude-sonnet-4-20250514',\n    result_type=CodeReview,\n    system_prompt='Review code for quality, security, and best practices.',\n)\n\n# Result is validated Pydantic model\nresult = await review_agent.run(f\"Review this code:\\n```python\\n{code}\\n```\")\nif result.data.approval:\n    print(\"Code approved!\")\nelse:\n    for issue in result.data.issues:\n        print(f\"Issue: {issue}\")\n```\n\n### Multi-Agent Coordination\n```python\nfrom pydantic_ai import Agent\n\n# Specialized agents\nplanner = Agent('claude-sonnet-4-20250514', system_prompt='Create detailed plans.')\nexecutor = Agent('claude-sonnet-4-20250514', system_prompt='Execute tasks precisely.')\nreviewer = Agent('claude-sonnet-4-20250514', system_prompt='Review and verify work.')\n\nasync def orchestrate(task: str):\n    # 1. Plan\n    plan = await planner.run(f\"Create a plan for: {task}\")\n\n    # 2. Execute each step\n    results = []\n    for step in plan.data.steps:\n        result = await executor.run(f\"Execute: {step}\")\n        results.append(result.data)\n\n    # 3. Review\n    review = await reviewer.run(\n        f\"Review the results:\\nTask: {task}\\nResults: {results}\"\n    )\n\n    return review.data\n```\n\n### Streaming Responses\n```python\nfrom pydantic_ai import Agent\n\nagent = Agent('claude-sonnet-4-20250514')\n\nasync def stream_response(prompt: str):\n    async with agent.run_stream(prompt) as response:\n        async for chunk in response.stream():\n            print(chunk, end='', flush=True)\n\n    # Get final structured result\n    result = await response.get_data()\n    return result\n```\n\n### Testing Agents\n```python\nimport pytest\nfrom pydantic_ai import Agent\nfrom pydantic_ai.models.test import TestModel\n\n@pytest.fixture\ndef test_agent():\n    return Agent(\n        TestModel(),  # Mock model for testing\n        result_type=str,\n    )\n\nasync def test_agent_response(test_agent):\n    result = await test_agent.run('Test prompt')\n    assert result.data is not None\n\n# Test with specific responses\nasync def test_with_mock_response():\n    model = TestModel()\n    model.seed_response('Expected output')\n\n    agent = Agent(model)\n    result = await agent.run('Any prompt')\n    assert result.data == 'Expected output'\n```\n\n---\n\n## Skills Pattern (Anthropic)\n\n### Skill Structure\n```\nskills\u002F\n└── code-review\u002F\n    ├── instructions.md      # How to perform code reviews\n    ├── scripts\u002F\n    │   └── run-linters.sh   # Supporting scripts\n    └── resources\u002F\n        └── checklist.md     # Review checklist\n```\n\n### instructions.md Example\n```markdown\n# Code Review Skill\n\n## When to Use\nActivate this skill when asked to review code, PRs, or diffs.\n\n## Process\n1. Read the changed files completely\n2. Run linters: `.\u002Fscripts\u002Frun-linters.sh`\n3. Check against resources\u002Fchecklist.md\n4. Provide structured feedback\n\n## Output Format\n- Summary (1-2 sentences)\n- Issues found (severity: critical\u002Fmajor\u002Fminor)\n- Suggestions for improvement\n- Approval recommendation\n```\n\n### Loading Skills Dynamically\n```typescript\nasync function loadSkill(skillName: string): Promise\u003CSkill> {\n  const skillPath = `.\u002Fskills\u002F${skillName}`;\n  const instructions = await fs.readFile(`${skillPath}\u002Finstructions.md`, 'utf-8');\n  const scripts = await glob(`${skillPath}\u002Fscripts\u002F*`);\n  const resources = await glob(`${skillPath}\u002Fresources\u002F*`);\n\n  return {\n    name: skillName,\n    instructions,\n    scripts: scripts.map(s => ({ name: path.basename(s), path: s })),\n    resources: await Promise.all(resources.map(loadResource)),\n  };\n}\n```\n\n---\n\n## Anti-Patterns\n\n- **No planning before execution** - Agents that jump to action make more errors\n- **Monolithic agents** - One agent with 50 tools becomes confused\n- **No verification** - Agents must verify their own work\n- **Hardcoded tool sequences** - Let the model decide tool order\n- **Missing guardrails** - All agents need safety boundaries\n- **No state management** - Lose context across tool calls\n- **Testing only happy paths** - Test failures and edge cases\n- **Ignoring model differences** - Reasoning models need different prompts\n- **No cost tracking** - Agentic workflows can be expensive\n- **Full automation without oversight** - Human-in-the-loop for critical actions\n\n---\n\n## Quick Reference\n\n### Agent Development Checklist\n- [ ] Define clear agent scope and boundaries\n- [ ] Design tools with explicit schemas and risk levels\n- [ ] Implement explore-plan-execute-verify workflow\n- [ ] Add multi-layer guardrails\n- [ ] Set up conversation and persistent memory\n- [ ] Write behavior and evaluation tests\n- [ ] Configure appropriate model for task complexity\n- [ ] Add human-in-the-loop for high-risk operations\n- [ ] Monitor token usage and costs\n- [ ] Document skills and instructions\n\n### Thinking Triggers (Claude)\n```\n\"think\"        → Standard analysis\n\"think hard\"   → Deeper reasoning\n\"think harder\" → Extensive analysis\n\"ultrathink\"   → Maximum reasoning\n```\n\n### Gemini Settings\n```\nthinking_level: \"high\" | \"low\"\ntemperature: 1.0 (keep at 1.0 for reasoning)\nthoughtSignature: \u003Cpass back for function calling>\n```\n","# Agentic Development Skill\n\n\nFor building autonomous AI agents that perform multi-step tasks with tools.\n\n**Sources:** [Claude Agent SDK](https:\u002F\u002Fdocs.anthropic.com\u002Fen\u002Fdocs\u002Fagents-and-tools\u002Fclaude-agent-sdk) | [Anthropic Claude Code Best Practices](https:\u002F\u002Fwww.anthropic.com\u002Fengineering\u002Fclaude-code-best-practices) | [Pydantic AI](https:\u002F\u002Fai.pydantic.dev\u002F) | [Google Gemini Agent Development](https:\u002F\u002Fdevelopers.googleblog.com\u002Fen\u002Fbuilding-agents-google-gemini-open-source-frameworks\u002F) | [OpenAI Building Agents](https:\u002F\u002Fdevelopers.openai.com\u002Ftracks\u002Fbuilding-agents\u002F)\n\n---\n\n## Framework Selection by Language\n\n| Language\u002FFramework | Default | Why |\n|-------------------|---------|-----|\n| **Python** | **Pydantic AI** | Type-safe, Pydantic validation, multi-model, production-ready |\n| **Node.js \u002F Next.js** | **Claude Agent SDK** | Official Anthropic SDK, tools, multi-agent, native streaming |\n\n### Python: Pydantic AI (Default)\n```python\nfrom pydantic_ai import Agent\nfrom pydantic import BaseModel\n\nclass SearchResult(BaseModel):\n    title: str\n    url: str\n    summary: str\n\nagent = Agent(\n    'claude-sonnet-4-20250514',\n    result_type=list[SearchResult],\n    system_prompt='You are a research assistant.',\n)\n\n# Type-safe result\nresult = await agent.run('Find articles about AI agents')\nfor item in result.data:\n    print(f\"{item.title}: {item.url}\")\n```\n\n### Node.js \u002F Next.js: Claude Agent SDK (Default)\n```typescript\nimport Anthropic from \"@anthropic-ai\u002Fsdk\";\n\nconst client = new Anthropic();\n\n\u002F\u002F Define tools\nconst tools: Anthropic.Tool[] = [\n  {\n    name: \"web_search\",\n    description: \"Search the web for information\",\n    input_schema: {\n      type: \"object\",\n      properties: {\n        query: { type: \"string\", description: \"Search query\" },\n      },\n      required: [\"query\"],\n    },\n  },\n];\n\n\u002F\u002F Agentic loop\nasync function runAgent(prompt: string) {\n  const messages: Anthropic.MessageParam[] = [\n    { role: \"user\", content: prompt },\n  ];\n\n  while (true) {\n    const response = await client.messages.create({\n      model: \"claude-sonnet-4-20250514\",\n      max_tokens: 4096,\n      tools,\n      messages,\n    });\n\n    \u002F\u002F Check for tool use\n    if (response.stop_reason === \"tool_use\") {\n      const toolUse = response.content.find((b) => b.type === \"tool_use\");\n      if (toolUse) {\n        const result = await executeTool(toolUse.name, toolUse.input);\n        messages.push({ role: \"assistant\", content: response.content });\n        messages.push({\n          role: \"user\",\n          content: [{ type: \"tool_result\", tool_use_id: toolUse.id, content: result }],\n        });\n        continue;\n      }\n    }\n\n    \u002F\u002F Done - return final response\n    return response.content.find((b) => b.type === \"text\")?.text;\n  }\n}\n```\n\n---\n\n## Core Principle\n\n**Plan first, act incrementally, verify always.**\n\nAgents that research and plan before executing consistently outperform those that jump straight to action. Break complex tasks into verifiable steps, use tools judiciously, and maintain clear state throughout execution.\n\n---\n\n## Agent Architecture\n\n### Three Components (OpenAI)\n```\n┌─────────────────────────────────────────────────┐\n│                    AGENT                        │\n├─────────────────────────────────────────────────┤\n│  Model (Brain)      │ LLM for reasoning &       │\n│                     │ decision-making           │\n├─────────────────────┼───────────────────────────┤\n│  Tools (Arms\u002FLegs)  │ APIs, functions, external │\n│                     │ systems for action        │\n├─────────────────────┼───────────────────────────┤\n│  Instructions       │ System prompts defining   │\n│  (Rules)            │ behavior & boundaries     │\n└─────────────────────┴───────────────────────────┘\n```\n\n### Project Structure\n```\nproject\u002F\n├── src\u002F\n│   ├── agents\u002F\n│   │   ├── orchestrator.ts    # Main agent coordinator\n│   │   ├── specialized\u002F       # Task-specific agents\n│   │   │   ├── researcher.ts\n│   │   │   ├── coder.ts\n│   │   │   └── reviewer.ts\n│   │   └── base.ts            # Shared agent interface\n│   ├── tools\u002F\n│   │   ├── definitions\u002F       # Tool schemas\n│   │   ├── implementations\u002F   # Tool logic\n│   │   └── registry.ts        # Tool discovery\n│   ├── prompts\u002F\n│   │   ├── system\u002F            # Agent instructions\n│   │   └── templates\u002F         # Task templates\n│   └── memory\u002F\n│       ├── conversation.ts    # Short-term context\n│       └── persistent.ts      # Long-term storage\n├── tests\u002F\n│   ├── agents\u002F                # Agent behavior tests\n│   ├── tools\u002F                 # Tool unit tests\n│   └── evals\u002F                 # End-to-end evaluations\n└── skills\u002F                    # Agent skills (Anthropic pattern)\n    ├── skill-name\u002F\n    │   ├── instructions.md\n    │   ├── scripts\u002F\n    │   └── resources\u002F\n```\n\n---\n\n## Workflow Pattern: Explore-Plan-Execute-Verify\n\n### 1. Explore Phase\n```typescript\n\u002F\u002F Gather context before acting\nasync function explore(task: Task): Promise\u003CContext> {\n  const relevantFiles = await agent.searchCodebase(task.query);\n  const existingPatterns = await agent.analyzePatterns(relevantFiles);\n  const dependencies = await agent.identifyDependencies(task);\n\n  return { relevantFiles, existingPatterns, dependencies };\n}\n```\n\n### 2. Plan Phase (Critical)\n```typescript\n\u002F\u002F Plan explicitly before execution\nasync function plan(task: Task, context: Context): Promise\u003CPlan> {\n  const prompt = `\n    Task: ${task.description}\n    Context: ${JSON.stringify(context)}\n\n    Create a step-by-step plan. For each step:\n    1. What action to take\n    2. What tools to use\n    3. How to verify success\n    4. What could go wrong\n\n    Output JSON with steps array.\n  `;\n\n  return await llmCall({ prompt, schema: PlanSchema });\n}\n```\n\n### 3. Execute Phase\n```typescript\n\u002F\u002F Execute with verification at each step\nasync function execute(plan: Plan): Promise\u003CResult[]> {\n  const results: Result[] = [];\n\n  for (const step of plan.steps) {\n    \u002F\u002F Execute single step\n    const result = await executeStep(step);\n\n    \u002F\u002F Verify before continuing\n    if (!await verify(step, result)) {\n      \u002F\u002F Self-correct or escalate\n      const corrected = await selfCorrect(step, result);\n      if (!corrected.success) {\n        return handleFailure(step, results);\n      }\n    }\n\n    results.push(result);\n  }\n\n  return results;\n}\n```\n\n### 4. Verify Phase\n```typescript\n\u002F\u002F Independent verification prevents overfitting\nasync function verify(step: Step, result: Result): Promise\u003Cboolean> {\n  \u002F\u002F Run tests if available\n  if (step.testCommand) {\n    const testResult = await runCommand(step.testCommand);\n    if (!testResult.success) return false;\n  }\n\n  \u002F\u002F Use LLM to verify against criteria\n  const verification = await llmCall({\n    prompt: `\n      Step: ${step.description}\n      Expected: ${step.successCriteria}\n      Actual: ${JSON.stringify(result)}\n\n      Does the result satisfy the success criteria?\n      Respond with { \"passes\": boolean, \"reasoning\": string }\n    `,\n    schema: VerificationSchema\n  });\n\n  return verification.passes;\n}\n```\n\n---\n\n## Tool Design\n\n### Tool Definition Pattern\n```typescript\n\u002F\u002F tools\u002Fdefinitions\u002Ffile-operations.ts\nimport { z } from 'zod';\n\nexport const ReadFileTool = {\n  name: 'read_file',\n  description: 'Read contents of a file. Use before modifying any file.',\n  parameters: z.object({\n    path: z.string().describe('Absolute path to the file'),\n    startLine: z.number().optional().describe('Start line (1-indexed)'),\n    endLine: z.number().optional().describe('End line (1-indexed)'),\n  }),\n  \u002F\u002F Risk level for guardrails (OpenAI pattern)\n  riskLevel: 'low' as const,\n};\n\nexport const WriteFileTool = {\n  name: 'write_file',\n  description: 'Write content to a file. Always read first to understand context.',\n  parameters: z.object({\n    path: z.string().describe('Absolute path to the file'),\n    content: z.string().describe('Complete file content'),\n  }),\n  riskLevel: 'medium' as const,\n  \u002F\u002F Require confirmation for high-risk operations\n  requiresConfirmation: true,\n};\n```\n\n### Tool Implementation\n```typescript\n\u002F\u002F tools\u002Fimplementations\u002Ffile-operations.ts\nexport async function readFile(\n  params: z.infer\u003Ctypeof ReadFileTool.parameters>\n): Promise\u003CToolResult> {\n  try {\n    const content = await fs.readFile(params.path, 'utf-8');\n    const lines = content.split('\\n');\n\n    const start = (params.startLine ?? 1) - 1;\n    const end = params.endLine ?? lines.length;\n\n    return {\n      success: true,\n      data: lines.slice(start, end).join('\\n'),\n      metadata: { totalLines: lines.length }\n    };\n  } catch (error) {\n    return {\n      success: false,\n      error: `Failed to read file: ${error.message}`\n    };\n  }\n}\n```\n\n### Prefer Built-in Tools (OpenAI)\n```typescript\n\u002F\u002F Use platform-provided tools when available\nconst agent = createAgent({\n  tools: [\n    \u002F\u002F Built-in tools (handled by platform)\n    { type: 'web_search' },\n    { type: 'code_interpreter' },\n\n    \u002F\u002F Custom tools only when needed\n    { type: 'function', function: customDatabaseTool },\n  ],\n});\n```\n\n---\n\n## Multi-Agent Patterns\n\n### Single Agent (Default)\nUse one agent for most tasks. Multiple agents add complexity.\n\n### Agent-as-Tool Pattern (OpenAI)\n```typescript\n\u002F\u002F Expose specialized agents as callable tools\nconst researchAgent = createAgent({\n  name: 'researcher',\n  instructions: 'You research topics and return structured findings.',\n  tools: [webSearchTool, documentReadTool],\n});\n\nconst mainAgent = createAgent({\n  tools: [\n    {\n      type: 'function',\n      function: {\n        name: 'research_topic',\n        description: 'Delegate research to specialized agent',\n        parameters: ResearchQuerySchema,\n        handler: async (query) => researchAgent.run(query),\n      },\n    },\n  ],\n});\n```\n\n### Handoff Pattern (OpenAI)\n```typescript\n\u002F\u002F One-way transfer between agents\nconst customerServiceAgent = createAgent({\n  tools: [\n    \u002F\u002F Handoff to specialist when needed\n    {\n      name: 'transfer_to_billing',\n      description: 'Transfer to billing specialist for payment issues',\n      handler: async (context) => {\n        return { handoff: 'billing_agent', context };\n      },\n    },\n  ],\n});\n```\n\n### When to Use Multiple Agents\n- Separate task domains with non-overlapping tools\n- Different authorization levels needed\n- Complex workflows with clear handoff points\n- Parallel execution of independent subtasks\n\n---\n\n## Memory & State\n\n### Conversation Memory\n```typescript\n\u002F\u002F memory\u002Fconversation.ts\ninterface ConversationMemory {\n  messages: Message[];\n  maxTokens: number;\n\n  add(message: Message): void;\n  getContext(): Message[];\n  summarize(): Promise\u003Cstring>;\n}\n\n\u002F\u002F Maintain state across tool calls (Gemini pattern)\ninterface AgentState {\n  thoughtSignature?: string;  \u002F\u002F Encrypted reasoning state\n  conversationId: string;     \u002F\u002F For shared memory\n  currentPlan?: Plan;\n  completedSteps: Step[];\n}\n```\n\n### Persistent Memory\n```typescript\n\u002F\u002F memory\u002Fpersistent.ts\ninterface PersistentMemory {\n  \u002F\u002F Store learnings across sessions\n  store(key: string, value: any): Promise\u003Cvoid>;\n  retrieve(key: string): Promise\u003Cany>;\n\n  \u002F\u002F Semantic search over past interactions\n  search(query: string, limit: number): Promise\u003CMemory[]>;\n}\n```\n\n---\n\n## Guardrails & Safety\n\n### Multi-Layer Protection (OpenAI)\n```typescript\n\u002F\u002F guards\u002Findex.ts\ninterface GuardrailConfig {\n  \u002F\u002F Input validation\n  inputClassifier: (input: string) => Promise\u003CSafetyResult>;\n\n  \u002F\u002F Output validation\n  outputValidator: (output: string) => Promise\u003CSafetyResult>;\n\n  \u002F\u002F Tool risk assessment\n  toolRiskLevels: Record\u003Cstring, 'low' | 'medium' | 'high'>;\n\n  \u002F\u002F Actions requiring human approval\n  humanInTheLoop: string[];\n}\n\nasync function executeWithGuardrails(\n  agent: Agent,\n  input: string,\n  config: GuardrailConfig\n): Promise\u003CResult> {\n  \u002F\u002F 1. Check input safety\n  const inputCheck = await config.inputClassifier(input);\n  if (!inputCheck.safe) {\n    return { blocked: true, reason: inputCheck.reason };\n  }\n\n  \u002F\u002F 2. Execute with tool monitoring\n  const result = await agent.run(input, {\n    beforeTool: async (tool, params) => {\n      const risk = config.toolRiskLevels[tool.name];\n      if (risk === 'high' || config.humanInTheLoop.includes(tool.name)) {\n        return await requestHumanApproval(tool, params);\n      }\n      return { approved: true };\n    },\n  });\n\n  \u002F\u002F 3. Validate output\n  const outputCheck = await config.outputValidator(result.output);\n  if (!outputCheck.safe) {\n    return { blocked: true, reason: outputCheck.reason };\n  }\n\n  return result;\n}\n```\n\n### Scope Enforcement (OpenAI)\n```typescript\n\u002F\u002F Agent must stay within defined scope\nconst agentInstructions = `\nYou are a customer service agent for Acme Corp.\n\nSCOPE BOUNDARIES (non-negotiable):\n- Only answer questions about Acme products and services\n- Never provide legal, medical, or financial advice\n- Never access or modify data outside your authorized scope\n- If a request is out of scope, politely decline and explain why\n\nIf you cannot complete a task within scope, notify the user\nand request explicit approval before proceeding.\n`;\n```\n\n---\n\n## Model Selection\n\n### Match Model to Task\n| Task Complexity | Recommended Model | Notes |\n|-----------------|-------------------|-------|\n| Simple, fast | gpt-5-mini, claude-haiku | Low latency |\n| General purpose | gpt-4.1, claude-sonnet | Balance |\n| Complex reasoning | o4-mini, claude-opus | Higher accuracy |\n| Deep planning | gpt-5 + reasoning, ultrathink | Maximum capability |\n\n### Gemini-Specific\n```typescript\n\u002F\u002F Use thinking_level for reasoning depth\nconst response = await gemini.generate({\n  model: 'gemini-3',\n  thinking_level: 'high',  \u002F\u002F For complex planning\n  temperature: 1.0,        \u002F\u002F Optimized for reasoning engine\n});\n\n\u002F\u002F Preserve thought state across tool calls\nconst nextResponse = await gemini.generate({\n  thoughtSignature: response.thoughtSignature,  \u002F\u002F Required for function calling\n  \u002F\u002F ... rest of params\n});\n```\n\n### Claude-Specific (Thinking Modes)\n```typescript\n\u002F\u002F Trigger extended thinking with keywords\nconst thinkingLevels = {\n  'think': 'standard analysis',\n  'think hard': 'deeper reasoning',\n  'think harder': 'extensive analysis',\n  'ultrathink': 'maximum reasoning budget',\n};\n\nconst prompt = `\nThink hard about this problem before proposing a solution.\n\nTask: ${task.description}\n`;\n```\n\n---\n\n## Testing Agents\n\n### Unit Tests (Tools)\n```typescript\ndescribe('readFile tool', () => {\n  it('reads file content correctly', async () => {\n    const result = await readFile({ path: '\u002Ftest\u002Ffile.txt' });\n    expect(result.success).toBe(true);\n    expect(result.data).toContain('expected content');\n  });\n});\n```\n\n### Behavior Tests (Agent Decisions)\n```typescript\ndescribe('agent planning', () => {\n  it('creates plan before executing file modifications', async () => {\n    const trace = await agent.runWithTrace('Refactor the auth module');\n\n    \u002F\u002F Verify planning happened first\n    const firstToolCall = trace.toolCalls[0];\n    expect(firstToolCall.name).toBe('read_file');\n\n    \u002F\u002F Verify no writes without reads\n    const writeIndex = trace.toolCalls.findIndex(t => t.name === 'write_file');\n    const readIndex = trace.toolCalls.findIndex(t => t.name === 'read_file');\n    expect(readIndex).toBeLessThan(writeIndex);\n  });\n});\n```\n\n### Evaluation Tests\n```typescript\n\u002F\u002F Run nightly, not in regular CI\ndescribe('Agent Accuracy (Eval)', () => {\n  const testCases = loadTestCases('.\u002Fevals\u002Fcoding-tasks.json');\n\n  it.each(testCases)('completes $name correctly', async (testCase) => {\n    const result = await agent.run(testCase.input);\n\n    \u002F\u002F Verify against expected outcomes\n    expect(result.filesModified).toEqual(testCase.expectedFiles);\n    expect(await runTests(testCase.testCommand)).toBe(true);\n  }, 120000);\n});\n```\n\n---\n\n## Pydantic AI Patterns (Python Default)\n\n### Project Structure (Python)\n```\nproject\u002F\n├── src\u002F\n│   ├── agents\u002F\n│   │   ├── __init__.py\n│   │   ├── researcher.py       # Research agent\n│   │   ├── coder.py            # Coding agent\n│   │   └── orchestrator.py     # Main coordinator\n│   ├── tools\u002F\n│   │   ├── __init__.py\n│   │   ├── web.py              # Web search tools\n│   │   ├── files.py            # File operations\n│   │   └── database.py         # DB queries\n│   ├── models\u002F\n│   │   ├── __init__.py\n│   │   └── schemas.py          # Pydantic models\n│   └── deps.py                 # Dependencies\n├── tests\u002F\n│   ├── test_agents.py\n│   └── test_tools.py\n└── pyproject.toml\n```\n\n### Agent with Tools\n```python\nfrom pydantic_ai import Agent, RunContext\nfrom pydantic import BaseModel\nfrom httpx import AsyncClient\n\nclass SearchResult(BaseModel):\n    title: str\n    url: str\n    snippet: str\n\nclass ResearchDeps(BaseModel):\n    http_client: AsyncClient\n    api_key: str\n\nresearch_agent = Agent(\n    'claude-sonnet-4-20250514',\n    deps_type=ResearchDeps,\n    result_type=list[SearchResult],\n    system_prompt='You are a research assistant. Use tools to find information.',\n)\n\n@research_agent.tool\nasync def web_search(ctx: RunContext[ResearchDeps], query: str) -> list[dict]:\n    \"\"\"Search the web for information.\"\"\"\n    response = await ctx.deps.http_client.get(\n        'https:\u002F\u002Fapi.search.com\u002Fsearch',\n        params={'q': query},\n        headers={'Authorization': f'Bearer {ctx.deps.api_key}'},\n    )\n    return response.json()['results']\n\n@research_agent.tool\nasync def read_webpage(ctx: RunContext[ResearchDeps], url: str) -> str:\n    \"\"\"Read and extract content from a webpage.\"\"\"\n    response = await ctx.deps.http_client.get(url)\n    return response.text[:5000]  # Truncate for context\n\n# Usage\nasync def main():\n    async with AsyncClient() as client:\n        deps = ResearchDeps(http_client=client, api_key='...')\n        result = await research_agent.run(\n            'Find recent articles about LLM agents',\n            deps=deps,\n        )\n        for item in result.data:\n            print(f\"- {item.title}\")\n```\n\n### Structured Output with Validation\n```python\nfrom pydantic import BaseModel, Field\nfrom pydantic_ai import Agent\n\nclass CodeReview(BaseModel):\n    summary: str = Field(description=\"Brief summary of the review\")\n    issues: list[str] = Field(description=\"List of issues found\")\n    suggestions: list[str] = Field(description=\"Improvement suggestions\")\n    approval: bool = Field(description=\"Whether code is approved\")\n    confidence: float = Field(ge=0, le=1, description=\"Confidence score\")\n\nreview_agent = Agent(\n    'claude-sonnet-4-20250514',\n    result_type=CodeReview,\n    system_prompt='Review code for quality, security, and best practices.',\n)\n\n# Result is validated Pydantic model\nresult = await review_agent.run(f\"Review this code:\\n```python\\n{code}\\n```\")\nif result.data.approval:\n    print(\"Code approved!\")\nelse:\n    for issue in result.data.issues:\n        print(f\"Issue: {issue}\")\n```\n\n### Multi-Agent Coordination\n```python\nfrom pydantic_ai import Agent\n\n# Specialized agents\nplanner = Agent('claude-sonnet-4-20250514', system_prompt='Create detailed plans.')\nexecutor = Agent('claude-sonnet-4-20250514', system_prompt='Execute tasks precisely.')\nreviewer = Agent('claude-sonnet-4-20250514', system_prompt='Review and verify work.')\n\nasync def orchestrate(task: str):\n    # 1. Plan\n    plan = await planner.run(f\"Create a plan for: {task}\")\n\n    # 2. Execute each step\n    results = []\n    for step in plan.data.steps:\n        result = await executor.run(f\"Execute: {step}\")\n        results.append(result.data)\n\n    # 3. Review\n    review = await reviewer.run(\n        f\"Review the results:\\nTask: {task}\\nResults: {results}\"\n    )\n\n    return review.data\n```\n\n### Streaming Responses\n```python\nfrom pydantic_ai import Agent\n\nagent = Agent('claude-sonnet-4-20250514')\n\nasync def stream_response(prompt: str):\n    async with agent.run_stream(prompt) as response:\n        async for chunk in response.stream():\n            print(chunk, end='', flush=True)\n\n    # Get final structured result\n    result = await response.get_data()\n    return result\n```\n\n### Testing Agents\n```python\nimport pytest\nfrom pydantic_ai import Agent\nfrom pydantic_ai.models.test import TestModel\n\n@pytest.fixture\ndef test_agent():\n    return Agent(\n        TestModel(),  # Mock model for testing\n        result_type=str,\n    )\n\nasync def test_agent_response(test_agent):\n    result = await test_agent.run('Test prompt')\n    assert result.data is not None\n\n# Test with specific responses\nasync def test_with_mock_response():\n    model = TestModel()\n    model.seed_response('Expected output')\n\n    agent = Agent(model)\n    result = await agent.run('Any prompt')\n    assert result.data == 'Expected output'\n```\n\n---\n\n## Skills Pattern (Anthropic)\n\n### Skill Structure\n```\nskills\u002F\n└── code-review\u002F\n    ├── instructions.md      # How to perform code reviews\n    ├── scripts\u002F\n    │   └── run-linters.sh   # Supporting scripts\n    └── resources\u002F\n        └── checklist.md     # Review checklist\n```\n\n### instructions.md Example\n```markdown\n# Code Review Skill\n\n## When to Use\nActivate this skill when asked to review code, PRs, or diffs.\n\n## Process\n1. Read the changed files completely\n2. Run linters: `.\u002Fscripts\u002Frun-linters.sh`\n3. Check against resources\u002Fchecklist.md\n4. Provide structured feedback\n\n## Output Format\n- Summary (1-2 sentences)\n- Issues found (severity: critical\u002Fmajor\u002Fminor)\n- Suggestions for improvement\n- Approval recommendation\n```\n\n### Loading Skills Dynamically\n```typescript\nasync function loadSkill(skillName: string): Promise\u003CSkill> {\n  const skillPath = `.\u002Fskills\u002F${skillName}`;\n  const instructions = await fs.readFile(`${skillPath}\u002Finstructions.md`, 'utf-8');\n  const scripts = await glob(`${skillPath}\u002Fscripts\u002F*`);\n  const resources = await glob(`${skillPath}\u002Fresources\u002F*`);\n\n  return {\n    name: skillName,\n    instructions,\n    scripts: scripts.map(s => ({ name: path.basename(s), path: s })),\n    resources: await Promise.all(resources.map(loadResource)),\n  };\n}\n```\n\n---\n\n## Anti-Patterns\n\n- **No planning before execution** - Agents that jump to action make more errors\n- **Monolithic agents** - One agent with 50 tools becomes confused\n- **No verification** - Agents must verify their own work\n- **Hardcoded tool sequences** - Let the model decide tool order\n- **Missing guardrails** - All agents need safety boundaries\n- **No state management** - Lose context across tool calls\n- **Testing only happy paths** - Test failures and edge cases\n- **Ignoring model differences** - Reasoning models need different prompts\n- **No cost tracking** - Agentic workflows can be expensive\n- **Full automation without oversight** - Human-in-the-loop for critical actions\n\n---\n\n## Quick Reference\n\n### Agent Development Checklist\n- [ ] Define clear agent scope and boundaries\n- [ ] Design tools with explicit schemas and risk levels\n- [ ] Implement explore-plan-execute-verify workflow\n- [ ] Add multi-layer guardrails\n- [ ] Set up conversation and persistent memory\n- [ ] Write behavior and evaluation tests\n- [ ] Configure appropriate model for task complexity\n- [ ] Add human-in-the-loop for high-risk operations\n- [ ] Monitor token usage and costs\n- [ ] Document skills and instructions\n\n### Thinking Triggers (Claude)\n```\n\"think\"        → Standard analysis\n\"think hard\"   → Deeper reasoning\n\"think harder\" → Extensive analysis\n\"ultrathink\"   → Maximum reasoning\n```\n\n### Gemini Settings\n```\nthinking_level: \"high\" | \"low\"\ntemperature: 1.0 (keep at 1.0 for reasoning)\nthoughtSignature: \u003Cpass back for function calling>\n```\n",{"name":5,"effort":24,"description":7,"when-to-use":25,"user-invocable":20},"high","When building AI agents, tool-using LLM systems, or agentic workflows","master","4aa004da461d820f4ea5499e58eb8d196cf99016","community\u002Fskills_sh\u002Fs\u002Fskills-sh_alinaqi_claude-bootstrap_agentic-development",0,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge","https:\u002F\u002Fskill-explorer-rho.vercel.app","https:\u002F\u002Fgithub.com\u002FLord1Egypt","Unbreakable. Unstoppable. Unmatched⚡.\r\n Speaker of machine tongues 🤖  | World-builder of decentralized dreams 🌐 | Defender of the digital realm🛡️.","2026-06-10 08:21:01",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add Lord1Egypt\u002Fawesome-skill-forge --skill agentic-development",{"tool":41,"command":42},"bunx","bunx skills add Lord1Egypt\u002Fawesome-skill-forge --skill agentic-development",{"tool":44,"command":45},"pnpm","pnpm dlx skills add Lord1Egypt\u002Fawesome-skill-forge --skill agentic-development","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fskills_sh\u002Fs\u002Fskills-sh_alinaqi_claude-bootstrap_agentic-development\u002FSKILL.md",true,[],[50,57,64,71,78,85],{"skillNo":51,"name":52,"nameZh":6,"description":53,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":19},"01M785WKJB99G3STR1NF9NRTJW","youtube-content","YouTube transcripts to summaries, threads, blogs.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fyoutube-content\u002FSKILL.md",[],[],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M785WEFHB0G2S9YA6EPR3H0E","xurl","X\u002FTwitter via xurl CLI: post, search, DM, media, v2 API.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fxurl\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M785W98EDN4EFJXJPMQEHCRC","touchdesigner-mcp","Control a running TouchDesigner instance via twozero MCP — create operators, set parameters, wire connections, execute Python, build real-time visuals. 36 native tools.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftouchdesigner-mcp\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M785W5S9FP3QBH2V191E025P","test-driven-development","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftest-driven-development\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M785W2AS08NSSH9YATCV6FJB","teams-meeting-pipeline","Operate the Teams meeting summary pipeline via Hermes CLI — summarize meetings, inspect pipeline status, replay jobs, manage Microsoft Graph subscriptions.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fteams-meeting-pipeline\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M785VXKW4T34BTP1SCHW1R7F","systematic-debugging","4-phase root cause debugging: understand bugs before fixing.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fsystematic-debugging\u002FSKILL.md",[],[]]