Skip to content

.NET: skill as class#5027

Merged
SergeyMenshykh merged 10 commits intomicrosoft:mainfrom
SergeyMenshykh:skill-as-class
Apr 3, 2026
Merged

.NET: skill as class#5027
SergeyMenshykh merged 10 commits intomicrosoft:mainfrom
SergeyMenshykh:skill-as-class

Conversation

@SergeyMenshykh
Copy link
Copy Markdown
Member

@SergeyMenshykh SergeyMenshykh commented Apr 1, 2026

Summary

Add class-based skills so skills can be distributed and reused as first-class C# types (for example from shared libraries/NuGet packages).

Changes

  • Introduce a class-based skill type for programmatic skill definitions.
  • Allow registering and using these skills through the existing skills source/provider pipeline.
  • Keep support for existing skill sources (file-based and inline) while enabling reusable class-based packaging.

Closes: #4350

@markwallace-microsoft markwallace-microsoft added documentation Improvements or additions to documentation .NET labels Apr 1, 2026
@github-actions github-actions bot changed the title skill as class .NET: skill as class Apr 1, 2026
@SergeyMenshykh SergeyMenshykh marked this pull request as ready for review April 1, 2026 14:16
Copilot AI review requested due to automatic review settings April 1, 2026 14:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for class-based Agent Skills in the .NET implementation so skills can be packaged and reused as first-class C# types (e.g., from shared libraries/NuGet), while preserving existing file-based and inline skill flows.

Changes:

  • Introduces AgentClassSkill and a shared XML content builder to synthesize skill content (name/description/instructions/resources/scripts).
  • Broadens skill registration to accept AgentSkill instances (enabling inline + class-based skills through existing provider/source pipelines).
  • Adds unit tests and expands the .NET AgentSkills samples to include class-based skills, DI-enabled variants, and mixed-source usage.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
dotnet/tests/Microsoft.Agents.AI.UnitTests/AgentSkills/AgentSkillsProviderTests.cs Adds provider tests covering class-based skills registration + deduplication.
dotnet/tests/Microsoft.Agents.AI.UnitTests/AgentSkills/AgentClassSkillTests.cs New unit tests validating AgentClassSkill behavior and synthesized content.
dotnet/src/Microsoft.Agents.AI/Skills/Programmatic/AgentInlineSkillScript.cs Exposes parameters schema via override to support generic script schema handling.
dotnet/src/Microsoft.Agents.AI/Skills/Programmatic/AgentInlineSkillContentBuilder.cs New internal helper to build XML content for programmatic/class-based skills.
dotnet/src/Microsoft.Agents.AI/Skills/Programmatic/AgentInlineSkill.cs Refactors inline skill content generation to use shared builder.
dotnet/src/Microsoft.Agents.AI/Skills/Programmatic/AgentClassSkill.cs New abstract base type for class-packaged skills (instructions/resources/scripts).
dotnet/src/Microsoft.Agents.AI/Skills/AgentSkillsProviderBuilder.cs Documentation updates clarifying advanced mixed-source builder usage.
dotnet/src/Microsoft.Agents.AI/Skills/AgentSkillsProvider.cs Updates constructors to accept AgentSkill (not only inline skills).
dotnet/src/Microsoft.Agents.AI/Skills/AgentSkillScript.cs Adds virtual ParametersSchema to unify schema exposure across script types.
dotnet/samples/02-agents/AgentSkills/README.md Updates overview to include class-based skills and mixed/DI samples.
dotnet/samples/02-agents/AgentSkills/Agent_Step06_ClassBasedSkillsWithDI/README.md New sample documentation for DI with class-based skills.
dotnet/samples/02-agents/AgentSkills/Agent_Step06_ClassBasedSkillsWithDI/Program.cs New DI-enabled class-based skills sample implementation.
dotnet/samples/02-agents/AgentSkills/Agent_Step06_ClassBasedSkillsWithDI/Agent_Step06_ClassBasedSkillsWithDI.csproj New sample project file for Step06.
dotnet/samples/02-agents/AgentSkills/Agent_Step05_CodeDefinedSkillsWithDI/README.md New sample documentation for DI with inline (code-defined) skills.
dotnet/samples/02-agents/AgentSkills/Agent_Step05_CodeDefinedSkillsWithDI/Program.cs New DI-enabled inline skills sample implementation.
dotnet/samples/02-agents/AgentSkills/Agent_Step05_CodeDefinedSkillsWithDI/Agent_Step05_CodeDefinedSkillsWithDI.csproj New sample project file for Step05.
dotnet/samples/02-agents/AgentSkills/Agent_Step04_MixedSkills/skills/unit-converter/SKILL.md New file-based skill content for mixed-skills sample.
dotnet/samples/02-agents/AgentSkills/Agent_Step04_MixedSkills/skills/unit-converter/scripts/convert-units.py New script used by file-based skill in mixed sample.
dotnet/samples/02-agents/AgentSkills/Agent_Step04_MixedSkills/skills/unit-converter/references/unit-conversion-table.md New reference document for file-based unit conversion skill.
dotnet/samples/02-agents/AgentSkills/Agent_Step04_MixedSkills/README.md New documentation for advanced mixed skills sample.
dotnet/samples/02-agents/AgentSkills/Agent_Step04_MixedSkills/Program.cs New mixed skills sample combining file + inline + class-based skills.
dotnet/samples/02-agents/AgentSkills/Agent_Step04_MixedSkills/Agent_Step04_MixedSkills.csproj New sample project file for Step04 (copies skills to output).
dotnet/samples/02-agents/AgentSkills/Agent_Step03_ClassBasedSkills/README.md New documentation for basic class-based skills sample.
dotnet/samples/02-agents/AgentSkills/Agent_Step03_ClassBasedSkills/Program.cs New class-based skills sample implementation.
dotnet/samples/02-agents/AgentSkills/Agent_Step03_ClassBasedSkills/Agent_Step03_ClassBasedSkills.csproj New sample project file for Step03.
dotnet/samples/02-agents/AgentSkills/Agent_Step01_FileBasedSkills/README.md Minor terminology correction (“script runner” wording).
dotnet/filtered-unit.slnx Adds a filtered solution file (currently appears to be a generated artifact).
dotnet/AGENTS.md Updates .NET guidance to require Async suffix on async test methods.
dotnet/agent-framework-dotnet.slnx Adds new AgentSkills sample projects to the main solution.

SergeyMenshykh and others added 2 commits April 1, 2026 14:58
The filtered solution file is generated dynamically by
eng/scripts/New-FilteredSolution.ps1 during CI. Checking it in
risks it becoming stale and out-of-sync with the real solution.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The filtered solution file is generated dynamically by
eng/scripts/New-FilteredSolution.ps1 during CI. Checking it in
risks it becoming stale and out-of-sync with the real solution.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@SergeyMenshykh SergeyMenshykh added this pull request to the merge queue Apr 3, 2026
Merged via the queue into microsoft:main with commit 3fc1d00 Apr 3, 2026
22 checks passed
@github-project-automation github-project-automation bot moved this from In Review to Done in Agent Framework Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation .NET

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

.NET: Support multiple sources for agent skills

5 participants