claude-agent-sdk
Skill40 starsChanged 8 months agoMITView on GitHub
Build AI agents using the Claude Agent SDK. Covers query functions,
- Reads credentials
- Installs packages
6 other projects use a version of this.
Adopted by
Most recently taken up by
- berekvolgyipeter/dotclaudetheir own version, first seen Jun 26, 2026
- liangdabiao/claudesdk-skilltheir own version, first seen May 23, 2026
- fcsouza/agent-skillstheir own version, first seen Mar 7, 2026
- JasonPaff/clarifytheir own version, first seen Feb 4, 2026
- JohnJBoren/claude-skills-ecosystemtheir own version, first seen Dec 26, 2025
- jahody/skillstheir own version, first seen Dec 19, 2025
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- liangdabiao/claudesdk-skill★ 35same name
- fcsouza/agent-skills★ 20same name
- berekvolgyipeter/dotclaude★ 2same name
- JohnJBoren/claude-skills-ecosystem★ 2same name
- jahody/skills★ 0same name
- JasonPaff/clarify★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository99 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- agents-md-managerSkill
- architecture-md-builderSkill
- autoresearchSkill
- claude-md-managerSkill
- claude-usageSkill
- dag-typesafeSkill
- fableSkill
- glossarySkill
- openrouter-usageSkill
- react-best-practicesSkill
- skill-optimizerSkill
- stop-slopSkill
- tamarruSkill
- test-harness-auditorSkill
- user-model-builderSkill
- atmosphere-shaderSkill
- component-gallerySkill
- conductor-motionSkill
- design-auditSkill
- design-critiqueSkill
- design-mdSkill
- design-polishSkill
- gemini-claude-resonanceSkill
- gemini-forgeSkill
- gpt-atelierSkill
- grainientSkill
- image-forgeSkill
- image-wellSkill
- meshySkill
- mindnode-uiSkill
- minoan-frontend-designSkill
- nano-banana-proSkill
- overwatch-slidedeckSkill
- paper-designSkill
- particle-swarm-simSkill
- pellicolaSkill
- photo-to-slack-emojiSkill
- pretextSkill
- recordlySkill
- rocaille-shaderSkill
- scroll-cinemaSkill
- shadcnSkill
- shapeSkill
- smolvlmSkill
- speak-responseSkill
- sprite-forgeSkill
- threejs-particle-canvasSkill
- vellum-editorialSkill
- webgpu-threejs-tslSkill
- agent-browserSkill
- beautiful-mermaidSkill
- classical-887Skill
- claude-peersSkill
- cloudflareSkill
- codex-ctoSkill
- codex-orchestratorSkill
- disc-forgeSkill
- figma-mcpSkill
- linkedin-exportSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 92
Add custom tools: - Create tools with @tool decorator or MCP servers
- Distinctive: line 218
Avoid adding "think carefully" or "be thorough" to agent system prompts—Claude 4.6 calibrates thinking depth automatically based on task …
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<essential_principles>
Claude Agent SDK Overview
The Claude Agent SDK gives agents the same tools that power Claude Code: file operations, bash commands, web search, and more. Build autonomous agents that read files, run commands, search the web, edit code, and verify their work.
Two Ways to Query
| Function | Session | Best For |
query() | New each time | One-off tasks, automation |
ClaudeSDKClient | Continuous | Conversations, follow-ups, hooks |
Key Difference: query() is simpler but doesn't support hooks, interrupts, or
custom tools. Use ClaudeSDKClient for advanced features.
Agent Loop Pattern
Agents operate in a feedback loop:
gather context → take action → verify work → repeatInstallation
Python:
uv add claude-agent-sdkTypeScript:
npm install @anthropic-ai/claude-agent-sdkRequirements:
- Claude Code CLI installed (
npm install -g @anthropic-ai/claude-code) ANTHROPIC_API_KEYenvironment variable set
Quick Start
import asyncio
from claude_agent_sdk import query, ClaudeAgentOptions
async def main():
async for message in query(
prompt="Find and fix bugs in auth.py",
options=ClaudeAgentOptions(allowed_tools=["Read", "Edit", "Bash"])
):
print(message)
asyncio.run(main())</essential_principles>
<intake>What would you like to do?
- Create a new agent - Build an agent from scratch
- Add custom tools - Create tools with @tool decorator or MCP servers
- Add hooks - Intercept tool calls for logging, validation, or modification
- Configure permissions - Control what tools can do
- Create subagents - Define specialized agents for parallel work
- Control browsers - Chrome extension, dev-browser skill
- Get API reference - Python or TypeScript SDK details
Wait for response before proceeding.
</intake><routing>| Response | Load |
| 1, "create", "new", "build" | workflows/create-agent.md |
| 2, "tools", "custom", "@tool" | references/custom-tools.md |
| 3, "hooks", "intercept" | references/hooks.md |
| 4, "permissions", "can_use_tool" | references/permissions.md |
| 5, "subagent", "parallel" | references/subagents.md |
| 6, "browser", "chrome", "automation" | references/browser-control.md |
| 7, "python", "reference" | references/python-sdk.md |
| 7, "typescript", "reference" | references/typescript-sdk.md |
| "built-in", "tools" | references/built-in-tools.md |
| "message", "types" | references/message-types.md |
| "best practices", "patterns" | references/best-practices.md |
| "error", "troubleshoot" | references/troubleshooting.md |
</routing><quick_reference>
ClaudeAgentOptions (Key Fields)
ClaudeAgentOptions(
# Tools
allowed_tools=["Read", "Write", "Bash"], # Built-in tools to enable
disallowed_tools=["WebSearch"], # Tools to block
# Prompts
system_prompt="You are...", # Custom system prompt
# Or use preset: {"type": "preset", "preset": "claude_code", "append": "..."}
# MCP Servers
mcp_servers={"calc": my_server}, # MCP server configs
# Permissions
permission_mode="acceptEdits", # default | acceptEdits | plan | bypassPermissions
can_use_tool=my_handler, # Custom permission callback
# Execution
cwd="/path/to/project", # Working directory
max_turns=10, # Limit iterations
env={"API_KEY": "..."}, # Environment variables
# Advanced
hooks={"PreToolUse": [...]}, # Behavior hooks
agents={"researcher": AgentDef(...)}, # Subagents
sandbox={"enabled": True}, # Sandbox settings
setting_sources=["project"], # Load .claude settings
)Built-in Tools
| Tool | Purpose |
| Read | Read files (text, images, PDFs, notebooks) |
| Write | Create new files |
| Edit | Modify existing files with search/replace |
| Bash | Run terminal commands |
| Glob | Find files by pattern (**/*.ts) |
| Grep | Search file contents with regex |
| WebSearch | Search the web |
| WebFetch | Fetch and parse web pages |
| Task | Spawn subagents |
| NotebookEdit | Edit Jupyter notebooks |
| TodoWrite | Manage task lists |
| KillShell | Kill background shells |
| ExitPlanMode | Exit planning mode |
Message Types
# All messages
Message = UserMessage | AssistantMessage | SystemMessage | ResultMessage
# Content blocks in AssistantMessage
ContentBlock = TextBlock | ThinkingBlock | ToolUseBlock | ToolResultBlockError Types
from claude_agent_sdk import (
CLINotFoundError, # Claude Code CLI not installed
CLIConnectionError, # Connection failed
ProcessError, # CLI process failed
CLIJSONDecodeError, # JSON parsing failed
)</quick_reference>
<thinking_config>
Thinking & Effort Configuration
Control agent thinking depth via the effort parameter rather than prompt-level instructions like "think carefully":
| Use Case | Effort | Notes |
| Quick lookups, simple edits | low | Minimal thinking overhead |
| Standard development | medium | Default for most agents |
| Complex architecture, security | high | Deeper reasoning |
| Deep research, long-horizon | max | Maximum thinking budget |
# Adaptive thinking (recommended for Claude 4.6)
options = ClaudeAgentOptions(
model="claude-opus-4-6", # or claude-sonnet-4-6
# Effort is controlled at the API level, not in the agent options
)Avoid adding "think carefully" or "be thorough" to agent system prompts—Claude 4.6 calibrates thinking depth automatically based on task complexity.
</thinking_config>
<examples>Common Patterns
File Operations Agent
options = ClaudeAgentOptions(
allowed_tools=["Read", "Write", "Edit", "Glob", "Grep"],
permission_mode="acceptEdits",
cwd="/path/to/project"
)Code Review Agent
options = ClaudeAgentOptions(
allowed_tools=["Read", "Glob", "Grep"], # Read-only
system_prompt="Review code for bugs, security issues, and style"
)Research Agent
options = ClaudeAgentOptions(
allowed_tools=["WebSearch", "WebFetch", "Write"],
max_turns=20 # Allow more iterations for research
)Interactive Chat with Tools
async with ClaudeSDKClient(options) as client:
await client.query("What files are in this directory?")
async for msg in client.receive_response():
print(msg)
# Follow-up - Claude remembers context
await client.query("Show me the largest one")
async for msg in client.receive_response():
print(msg)</examples>Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

