class Riffer::Skills::Frontmatter
Immutable value object holding parsed SKILL.md YAML frontmatter. Required fields: name and description; the optional disable-model-invocation flag is recognized, and any other unrecognized top-level keys are merged into metadata.
Constants
- MAX_DESCRIPTION_LENGTH
- MAX_NAME_LENGTH
- NAME_PATTERN
Attributes
The skill description (1-1024 chars).
Whether the skill opts out of model-driven activation. Hidden from the catalog and rejected at model activation; still reachable via programmatic activation.
Metadata from the specโs metadata field plus any unrecognized top-level keys.
The skill name (1-64 chars, lowercase alphanumeric and hyphens).
Public Class Methods
Source
# File lib/riffer/skills/frontmatter.rb, line 70 def initialize(name:, description:, disable_model_invocation: false, metadata: {}) validate_name!(name) validate_description!(description) @name = name.freeze @description = description.freeze @disable_model_invocation = (disable_model_invocation == true) @metadata = metadata.freeze end
Raises Riffer::ArgumentError if name or description is invalid. disable_model_invocation is treated as set only when literally true.
Source
# File lib/riffer/skills/frontmatter.rb, line 35 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), disable_model_invocation: yaml.delete(:"disable-model-invocation"), metadata: yaml), body] end
Parses a raw SKILL.md string into a +[Frontmatter, body]+ pair โ public so custom backends neednโt reimplement parsing. Raises Riffer::ArgumentError if the frontmatter is invalid.
Source
# File lib/riffer/skills/frontmatter.rb, line 45 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), disable_model_invocation: yaml.delete(:"disable-model-invocation"), metadata: yaml) end
Parses only the frontmatter from a raw SKILL.md string, ignoring the body. Raises Riffer::ArgumentError if the frontmatter is invalid.