AGENT SKILL

claude-agent-sdk

Build autonomous AI agents with Claude Agent SDK. TypeScript v0.2.96 | Python v0.1.56. Covers: query(), hooks, subagents, MCP, permissions, sandbox, structured outputs, and sessions. Use when: building AI agents, configuring MCP servers, setting up permissions/hooks, using structured outputs, troubleshooting SDK errors, or working with subagents.

License 许可
MIT
最近更新
2026-11-01
Stars
★ 3
Forks
1

01 前言 Front Matter

name
claude-agent-sdk
description
Build autonomous AI agents with Claude Agent SDK. TypeScript v0.2.96 | Python v0.1.56. Covers: query(), hooks, subagents, MCP, permissions, sandbox, structured outputs, and sessions. Use when: building AI agents, configuring MCP servers, setting up permissions/hooks, using structured outputs, troubleshooting SDK errors, or working with subagents.
user-invocable
true

02 资源文件 107

03 SKILL.md 正文

Claude Agent SDK Reference

TypeScript Python
Version v0.2.96 v0.1.56
Package @anthropic-ai/claude-agent-sdk claude-agent-sdk (PyPI)
Docs TypeScript SDK Python SDK
Repo claude-agent-sdk-typescript claude-agent-sdk-python
Full reference SKILL-typescript.md SKILL-python.md

When you detect the user's language

  • Working with .ts files, TypeScript imports, or npm/node → read SKILL-typescript.md
  • Working with .py files, Python imports, or pip/python → read SKILL-python.md
  • Ambiguous or multi-language → read both as needed

Cross-Language Naming Map

Concept TypeScript Python
One-shot query query(options) query(options)
Stateful client N/A (query manages state) ClaudeSDKClient
Options type Options interface ClaudeAgentOptions dataclass
Tool definition tool(name, schema, handler) @tool(name, desc, schema) decorator
MCP server factory createSdkMcpServer() create_sdk_mcp_server()
Permission callback canUseTool can_use_tool
Permission mode permissionMode: "..." permission_mode="..."
Hook registration hooks: { PreToolUse: [...] } hooks={"PreToolUse": [...]}
System prompt systemPrompt system_prompt
Max turns maxTurns max_turns
Allowed tools allowedTools allowed_tools
MCP servers mcpServers mcp_servers
Subagent def AgentDefinition AgentDefinition dataclass

Shared Concepts (both languages)

Both SDKs wrap the Claude Code CLI and share these concepts:

  • Hooks: Pre/PostToolUse, Stop, SubagentStop, Notification, etc.
  • Permissions: default, acceptEdits, plan, bypassPermissions, etc.
  • MCP Servers: stdio, HTTP, SSE, SDK (in-process) configurations
  • Subagents: Delegate tasks to child agents with scoped tools/permissions
  • Structured Outputs: JSON Schema validation on agent output
  • Sandbox: Container-based isolation (Docker/Kubernetes)
  • Sessions: Capture, resume, and fork conversation state

For API details, code examples, options tables, and known issues, read the language-specific reference file.

04 同仓库更多 Skills

shengdabai
shengdabai/Tony-Claude-Code-Skills

seedance-prompt-en

Write effective prompts for Jimeng Seedance 2.0 multimodal AI video generation. Use when users want to create video prompts using text, images, videos, and audio inputs with the @ reference system. Covers camera movements, effects replication, video extension, editing, music beat-matching, e-commerce ads, short dramas, and educational content.

★ 3
shengdabai
shengdabai/Tony-Claude-Code-Skills

onepage-pdf

Convert an HTML page into a single continuous-page PDF (one tall page, no pagination breaks), preserving desktop layout, backgrounds and selectable text. Use when the user asks to turn an HTML file/report/proposal into a "single-page PDF", "long PDF", "不分页 PDF", "单页 PDF", "长图式 PDF", or complains that an HTML-to-PDF export breaks into pages or cuts content. Supports optional string redaction with leak verification.

★ 3
shengdabai
shengdabai/Tony-Claude-Code-Skills

native-feel-cross-platform-desktop

Use when the user is designing, prototyping, or rewriting a desktop app that must run on multiple OSes (macOS + Windows, optionally Linux) AND feel indistinguishable from a native app to its users — fast launch, native windowing, native input handling, native materials. Trigger words include "cross-platform desktop", "Electron alternative", "Tauri vs native", "WebView wrapper", "near-native performance", "Raycast architecture", "WebKit/WebView2 quirks", "WKWebView", "system tray app", "global hotkey app", "launcher app". Do NOT trigger this skill for pure web apps, pure mobile apps, or for greenfield projects that have no native-feel requirement.

★ 3
shengdabai
shengdabai/Tony-Claude-Code-Skills

gstack

Router for the gstack skill suite. (gstack)

★ 3
shengdabai
shengdabai/Tony-Claude-Code-Skills

fireworks-tech-graph

Use when the user wants to create any technical diagram - architecture, data flow, flowchart, sequence, agent/memory, or concept map - and export as SVG+PNG. Trigger on: "画图" "帮我画" "生成图" "做个图" "架构图" "流程图" "可视化一下" "出图" "generate diagram" "draw diagram" "visualize" or any system/flow description the user wants illustrated.

★ 3
shengdabai
shengdabai/Tony-Claude-Code-Skills

dbs-video-extract

接收抖音、小红书、微信视频号等短视频链接或分享文案,查询作品/账号数据并提取语音文字稿,按作者和标题归档为 Markdown。用户希望完整解析短视频、取得数据或文字稿时使用;运行前检查 TikHub 与轻抖使用凭证,缺少时用新手能理解的方式引导购买和安全配置。

★ 3