Technology Selection
.NET (Microsoft)OfficialPublished by .NET (Microsoft)
- Skill
- Guidelines
- Software development
- MIT
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured decision-making process for integrating AI and machine learning into .NET 8+ projects. It helps developers choose between classic ML.NET for deterministic tabular tasks and modern LLM-based approaches using Microsoft.Extensions.AI and the Microsoft Agent Framework. The guide emphasizes performance, cost-efficiency, and architectural best practices, such as using dependency injection, secure secret management, and thread-safe model serving.
What it does
- Provides a decision tree to match specific AI/ML tasks to the appropriate .NET library.
- Defines architectural guardrails for ML.NET, LLM integration, agentic workflows, and RAG pipelines.
- Standardizes the use of Microsoft.Extensions.AI as the foundational abstraction layer.
- Outlines implementation patterns for local inference, vector search, and Copilot extensions.
- Identifies common anti-patterns to avoid, such as using LLMs for tabular classification or hardcoding API keys.
- Ensures production-readiness through guidance on thread-safe serving and secure configuration.
When to use it
- When deciding which AI/ML library to use for a new .NET 8+ feature.
- When planning the architecture for RAG, agentic workflows, or custom model inference.
- When refactoring existing AI implementations to align with modern .NET standards.
- When you need to justify the choice between classic ML and LLM-based solutions.
Advantages
- Promotes the use of deterministic, cost-effective tools for structured data tasks.
- Ensures consistent, maintainable code by standardizing on Microsoft.Extensions.AI.
- Prevents common pitfalls like thread-safety issues in ASP.NET Core or inefficient LLM usage.
- Encourages secure development practices by mandating proper secret management.
Usage examples
- “I need to add anomaly detection to my .NET 8 telemetry service. Should I use an LLM?”
- The agent will advise against using an LLM, recommending ML.NET instead for its deterministic performance, lower cost, and lack of cloud dependency for tabular anomaly detection.
- “How should I architect a multi-step agent that uses tools to answer user questions?”
- The agent will provide a plan using the Microsoft Agent Framework on top of Microsoft.Extensions.AI, emphasizing bounded iterations and explicit tool definitions.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/dotnet/technology-selection/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip technology-selection.zip -d .agents/skills
Documentation by .NET (Microsoft)
.NET AI and Machine Learning
Pick the right technology first, then deliver only what the task asks for. If the task asks for a plan, comparison, or architecture (or says "do not write code"), produce that — do not scaffold, build, or run code unprompted.
Step 1: Classify the task (decision tree)
State which branch applies and why, then choose that technology.
| Task type | Technology | Why |
|---|---|---|
| Structured/tabular: classification, regression, clustering, anomaly detection, recommendation | ML.NET (Microsoft.ML) | Deterministic (fixed seed), no cloud dependency, purpose-built |
| NL understanding, generation, summarization, reasoning (single prompt → response, no tools) | LLM via Microsoft.Extensions.AI (IChatClient) | Language capability, no orchestration needed |
| Agentic: multi-step tool/function calling, agent loops, multi-agent | Microsoft Agent Framework (Microsoft.Agents.AI) on Microsoft.Extensions.AI | Needs orchestration, tool dispatch, iteration control IChatClient lacks |
| GitHub Copilot extensions / custom dev-workflow agents | GitHub Copilot SDK (GitHub.Copilot.SDK) | Integrates with the Copilot agent runtime |
| Run a pre-trained/custom model in production | ONNX Runtime (Microsoft.ML.OnnxRuntime) | Hardware-accelerated, format-agnostic inference |
| Local/offline LLM inference | OllamaSharp (Ollama models) | Privacy-sensitive, air-gapped, cost-constrained |
| Semantic search, RAG, embedding storage | Microsoft.Extensions.VectorData.Abstractions (MEVD) + a provider (Azure AI Search, Milvus, MongoDB, pgvector, Pinecone, Qdrant, Redis, SQL) | Provider-agnostic vector search |
| Ingest, chunk, load documents into a vector store | Microsoft.Extensions.AI.DataIngestion (preview) + MEVD | Parses, chunks, embeds, upserts |
| Both structured predictions AND NL reasoning | Hybrid: ML.NET scoring + LLM reasoning layer | ML.NET is reproducible; LLM adds explanation |
Critical rule: Do NOT use an LLM for tasks ML.NET handles well (tabular classification, regression, clustering) — LLMs are slower, costlier, and non-deterministic for these.
Step 1b: Pick the library layer
| Layer | Library | Use when |
|---|---|---|
| Abstraction | Microsoft.Extensions.AI (MEAI) | Always the foundation. Use IChatClient directly for prompt-response and simple, bounded function invocation. |
| Provider SDK | Azure.AI.OpenAI / OpenAI / Azure.AI.Inference / OllamaSharp | Concrete provider behind MEAI via AddChatClient. |
| Orchestration | Microsoft.Agents.AI (prerelease) | Multi-step tool use, durable agent loops, and multi-agent workflows. |
| Copilot | GitHub.Copilot.SDK | Building Copilot-platform extensions only. |
Rules: start with MEAI; put the provider behind it via AddChatClient (don't call the provider in
business logic); use Microsoft.Agents.AI for multi-step or durable agent workflows rather than
hand-rolling an agent loop; never mix a raw HttpClient-to-OpenAI call with MEAI in the same
workflow. Do not use Accord.NET (archived). For new projects, prefer MEAI and Agent Framework
unless existing Semantic Kernel features or investments are a requirement. Register AI/ML services
via DI; load secrets from user-secrets / env / Key Vault — never hardcode keys.
Step 2: Cover the branch essentials, then decide depth
Every answer — plan or implementation — must address the guardrails for the selected branch:
ML.NET —
new MLContext(seed: …)(reproducible);TrainTestSplit+ evaluate on the held-out set; report real metrics (MicroAccuracy/MacroAccuracy/LogLoss, AUC/F1, or RMSE/R²); serve withPredictionEnginePool<TIn,TOut>(never a singletonPredictionEngine).LLM (MEAI) — depend on
IChatClientregistered viaAddChatClient(provider behind it); setTemperatureandMaxOutputTokensinChatOptions; add retry/timeout (RetryingChatClient/Polly); pin a dated model; load keys from user-secrets / env / Key Vault — never hardcode ansk-…key; validate non-deterministic output against a schema with a fallback.Agentic (Agent Framework) — orchestrate with
Microsoft.Agents.AIonIChatClient(never a hand-rolled loop); setMaximumIterationsand a token/cost ceiling; define each tool with a clear schema (AIFunctionFactory.Create); log each step (never raw sensitive content).RAG / embeddings — semantic chunking (not fixed-size);
IEmbeddingGeneratorand cache the embeddings (don't re-embed per query); store/query withMicrosoft.Extensions.VectorData.Abstractions(MEVD) + the provider the user asked for (e.g. pgvector); filter by a minimum similarity score; keep source attribution for each answer. Honor the UI/storage the user specified; use only real, existing NuGet packages.
Then choose depth:
Plan / comparison / architecture only (or "do not write code"): answer from this file alone using the essentials above. Do NOT open a reference — the branch essentials here are sufficient for a selection or plan. For RAG plans, cover chat, ingestion/chunking, embeddings, vector storage, source attribution, and the requested UI/storage.
Writing implementation code: read the matching reference(s) for packages and implementation guidance (read only the selected branch; for Hybrid, read both Classic ML.NET and LLM):
Classic ML.NET →
references/classic-ml.mdLLM integration (MEAI) →
references/llm.mdAgentic (Agent Framework) →
references/agentic.mdRAG / embeddings / ingestion →
references/rag.mdGitHub Copilot extensions →
references/copilot.mdONNX Runtime inference →
references/onnx.mdLocal/offline LLM with Ollama →
references/ollama.md
Validation
[ ] Selection follows the decision tree — no LLM for tasks ML.NET handles
[ ] Only what was asked is produced (plan-only requests get a plan, not code)
[ ] AI/ML services registered via DI; config via
IOptions<T>; keys from secure sources[ ] Branch guardrails (Step 2 essentials, plus the reference when implementing) are satisfied
[ ] After implementing, build and run existing tests
Anti-Patterns to Reject
| Anti-pattern | Redirect |
|---|---|
| LLM for tabular classification | Use ML.NET — faster, cheaper, deterministic |
| LLM calls without retry/timeout | Add RetryingChatClient or Polly retry |
API keys in committed appsettings.json | user-secrets / env / Key Vault |
| Accord.NET, or defaulting to Semantic Kernel without a requirement | ML.NET; prefer MEAI + Microsoft.Agents.AI for new work |
Hand-rolled multi-step tool loops with IChatClient | Microsoft.Agents.AI (MaximumIterations, tool dispatch) |
| Agent Framework for a single prompt→response | IChatClient directly |
Raw HttpClient/OpenAI SDK in business logic alongside MEAI | one abstraction layer; depend on IChatClient |
PredictionEngine singleton in ASP.NET Core | PredictionEnginePool<TIn,TOut> (not thread-safe) |
| RAG without chunking or relevance filtering | semantic chunking + minimum similarity score |
| Building custom neural nets in .NET from scratch | pre-trained via ONNX Runtime or an LLM API |
Files
- ATTRIBUTION.mdAdded by AutoGineer849 B
- LICENSELicence file added by AutoGineer1.1 KiB
- SKILL.md8.3 KiB
- references/agentic.md1.9 KiB
- references/classic-ml.md2.4 KiB
- references/copilot.md1.1 KiB
- references/llm.md2.0 KiB
- references/ollama.md1018 B
- references/onnx.md1.1 KiB
- references/rag.md1.8 KiB
references/copilot.md
GitHub Copilot SDK extensions
Use only for custom developer workflows that must run through the GitHub Copilot agent runtime. Do not use it as a general LLM client.
Package
<PackageReference Include="GitHub.Copilot.SDK" Version="0.3.0" />The SDK is pre-1.0. Pin an exact version and review release notes before each upgrade.
Guardrails
Start and reuse one
CopilotClient; stop it during application shutdown.Create a bounded session for each workflow and dispose the session after use.
Set the working directory, model, system message, and permission handler explicitly.
Default permission requests to deny when no user is available.
Subscribe to session error, usage, and completion events before sending a prompt.
Enforce a timeout and cancellation token, and record token usage without sensitive content.
Minimal shape
var client = new CopilotClient(new CopilotClientOptions());
await client.StartAsync();
await using var session = await client.CreateSessionAsync(sessionConfig);
await session.SendAsync(new MessageOptions { Prompt = prompt });
await client.StopAsync();Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs an API key
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- .NET (Microsoft)
- Publisher
- .NET (Microsoft) (Official)
- Source
- dotnet/skills · plugins/dotnet-ai/skills/technology-selection · commit 96c3d68
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by .NET (Microsoft).
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download technology-selection.zip