Claude Agent Sdk Dotnet
Description
A modern .NET library for interacting with the Claude Code CLI, with full Python SDK parity.
Installation
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open the source below and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
README
Claude Agent SDK for .NET
A modern .NET library for interacting with the Claude Code CLI, providing both a simple one-shot `QueryAsync()` API and a full bidirectional client with control-protocol support.
[]() []() []()
**Disclaimer:** This is an independent, unofficial port and is not affiliated with or endorsed by Anthropic, PBC.
Features
- Simple
Claude.QueryAsync()API for one-shot requests ClaudeSDKClientfor multi-turn, bidirectional conversations- Control protocol support (interrupts, modes, dynamic model switching)
- Hook system (PreToolUse, PostToolUse, UserPromptSubmit)
- Tool permission callbacks with allow/deny control
- In-process MCP server support (tools, prompts, resources)
- Cross-platform: Windows, Linux, macOS
- Source-generated JSON models for message types
- Well-tested: 109 tests (90 unit + 19 integration; integration tests are disabled by default)
Prerequisites
- .NET 8.0 or .NET 9.0
- Claude Code CLI >= 2.0.0:
npm install -g @anthropic-ai/claude-code
CLI Path Resolution
The SDK discovers the Claude Code CLI in this order:
ClaudeAgentOptions.CliPath(explicit path)CLAUDE_CLI_PATHenvironment variablePATHsearch forclaude(orclaude.cmdon Windows)
Quick Start
One-Shot Query
using Claude.AgentSdk;
await foreach (var msg in Claude.QueryAsync("What is 2+2?"))
{
if (msg is AssistantMessage am)
foreach (var block in am.Content)
if (block is TextBlock tb)
Console.Write(tb.Text);
}
Multi-Turn Conversation
using Claude.AgentSdk;
await using var client = new ClaudeSDKClient();
await client.ConnectAsync();
await client.QueryAsync("Write a Python hello world");
await foreach (var msg in client.Re
Related Skills
Awesome Go
A curated list of awesome Go frameworks, libraries and software
Development next.js
| The React Framework | 138360 | 1503 | 1 |
Development sharing-skills
skill for guidance.
Development root-cause-tracing
Use when errors occur deep in execution and you need to trace back to find the original trigger.
Development Template Skill
Minimal skeleton for a new skill project structure.
Development Third-party Notices
THE FOLLOWING SETS FORTH ATTRIBUTION NOTICES FOR THIRD PARTY SOFTWARE THAT MAY BE CONTAINED IN PORTIONS OF THI
Development