class Riffer::Skills::Frontmatter
Immutable value object holding parsed SKILL.md YAML frontmatter.
Required fields per the Agent Skills spec: name and description. All unrecognized top-level frontmatter keys are merged into metadata.
frontmatter, body = Riffer::Skills::Frontmatter.parse(raw_content)
Constants
- MAX_DESCRIPTION_LENGTH
- MAX_NAME_LENGTH
- NAME_PATTERN
Attributes
The skill description (1-1024 chars).
Arbitrary key-value metadata from the specโs metadata field and any unrecognized top-level frontmatter keys.
The skill name (1-64 chars, lowercase alphanumeric and hyphens).
Public Class Methods
Source
# File lib/riffer/skills/frontmatter.rb, line 81 def initialize(name:, description:, metadata: {}) validate_name!(name) validate_description!(description) @name = name.freeze @description = description.freeze @metadata = metadata.freeze end
Creates a new Frontmatter.
- name
-
the skill name (must match +[a-z0-9]([a-z0-9-]*[a-z0-9])?+, 1-64 chars).
- description
-
the skill description (1-1024 chars).
- metadata
-
optional metadata hash.
Raises Riffer::ArgumentError if name or description is invalid.
Source
# File lib/riffer/skills/frontmatter.rb, line 38 def self.parse(raw) yaml, body = split_frontmatter(raw) raise Riffer::ArgumentError, "missing YAML frontmatter (expected --- delimiters)" if yaml.empty? [new(name: yaml.delete(:name), description: yaml.delete(:description), metadata: yaml), body] end
Parses a raw SKILL.md string into a Frontmatter and body.
Splits on YAML front matter delimiters (---). Unrecognized top-level keys become metadata. Available to custom backends so they donโt need to reimplement parsing.
Raises Riffer::ArgumentError if frontmatter is invalid.
Source
# File lib/riffer/skills/frontmatter.rb, line 50 def self.parse_frontmatter(raw) yaml, _ = split_frontmatter(raw) raise Riffer::ArgumentError, "missing YAML frontmatter (expected --- delimiters)" if yaml.empty? new(name: yaml.delete(:name), description: yaml.delete(:description), metadata: yaml) end
Parses only the frontmatter from a raw SKILL.md string, ignoring the body.
Raises Riffer::ArgumentError if frontmatter is invalid.