AI/ML Skills in dotnet/skills Repository: A Complete Guide for .NET Developers
The dotnet/skills repository contains five specialized AI/ML skills—technology-selection, mcp-csharp-test, mcp-csharp-debug, mcp-csharp-create, and mcp-csharp-publish—that provide decision trees, testing patterns, and packaging workflows for implementing ML.NET, Microsoft.Extensions.AI, and ONNX Runtime solutions in .NET applications.
The dotnet/skills repository serves as the authoritative reference for .NET developers integrating artificial intelligence into production systems. Located under plugins/dotnet-ai/skills/, the AI/ML skills in dotnet/skills repository offer structured guidance for selecting between ML.NET, LLM abstractions, and ONNX Runtime while providing lifecycle management through MCP (Managed Code Package) patterns. Each skill is documented in a dedicated SKILL.md file and includes specific NuGet package recommendations, guardrails, and implementation patterns.
Core AI/ML Skills Overview
The repository organizes AI capabilities into five distinct skills that cover the entire development lifecycle.
Technology Selection (technology-selection)
The technology-selection skill, defined in plugins/dotnet-ai/skills/technology-selection/SKILL.md, provides a decision-tree framework for choosing the appropriate AI stack. It guides developers through selecting ML.NET for deterministic tabular models, Microsoft.Extensions.AI (MEAI) for provider-agnostic LLM integration, Microsoft.Agents.AI for agentic orchestration, ONNX Runtime for hardware-accelerated custom models, and OllamaSharp for local LLM inference.
MCP Test Pattern (mcp-csharp-test)
Located at plugins/dotnet-ai/skills/mcp-csharp-test/SKILL.md, this skill establishes repeatable testing harnesses for AI/ML pipelines. It includes patterns for validating data transformations, ensuring model training reproducibility, and asserting inference correctness across different environments.
MCP Debug Utilities (mcp-csharp-debug)
The mcp-csharp-debug skill in plugins/dotnet-ai/skills/mcp-csharp-debug/SKILL.md provides diagnostic tools for AI development. Key capabilities include ONNX graph inspection, token-usage logging for LLM calls, and data pipeline verification to trace tensor shapes and data flow through preprocessing stages.
MCP Package Creation (mcp-csharp-create)
Documented in plugins/dotnet-ai/skills/mcp-csharp-create/SKILL.md, this skill handles the end-to-end creation of Managed Code Packages that bundle AI artifacts. It covers wrapping ONNX models, tokenizers, and custom ML.NET transformers into distributable NuGet-style packages ready for enterprise consumption.
MCP Publishing (mcp-csharp-publish)
The mcp-csharp-publish skill at plugins/dotnet-ai/skills/mcp-csharp-publish/SKILL.md defines the workflow for publishing AI/ML components to the Microsoft MCP registry. It includes versioning strategies, metadata requirements for model cards, and security guardrails for distributing trained models.
Technology Stack Selection Logic
The technology-selection skill implements a layered abstraction philosophy. The following C# enumeration demonstrates the decision logic for mapping AI tasks to specific .NET packages:
// Example: a helper that reads the decision table from the skill
// (the skill is documentation; this is just a demonstration of the logic)
public enum AiTask
{
TabularClassification,
TextGeneration,
AgenticToolCalling,
LocalOnnxInference,
VectorSearch
}
public (string Package, string Reason) ChooseTechnology(AiTask task)
{
return task switch
{
AiTask.TabularClassification => ("Microsoft.ML", "ML.NET handles deterministic tabular models."),
AiTask.TextGeneration => ("Microsoft.Extensions.AI", "MEAI abstracts LLM providers."),
AiTask.AgenticToolCalling => ("Microsoft.Agents.AI", "Agent Framework adds orchestration & tool dispatch."),
AiTask.LocalOnnxInference => ("Microsoft.ML.OnnxRuntime", "ONNX Runtime gives hardware‑accelerated inference."),
AiTask.VectorSearch => ("Microsoft.Extensions.VectorData.Abstractions", "Provider‑agnostic vector DB API."),
_ => throw new ArgumentOutOfRangeException(nameof(task))
};
}
Implementation Patterns by Skill
ML.NET for Structured Data
When the technology-selection skill identifies tabular classification or regression requirements, developers implement ML.NET pipelines. The following example demonstrates loading data, configuring a binary classification trainer, and evaluating model performance:
using Microsoft.ML;
using Microsoft.ML.Data;
public class Ticket
{
[LoadColumn(0)] public bool IsUrgent;
[LoadColumn(1)] public float FeatureA;
[LoadColumn(2)] public float FeatureB;
}
public class TicketPrediction
{
[ColumnName("PredictedLabel")] public bool Prediction;
}
var mlContext = new MLContext(seed: 42);
IDataView data = mlContext.Data.LoadFromTextFile<Ticket>("tickets.tsv", separatorChar: '\t');
var split = mlContext.Data.TrainTestSplit(data, testFraction: 0.2);
var trainer = mlContext.BinaryClassification.Trainers
.LbfgsLogisticRegression(labelColumnName: "IsUrgent");
var pipeline = mlContext.Transforms.Concatenate("Features", "FeatureA", "FeatureB")
.Append(trainer);
var model = pipeline.Fit(split.TrainSet);
var predictions = model.Transform(split.TestSet);
var metrics = mlContext.BinaryClassification.Evaluate(predictions);
Console.WriteLine($"AUC = {metrics.AreaUnderRocCurve:F3}");
LLM Integration with Microsoft.Extensions.AI
For text generation and embedding tasks, the skill recommends Microsoft.Extensions.AI (MEAI). This abstraction layer enables swapping between OpenAI, Azure AI, and local providers without code changes:
using Microsoft.Extensions.AI;
using Microsoft.Extensions.DependencyInjection;
var services = new ServiceCollection();
services.AddChatClient(builder => builder
.UseOpenAIChatClient("gpt-4o-mini-2024-07-18")); // <-- MEAI abstraction
var provider = services.BuildServiceProvider();
var chat = provider.GetRequiredService<IChatClient>();
var response = await chat.GenerateAsync(
new ChatMessage(ChatRole.User, "Summarize the following ticket description:\n" +
"User cannot login after password reset."),
new ChatOptions { Temperature = 0f, MaxOutputTokens = 256 });
Console.WriteLine(response);
Agentic Workflows with Microsoft.Agents.AI
When applications require multi-step reasoning or tool calling, the technology-selection skill points to Microsoft.Agents.AI. The following pattern demonstrates agent registration and invocation:
using Microsoft.Extensions.AI;
using Microsoft.Agents.AI;
using Microsoft.Extensions.DependencyInjection;
var services = new ServiceCollection();
services.AddChatClient(builder => builder.UseOpenAIChatClient("gpt-4o"));
services.AddAgentFramework(); // registers Microsoft.Agents.AI
var sp = services.BuildServiceProvider();
var agent = sp.GetRequiredService<IAgent>();
var result = await agent.InvokeAsync(
new AgentRequest("Write a short PowerShell script that lists all running processes."));
// The Agent Framework automatically handles tool dispatch, retries, and logging.
Console.WriteLine(result.Output);
ONNX Runtime for Custom Models
For deploying custom-trained models, the skill provides Microsoft.ML.OnnxRuntime patterns. The following code loads an ONNX session and executes inference:
using Microsoft.ML.OnnxRuntime;
using Microsoft.ML.OnnxRuntime.Tensors;
var session = new InferenceSession("model.onnx");
var input = new DenseTensor<float>(new[] { 1.0f, 2.0f }, new[] { 1, 2 });
var inputs = new List<NamedOnnxValue>
{
NamedOnnxValue.CreateFromTensor("input", input)
};
using var results = session.Run(inputs);
var output = results.First().AsTensor<float>();
Console.WriteLine($"Model output: {output[0]}");
MCP Lifecycle Integration
The repository's MCP skills provide a complete DevOps pipeline for AI components.
- Start with
technology-selectionto determine the correct stack (ML.NET, MEAI, Agent Framework, or ONNX). - Develop using
mcp-csharp-debugto monitor token usage and verify ONNX graph integrity. - Validate through
mcp-csharp-testto ensure data pipeline correctness and model reproducibility. - Package via
mcp-csharp-createto bundle models, tokenizers, and code into MC packages. - Distribute using
mcp-csharp-publishto push artifacts to the Microsoft MCP registry with proper versioning.
Summary
- The dotnet/skills repository provides five specialized AI/ML skills under
plugins/dotnet-ai/skills/. - Technology-selection offers decision-tree guidance for choosing between ML.NET, Microsoft.Extensions.AI, Microsoft.Agents.AI, and ONNX Runtime.
- MCP skills (test, debug, create, publish) manage the complete lifecycle of AI components from development to registry deployment.
- All skills emphasize layered abstractions—using MEAI for provider-agnostic LLM calls, ML.NET for structured data, and ONNX Runtime for custom model inference.
- Each skill is self-contained in a
SKILL.mdfile with specific NuGet references, guardrails, and implementation patterns.
Frequently Asked Questions
What is the primary purpose of the technology-selection skill in dotnet/skills?
The technology-selection skill provides a decision-tree framework that helps developers choose the correct AI/ML stack for their specific use case. According to the source code at plugins/dotnet-ai/skills/technology-selection/SKILL.md, it maps scenarios like tabular classification to ML.NET, text generation to Microsoft.Extensions.AI, and agentic workflows to Microsoft.Agents.AI, ensuring teams use the appropriate abstraction layer for their requirements.
How do the MCP skills support AI/ML development workflows?
The MCP skills (mcp-csharp-test, mcp-csharp-debug, mcp-csharp-create, and mcp-csharp-publish) provide a complete DevOps pipeline for AI components. As documented in their respective SKILL.md files under plugins/dotnet-ai/skills/, these skills enable developers to test model inference, debug token usage and ONNX graphs, package models into deployable units, and publish them to the Microsoft MCP registry with proper versioning and metadata.
Which NuGet packages does the dotnet/skills repository recommend for LLM integration?
For large language model integration, the technology-selection skill recommends Microsoft.Extensions.AI (MEAI) as the primary abstraction layer, Microsoft.Agents.AI for agentic orchestration requiring tool calling, and OllamaSharp for local LLM inference scenarios. These packages provide provider-agnostic APIs that allow swapping between OpenAI, Azure AI, and local models without code changes.
Can ML.NET and ONNX Runtime be used together in the dotnet/skills framework?
Yes, the technology-selection skill explicitly supports both technologies for different scenarios. ML.NET is recommended for deterministic tabular data tasks and classical machine learning, while Microsoft.ML.OnnxRuntime handles hardware-accelerated inference for deep learning models exported to ONNX format. The skills encourage using ML.NET's ONNX interoperability features or running ONNX Runtime directly depending on performance requirements and model complexity.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →