ManagedCode.SkillOpt is a C#/.NET port of Microsoft's original Python SkillOpt project. This repository is a fork that preserves the upstream Git history and license while maintaining an in-process .NET library. The upstream Python source remains the reference for future port work; Python engines, benchmarks, CLI tools, plugins, and WebUI are not shipped here.
The library targets .NET 10 and uses caller-provided Microsoft.Extensions.AI IChatClient instances and Microsoft.Extensions.AI.Evaluation IEvaluator. Hosts built with Microsoft Agent Framework can pass their normal MEAI client. The library does not start Python, launch a subprocess, call a provider SDK, create an HTTP model transport, or require an optimizer service.
<PackageReference Include="ManagedCode.SkillOpt" Version="0.1.4" />The port optimizes one Markdown skill document while keeping the target client fixed. It runs scenarios, evaluates typed per-case evidence, reflects on success and failure, aggregates and selects bounded edits, validates candidates on a held-out selection split, and retains the best skill. It includes supported patch/rewrite modes, edit-budget schedules, rejected-edit memory, epoch meta/slow updates, optional final test reporting, candidate gates, and awaited typed checkpoints. See the port coverage and known deviations; this is a documented C# implementation scope, not a claim of complete Python feature or benchmark parity.
The exact request contract and persistence guidance are in the C# package guide. In outline, the host provides frozen, disjoint cases and role clients:
var result = await SkillOptOptimizer.OptimizeAsync(new SkillOptRequest
{
InitialSkill = skillMarkdown,
TrainingCases = trainingCases,
SelectionCases = validationCases,
TestCases = testCases,
TargetChatClient = targetClient,
OptimizerChatClient = optimizerClient,
Evaluator = evaluator,
Options = options,
Checkpoint = async (state, token) => await SaveCheckpointAsync(state, token)
}, cancellationToken);
var bestSkillMarkdown = result.BestSkill;The caller owns model/client construction, evaluator policy, case collection, durable checkpoint storage, billing, and saving the returned artifact. The checkpoint callback must persist its state before it returns. The library never modifies a product draft or publishes a skill.
dotnet restore ManagedCode.SkillOpt.sln
dotnet format ManagedCode.SkillOpt.sln --verify-no-changes
dotnet build ManagedCode.SkillOpt.sln --configuration Release
dotnet test ManagedCode.SkillOpt.sln --configuration Release
dotnet pack src/ManagedCode.SkillOpt/ManagedCode.SkillOpt.csproj --configuration ReleaseThe package version is maintained in Directory.Build.props. Published .NET releases use dotnet-v<version> tags so they cannot collide with the preserved upstream v* tags. The dotnet.yml workflow runs package checks and publishes the versioned NuGet package.
- Original project and research: microsoft/SkillOpt
- C# port base: upstream commit
fa4ca184573e42ec11472959dd57422381418096 - License: MIT