Hazzajenko

ClaudeAgentSdk.DotNet — Development skill for Claude Code

Development community

Typed, AOT-compatible C# SDK for the Claude Code CLI.

How to install ClaudeAgentSdk.DotNet

This entry records only its repository, not the path inside it, so there is no exact command to give. Open Hazzajenko/ClaudeAgentSdk.DotNet and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What ClaudeAgentSdk.DotNet does

Typed, AOT-compatible C# SDK for the Claude Code CLI. It is a port of the official Python SDK. It supports streaming queries, structured output, custom MCP tools and permission hooks. Requires .NET 10 and the Claude CLI.

Alternatives in Development

  • Claude-code-safety-net Rules Reference — Custom rules reference for defining safe/dangerous command patterns 1.2k ★
  • Dario — A local OpenAI- and Anthropic-compatible proxy that brings your Claude Pro/Max subscription to Cursor, Cline 485 ★
  • Dotnet Artisan — Comprehensive .NET development skills for modern C# and .NET 228 ★

README

Claude Agent SDK for .NET

[![NuGet](https://img.shields.io/nuget/v/ClaudeAgentSdk.DotNet?style=flat-square)](https://www.nuget.org/packages/ClaudeAgentSdk.DotNet) [![Build](https://img.shields.io/github/actions/workflow/status/Hazzajenko/ClaudeAgentSdk.DotNet/ci.yml?branch=main&style=flat-square)](https://github.com/Hazzajenko/ClaudeAgentSdk.DotNet/actions) [![License](https://img.shields.io/github/license/Hazzajenko/ClaudeAgentSdk.DotNet?style=flat-square)](LICENSE)

Typed, AOT-compatible C# SDK for the [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) agent protocol. Port of the official [Python Claude Agent SDK](https://github.com/anthropics/claude-agent-sdk-python).

Installation

dotnet add package ClaudeAgentSdk.DotNet

[!NOTE] Requires .NET 10+ and the [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code/getting-started) installed and available on your PATH.

Quick Start

using ClaudeAgentSdk;
using ClaudeAgentSdk.Messages;

await foreach (var message in Claude.QueryAsync("What is 2 + 2?"))
{
    if (message is AssistantMessage { Text: var text })
        Console.WriteLine($"Claude: {text}");
}

One-Shot API

`Claude.QueryAsync` streams messages from a single prompt. `Claude.QueryTextAsync` returns just the final text.

// Stream all messages
var options = new ClaudeClientOptions
{
    SystemPrompt = "You are a helpful assistant that explains things simply.",
    MaxTurns = 1,
};

await foreach (var message in Claude.QueryAsync("Explain what C# is in one sentence.", options))
{
    if (message is AssistantMessage { Text: var text })
        Console.WriteLine($"Claude: {text}");
}

// Get text only — no streaming
string reply = await Claude.QueryTextAsync("What is 2 + 2?");

Structured Output

`Claude.QueryAsync` auto-derives a JSON schema from your source-generated `JsonTypeInfo` and deserializes the result — one line, fully AOT-safe.

using System.Text.Jso