Make Wpf Chat Orchestrator
БесплатноБез исполняемых скриптовНе проверенGenerates a streaming chat orchestrator that decomposes IChatClient.GetStreamingResponseAsync into UI-agnostic events (text, tool-started, tool-completed…
от christian289★ 42 звезды на GitHubОб этом скилле
WPF Chat Orchestrator Generator
If $0 is empty, use the AskUserQuestion tool to ask: "Enter the orchestrator class name (e.g., ChatOrchestrator)". Do NOT proceed until a valid name is provided. Use the response as the orchestrator name for all subsequent steps.
Generate $0: a streaming chat orchestrator that decomposes IChatClient.GetStreamingResponseAsync into a stream of UI-agnostic ChatEvents, plus the MCP tool acquisition (McpClient.CreateAsync + StdioClientTransport) that feeds ChatOptions.Tools.
- Replace
{Namespace}with the project's root namespace. - The
IChatClientis produced by/wpf-dev-pack:make-wpf-chatclient-factory(already wrapped withUseFunctionInvocation, so the tool loop runs automatically).
Full rationale in two knowledge topics (fetch via
WpfDevPackMcp get_wpf_topic):hosting-extensions-ai-chatclient-in-wpf-mvvm(Dispatcher marshaling, theyield-illegal-in-catch(CS1631) restructuring, cancellation) andconsuming-mcp-tools-in-extensions-ai(there is noMcpClientFactory;McpClientis abstract — use the staticCreateAsync; off-Dispatcher exit dispose).
⚠️ Verify signatures with HandMirror first
Microsoft.Extensions.AI and the MCP SDK evolve quickly. Before emitting, verify
with HandMirror (inspect_nuget_package / inspect_nuget_package_type):
Microsoft.Extensions.AI (IChatClient, ChatResponseUpdate, ChatOptions,
FunctionCallContent, FunctionResultContent) and ModelContextProtocol
(McpClient.CreateAsync, StdioClientTransport, McpClientTool).
Required Packages
<PackageReference Include="Microsoft.Extensions.AI" Version="10.*" />
<PackageReference Include="ModelContextProtocol" Version="1.*" />
ModelContextProtocol 1.x ships the client types (
McpClient,StdioClientTransport,McpClientTool) in itsModelContextProtocol.Coredependency — the package reference above still works (Core flows transitively) and theModelContextProtocol.Clientnamespace is unchanged.
Usings: the snippets assume these in the target project's
GlobalUsings.cs:global using System.Runtime.CompilerServices;([EnumeratorCancellation]),global using Microsoft.Extensions.AI;,global using ModelContextProtocol.Client;, andglobal using Microsoft.Extensions.Logging;(ILoggerFactory).ChatSettingsis the supporting type emitted by/wpf-dev-pack:make-wpf-chatclient-factory.
Placement: standalone default is
{Project}/Servicesbelow. In amake-wpf-projectsolution, prefer the*.ViewModelsproject (namespace{Namespace}.ViewModels) — every type here is WPF-free, and that placement lets ViewModels consume the orchestrator without referencing the app project (the layout used by the one-button/wpf-dev-pack:make-wpf-chatclient).
Generated Code
ChatEvent.cs (UI-agnostic stream events)
namespace {Namespace}.Services;
public abstract record ChatEvent;
public sealed record ChatText(string Text) : ChatEvent;
public sealed record ToolStarted(string Name, IDictionary<string, object?>? Arguments) : ChatEvent;
public sealed record ToolCompleted(string CallId, object? Result) : ChatEvent;
public sealed record ChatFailed(Exception Error) : ChatEvent;
$0.cs (stream decomposition)
C# forbids yield inside a catch (CS1631). So the loop catches a fault
into a flag and yields the failure event after the try/catch closes. A
OperationCanceledException is a normal stop (yield break), not a failure.
namespace {Namespace}.Services;
public sealed class $0(IChatClient client, IList<AITool> tools, ChatSettings settings)
{
private readonly IChatClient _client = client;
private readonly IList<AITool> _tools = tools;
private readonly ChatSettings _settings = settings;
public async IAsyncEnumerable<ChatEvent> SendAsync(
IList<ChatMessage> history, [EnumeratorCancellation] CancellationToken ct)
{
var options = new ChatOptions { Tools = _tools, ModelId = _settings.ModelId };
await using var e = _client.GetStreamingResponseAsync(history, options, ct).GetAsyncEnumerator(ct);
while (true)
{
ChatResponseUpdate? update = null;
bool faulted = false; Exception? error = null;
try
{
if (!await e.MoveNextAsync()) { break; }
update = e.Current;
}
catch (OperationCanceledException) { yield break; }
catch (Exception ex) { faulted = true; error = ex; } // CS1631: cannot yield here
if (faulted) { yield return new ChatFailed(error!); yield break; }
if (!string.IsNullOrEmpty(update!.Text)) { yield return new ChatText(update.Text); }
foreach (AIContent c in update.Contents)
{
if (c is FunctionCallContent call) { yield return new ToolStarted(call.Name, call.Arguments); }
if
Установить Make Wpf Chat Orchestrator в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Make Wpf Chat Orchestrator?
Generates a streaming chat orchestrator that decomposes IChatClient.GetStreamingResponseAsync into UI-agnostic events (text, tool-started, tool-completed, failed), plus MCP tool acquisition via McpClient.CreateAsync and StdioClientTransport. Use when wiring a streaming Microsoft.Extensions.AI chat loop with MCP tools into a WPF app. Usage: /wpf-dev-pack:make-wpf-chat-orchestrator <Name>
Как установить скилл Make Wpf Chat Orchestrator?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Make Wpf Chat Orchestrator запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic