Skip to content

Comments

.NET: Support Agent Skills#4122

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

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

Conversation

@SergeyMenshykh
Copy link
Member

@SergeyMenshykh SergeyMenshykh commented Feb 20, 2026

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

Copilot AI review requested due to automatic review settings February 20, 2026 11:04
@markwallace-microsoft markwallace-microsoft added documentation Improvements or additions to documentation .NET labels Feb 20, 2026
@github-actions github-actions bot changed the title Add FileAgentSkillsProvider for filesystem-based Agent Skills .NET: Add FileAgentSkillsProvider for filesystem-based Agent Skills Feb 20, 2026
@SergeyMenshykh SergeyMenshykh changed the title .NET: Add FileAgentSkillsProvider for filesystem-based Agent Skills .NET: Support Agent Skills Feb 20, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
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 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
File Description
dotnet/tests/Microsoft.Agents.AI.UnitTests/Microsoft.Agents.AI.UnitTests.csproj Suppresses experimental diagnostic in unit tests.
dotnet/tests/Microsoft.Agents.AI.UnitTests/AgentSkills/FileAgentSkillsProviderTests.cs Tests provider prompt/tool injection behavior and customization.
dotnet/tests/Microsoft.Agents.AI.UnitTests/AgentSkills/FileAgentSkillLoaderTests.cs Tests skill discovery/parsing/resource validation and read behavior.
dotnet/src/Microsoft.Agents.AI/Skills/SkillFrontmatter.cs Adds parsed frontmatter type for skill metadata.
dotnet/src/Microsoft.Agents.AI/Skills/FileAgentSkillsProviderOptions.cs Adds options for customizing the advertisement prompt template.
dotnet/src/Microsoft.Agents.AI/Skills/FileAgentSkillsProvider.cs Implements the context provider and exposes the two skill tools.
dotnet/src/Microsoft.Agents.AI/Skills/FileAgentSkillLoader.cs Implements discovery, frontmatter parsing, and resource validation/reading.
dotnet/src/Microsoft.Agents.AI/Skills/FileAgentSkill.cs Adds internal representation of a loaded skill (body + resources).
dotnet/src/Microsoft.Agents.AI/Microsoft.Agents.AI.csproj Enables diagnostic IDs/experimental attribute injection and suppresses MAAI001.
dotnet/samples/GettingStarted/README.md Links new Agent Skills section from Getting Started index.
dotnet/samples/GettingStarted/AgentSkills/README.md Adds index README for Agent Skills samples.
dotnet/samples/GettingStarted/AgentSkills/Agent_Step01_BasicSkills/skills/expense-report/references/POLICY_FAQ.md Adds sample skill reference document.
dotnet/samples/GettingStarted/AgentSkills/Agent_Step01_BasicSkills/skills/expense-report/assets/expense-report-template.md Adds sample skill asset template.
dotnet/samples/GettingStarted/AgentSkills/Agent_Step01_BasicSkills/skills/expense-report/SKILL.md Adds sample skill with frontmatter + resource links.
dotnet/samples/GettingStarted/AgentSkills/Agent_Step01_BasicSkills/README.md Documents the sample and how progressive disclosure works.
dotnet/samples/GettingStarted/AgentSkills/Agent_Step01_BasicSkills/Program.cs Demonstrates usage of FileAgentSkillsProvider with an agent.
dotnet/samples/GettingStarted/AgentSkills/Agent_Step01_BasicSkills/Agent_Step01_BasicSkills.csproj Adds sample project and copies skill content to output.
dotnet/agent-framework-dotnet.slnx Adds the new sample to the solution structure.

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>
Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
@SergeyMenshykh SergeyMenshykh added this pull request to the merge queue Feb 20, 2026
Merged via the queue into microsoft:main with commit 7ba636d Feb 20, 2026
15 checks passed
@github-project-automation github-project-automation bot moved this from In Review to Done in Agent Framework Feb 20, 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.

Support for Agent Skills

5 participants