Skip to content

.NET: Support Agent Skills - #4122

Merged
SergeyMenshykh merged 19 commits into
microsoft:mainfrom
SergeyMenshykh:support-agent-skills
Feb 20, 2026
Merged

.NET: Support Agent Skills#4122
SergeyMenshykh merged 19 commits into
microsoft:mainfrom
SergeyMenshykh:support-agent-skills

Conversation

@SergeyMenshykh

@SergeyMenshykhSergeyMenshykh commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds FileAgentSkillsProvider, an AIContextProvider that discovers and exposes Agent Skills from filesystem directories following the Agent Skills specification progressive disclosure pattern: advertise → load → read resources.

Changes

  • FileAgentSkillsProvider — discovers SKILL.md files from configured directories, advertises skills via system prompt injection, and provides load_skill / read_skill_resource tools for on-demand access.
  • FileAgentSkillsProviderOptions — configuration for custom prompt templates.
  • FileAgentSkillLoader / FileAgentSkill / SkillFrontmatter — internal helpers and model classes for skill discovery, frontmatter parsing, and secure resource reading (path traversal / symlink guards).
  • Unit tests covering discovery, loading, resource reading, and security scenarios.
  • Sample (Agent_Step01_BasicSkills) demonstrating usage with an expense-report skill.
  • FileAgentSkillsProvider is marked as experimental (MAAI001) using DiagnosticIds.

Key Design Decisions

  • Skills are read-only static content; no code execution.
  • XML-escaping for prompt injection safety.
  • Resource reads are guarded against path traversal and symlink escape.
  • Only skills from trusted sources should be used.

Out of Scope

  • Scripts execution, which will be added in one of the following PRs.

Closes: #3499

CopilotAI review requested due to automatic review settings February 20, 2026 11:04
@markwallace-microsoftMark Wallace (markwallace-microsoft) added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net labels Feb 20, 2026
@github-actionsgithub-actionsBot changed the title Add FileAgentSkillsProvider for filesystem-based Agent Skills.NET: Add FileAgentSkillsProvider for filesystem-based Agent SkillsFeb 20, 2026
@SergeyMenshykhSergeyMenshykh changed the title .NET: Add FileAgentSkillsProvider for filesystem-based Agent Skills.NET: Support Agent SkillsFeb 20, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new .NET AIContextProvider that discovers Agent Skills from the filesystem and exposes them to agents via progressive disclosure (advertise → load → read resources), along with tests and a getting-started sample.

Changes:

  • Introduces FileAgentSkillsProvider + supporting loader/types to discover SKILL.md skills, advertise them via injected instructions, and expose load_skill / read_skill_resource tools.
  • Adds unit tests for discovery/parsing/resource-reading and updates projects to suppress the experimental diagnostic (MAAI001).
  • Adds a new Getting Started “Agent Skills” sample and wires it into the samples index/solution.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 9 comments.

Show a summary per file
FileDescription
dotnet/tests/Microsoft.Agents.AI.UnitTests/Microsoft.Agents.AI.UnitTests.csprojSuppresses experimental diagnostic in unit tests.
dotnet/tests/Microsoft.Agents.AI.UnitTests/AgentSkills/FileAgentSkillsProviderTests.csTests provider prompt/tool injection behavior and customization.
dotnet/tests/Microsoft.Agents.AI.UnitTests/AgentSkills/FileAgentSkillLoaderTests.csTests skill discovery/parsing/resource validation and read behavior.
dotnet/src/Microsoft.Agents.AI/Skills/SkillFrontmatter.csAdds parsed frontmatter type for skill metadata.
dotnet/src/Microsoft.Agents.AI/Skills/FileAgentSkillsProviderOptions.csAdds options for customizing the advertisement prompt template.
dotnet/src/Microsoft.Agents.AI/Skills/FileAgentSkillsProvider.csImplements the context provider and exposes the two skill tools.
dotnet/src/Microsoft.Agents.AI/Skills/FileAgentSkillLoader.csImplements discovery, frontmatter parsing, and resource validation/reading.
dotnet/src/Microsoft.Agents.AI/Skills/FileAgentSkill.csAdds internal representation of a loaded skill (body + resources).
dotnet/src/Microsoft.Agents.AI/Microsoft.Agents.AI.csprojEnables diagnostic IDs/experimental attribute injection and suppresses MAAI001.
dotnet/samples/GettingStarted/README.mdLinks new Agent Skills section from Getting Started index.
dotnet/samples/GettingStarted/AgentSkills/README.mdAdds index README for Agent Skills samples.
dotnet/samples/GettingStarted/AgentSkills/Agent_Step01_BasicSkills/skills/expense-report/references/POLICY_FAQ.mdAdds sample skill reference document.
dotnet/samples/GettingStarted/AgentSkills/Agent_Step01_BasicSkills/skills/expense-report/assets/expense-report-template.mdAdds sample skill asset template.
dotnet/samples/GettingStarted/AgentSkills/Agent_Step01_BasicSkills/skills/expense-report/SKILL.mdAdds sample skill with frontmatter + resource links.
dotnet/samples/GettingStarted/AgentSkills/Agent_Step01_BasicSkills/README.mdDocuments the sample and how progressive disclosure works.
dotnet/samples/GettingStarted/AgentSkills/Agent_Step01_BasicSkills/Program.csDemonstrates usage of FileAgentSkillsProvider with an agent.
dotnet/samples/GettingStarted/AgentSkills/Agent_Step01_BasicSkills/Agent_Step01_BasicSkills.csprojAdds sample project and copies skill content to output.
dotnet/agent-framework-dotnet.slnxAdds the new sample to the solution structure.

Comment threaddotnet/src/Microsoft.Agents.AI/Skills/FileAgentSkill.cs
Comment threaddotnet/src/Microsoft.Agents.AI/Skills/FileAgentSkillsProvider.cs Outdated
Comment threaddotnet/src/Microsoft.Agents.AI/Skills/FileAgentSkillLoader.cs Outdated
Comment threaddotnet/src/Microsoft.Agents.AI/Skills/FileAgentSkillLoader.cs Outdated
Comment threaddotnet/src/Microsoft.Agents.AI/Skills/FileAgentSkillsProvider.cs Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationUsage: [Issues, PRs], Target: documentation in the code base and learn docs.NETUsage: [Issues, PRs], Target: .Net

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Support for Agent Skills

6 participants

@SergeyMenshykh@lokitoth@rogerbarreto@westey-m@markwallace-microsoft