Skip to content

Fix SKILL.md frontmatter to comply with Agent Skills spec#12304

Draft
rkondratowicz wants to merge 1 commit intogitbutlerapp:masterfrom
rkondratowicz:fix/skill-frontmatter-spec-compliance
Draft

Fix SKILL.md frontmatter to comply with Agent Skills spec#12304
rkondratowicz wants to merge 1 commit intogitbutlerapp:masterfrom
rkondratowicz:fix/skill-frontmatter-spec-compliance

Conversation

@rkondratowicz
Copy link

🧢 Changes

  • Updated SKILL.md frontmatter to move version and author fields under metadata section
  • Modified inject_version() function to replace metadata.version instead of top-level version field
  • Updated extract_installed_version_from_content() to parse version from the metadata.version field
  • Added YAML parsing logic to detect and navigate the metadata section in frontmatter

☕️ Reasoning

The current SKILL.md frontmatter uses non-standard top-level fields (version and author) that don't comply with the Agent Skills specification.

This change makes the GitButler CLI skill compliant with the Agent Skills spec, which is important for proper integration with AI coding assistants that implement this specification (Claude Code, Cursor, GitHub Copilot, etc.).

Testing:

✅ All 42 unit tests passing
✅ All 2 integration tests passing
✅ Builds successfully with cargo build -p but --release

This is a non-breaking change - the skill functionality remains identical, only the frontmatter structure is updated.

- Move version and author from top-level to metadata section
- Update inject_version() to handle metadata.version format
- Update extract_installed_version_from_content() to parse metadata.version
- Update all related tests (13 test cases)

This makes the skill compliant with https://agentskills.io/specification
where only 'name' and 'description' are valid top-level fields, and
custom fields should be nested under the optional 'metadata' field.

All 42 unit tests and 2 integration tests pass.
Copilot AI review requested due to automatic review settings February 9, 2026 21:13
@vercel
Copy link

vercel bot commented Feb 9, 2026

@rkondratowicz is attempting to deploy a commit to the GitButler Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added rust Pull requests that update Rust code CLI The command-line program `but` labels Feb 9, 2026
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

Updates the GitButler CLI skill to comply with the Agent Skills frontmatter spec by relocating version/author into a metadata section and updating the Rust helpers that inject and read the version accordingly.

Changes:

  • Restructured SKILL.md frontmatter to use metadata.version (and metadata.author).
  • Updated version injection logic to write quoted versions into the new frontmatter structure.
  • Updated installed-version extraction to locate metadata.version and added/updated related tests.

Reviewed changes

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

File Description
crates/but/src/command/skill.rs Updates version injection and installed-version extraction to use metadata.version, plus test updates.
crates/but/skill/SKILL.md Moves version under metadata in the frontmatter to match the spec.
Comments suppressed due to low confidence (1)

crates/but/src/command/skill.rs:1

  • This drops support for previously-installed skills that still have a top-level version: (old format). That can change behavior (e.g., version checks returning None) even though the PR description calls this non-breaking. Consider supporting both formats: first try metadata.version, and if not found, fall back to parsing a top-level version: within the frontmatter.
use std::{fmt::Write as _, path::PathBuf};

Comment on lines +263 to +264
// Detect metadata section (no indentation)
if line.trim() == "metadata:" {
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

Valid YAML like metadata: # comment won’t be recognized because this check requires the trimmed line to equal exactly metadata:. Consider detecting metadata: more robustly (e.g., checking for a metadata: prefix after trimming, and ignoring any trailing inline comment).

Suggested change
// Detect metadata section (no indentation)
if line.trim() == "metadata:" {
// Detect metadata section (no indentation). Allow inline comments or extra spaces.
let trimmed = line.trim();
if trimmed.starts_with("metadata:") {

Copilot uses AI. Check for mistakes.
Comment on lines +197 to +198
// Replace version in metadata section: version: "0.0.0" -> version: "{version}"
let updated_frontmatter = frontmatter.replace("version: \"0.0.0\"", &format!("version: \"{}\"", version));
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

Despite the comment, this replaces every version: \"0.0.0\" occurrence within the frontmatter, not specifically metadata.version. If additional version-like fields ever appear in the frontmatter, they could be unintentionally rewritten. Consider using the same metadata-aware scanning approach as extract_installed_version_from_content() to update only the metadata.version entry (and ideally only the first match).

Copilot uses AI. Check for mistakes.
/// Extract the version from YAML frontmatter content.
/// Extract the version from YAML frontmatter content (from metadata.version field).
/// Returns None if the content has no frontmatter or no version entry.
fn extract_installed_version_from_content(content: &str) -> Option<String> {
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

If you add backward compatibility for the legacy top-level version: format (recommended), add a unit test case that confirms extract_installed_version_from_content() still returns the correct version when version: is present at the top-level (without metadata:).

Copilot uses AI. Check for mistakes.
@Byron Byron marked this pull request as draft February 16, 2026 05:12
@Byron Byron added the feedback requested Feedback was requested to help resolve the issue label Feb 16, 2026
@Byron
Copy link
Collaborator

Byron commented Feb 16, 2026

Thanks for the suggestion!

@krlvi would know best if this change is desirable. Meanwhile, I have put this PR back into draft as it doesn't pass CI and Copilot would probably deserve attention, even if just by discarding its comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLI The command-line program `but` feedback requested Feedback was requested to help resolve the issue rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants