Skip to content

[Python] [Breaking] Extract skill spec metadata into SkillFrontmatter#5775

Merged
SergeyMenshykh merged 4 commits into
microsoft:mainfrom
SergeyMenshykh:fix/skill-docstring-consistency
May 13, 2026
Merged

[Python] [Breaking] Extract skill spec metadata into SkillFrontmatter#5775
SergeyMenshykh merged 4 commits into
microsoft:mainfrom
SergeyMenshykh:fix/skill-docstring-consistency

Conversation

@SergeyMenshykh
Copy link
Copy Markdown
Member

@SergeyMenshykh SergeyMenshykh commented May 12, 2026

Motivation and Context

The Skill subclass constructors each accepted
ame and description as direct parameters. As the agentskills.io specification defines additional frontmatter fields, adding them to every constructor would be repetitive and fragile.

Description

Introduces SkillFrontmatter — a single class encapsulating all spec frontmatter fields (
ame, description, license, compatibility, �llowed_tools, metadata). Subclass constructors now accept rontmatter=SkillFrontmatter(...) instead of separate parameters. Adding future spec fields requires changing only one class.

  • Skill.frontmatter abstract property exposes spec metadata on every skill
  • _extract_frontmatter now parses all spec fields from YAML, including nested metadata: blocks
  • Updated all constructors, call sites, samples, tests, and AGENTS.md

[BREAKING] — Constructor signatures changed. Acceptable as the Skills API is @experimental.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? Yes — experimental API only.

- Add ClassSkill to Skill class docstring concrete implementations list
- Normalize 'defence' to 'defense' for American English consistency
- Remove extra blank line in InlineSkill docstring example

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 12, 2026 09:14
@moonbox3 moonbox3 added documentation Improvements or additions to documentation python labels May 12, 2026
@github-actions github-actions Bot changed the title [Python] Introduce SkillFrontmatter and parse all agentskills.io spec fields Python: [Python] Introduce SkillFrontmatter and parse all agentskills.io spec fields May 12, 2026
@SergeyMenshykh SergeyMenshykh self-assigned this May 12, 2026
@SergeyMenshykh SergeyMenshykh moved this to In Progress in Agent Framework May 12, 2026
@SergeyMenshykh SergeyMenshykh moved this from In Progress to In Review in Agent Framework May 12, 2026
@moonbox3
Copy link
Copy Markdown
Contributor

moonbox3 commented May 12, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework
   _skills.py7441498%507, 517, 954, 969, 971–972, 2336–2337, 2410, 2415, 2464, 2469, 2708–2709
TOTAL33886390688% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
6686 30 💤 0 ❌ 0 🔥 1m 46s ⏱️

@SergeyMenshykh SergeyMenshykh changed the title Python: [Python] Introduce SkillFrontmatter and parse all agentskills.io spec fields [Python] Extract skill spec metadata into SkillFrontmatter May 12, 2026
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

This PR updates the Python skills model to align more closely with the agentskills.io spec by centralizing all skill frontmatter fields into a new SkillFrontmatter object and extending SKILL.md frontmatter parsing to cover the full spec surface area.

Changes:

  • Introduces SkillFrontmatter and updates Skill to expose spec metadata via an abstract skill.frontmatter property.
  • Updates InlineSkill, FileSkill, and ClassSkill constructors to accept frontmatter=SkillFrontmatter(...) (breaking change for the experimental Skills API).
  • Extends _extract_frontmatter parsing to include license, compatibility, allowed-tools, and an indented metadata: block; updates samples/tests/docs accordingly.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
python/samples/02-agents/skills/skill_filtering/skill_filtering.py Updates skill filtering to reference s.frontmatter.name.
python/samples/02-agents/skills/script_approval/script_approval.py Updates sample skill construction to use SkillFrontmatter.
python/samples/02-agents/skills/mixed_skills/mixed_skills.py Updates inline + class skill construction to use SkillFrontmatter.
python/samples/02-agents/skills/code_defined_skill/code_defined_skill.py Updates sample skill construction to use SkillFrontmatter.
python/packages/core/tests/core/test_skills.py Updates existing skills tests for frontmatter and adds coverage for new spec fields parsing/validation.
python/packages/core/AGENTS.md Updates documentation to describe SkillFrontmatter and the new skill API shape.
python/packages/core/agent_framework/_skills.py Implements SkillFrontmatter, adds compatibility validation, and extends YAML frontmatter parsing (including metadata block parsing).
python/packages/core/agent_framework/init.py Exports SkillFrontmatter from the public package surface.

Comment thread python/packages/core/agent_framework/_skills.py
Comment thread python/packages/core/tests/core/test_skills.py Outdated
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Automated Code Review

Reviewers: 1 | Confidence: 92% | Result: All clear

Reviewed: Design Approach


Automated review by SergeyMenshykh's agents

SergeyMenshykh and others added 2 commits May 12, 2026 10:23
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@SergeyMenshykh SergeyMenshykh marked this pull request as ready for review May 12, 2026 09:52
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Automated Code Review

Reviewers: 3 | Confidence: 83% | Result: All clear

Reviewed: Security Reliability, Test Coverage, Design Approach


Automated review by SergeyMenshykh's agents

Comment thread python/packages/core/agent_framework/_skills.py
Comment thread python/packages/core/agent_framework/_skills.py Outdated
Scope YAML_KV_RE to column-0 keys only so indented children
under metadata: are not mistakenly parsed as top-level fields.
Add regression test and spec fields to sample SKILL.md files.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@TaoChenOSU TaoChenOSU left a comment

Choose a reason for hiding this comment

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

Is this a breaking change?

@SergeyMenshykh SergeyMenshykh changed the title [Python] Extract skill spec metadata into SkillFrontmatter [Python] [Breaking] Extract skill spec metadata into SkillFrontmatter May 13, 2026
@SergeyMenshykh
Copy link
Copy Markdown
Member Author

Is this a breaking change?

Yes, it's a breaking change for the experimental feature. I updated the PR to indicate the breaking nature.

@SergeyMenshykh SergeyMenshykh added this pull request to the merge queue May 13, 2026
Merged via the queue into microsoft:main with commit ab09246 May 13, 2026
36 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in Agent Framework May 13, 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 python

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Python: Add SkillFrontmatter class with full agentskills.io spec fields

4 participants