skill

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package skill handles parsing of SKILL.md files, including YAML frontmatter extraction and body separation. It provides the core Skill type used by validation and scoring packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllowedTools

type AllowedTools struct {
	Value   string // normalized space-delimited string
	WasList bool   // true if the original YAML used a sequence
}

AllowedTools handles the type ambiguity in the allowed-tools field. The spec defines it as a space-delimited string, but many skills use a YAML list instead. This type accepts both.

func (AllowedTools) IsEmpty

func (a AllowedTools) IsEmpty() bool

IsEmpty returns true if no allowed-tools value was specified.

func (*AllowedTools) UnmarshalYAML

func (a *AllowedTools) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements custom unmarshaling for AllowedTools to accept both string and list formats.

type Frontmatter

type Frontmatter struct {
	Name          string            `yaml:"name"`
	Description   string            `yaml:"description"`
	License       string            `yaml:"license"`
	Compatibility string            `yaml:"compatibility"`
	Metadata      map[string]string `yaml:"metadata"`
	AllowedTools  AllowedTools      `yaml:"allowed-tools"`
}

Frontmatter represents the parsed YAML frontmatter of a SKILL.md file.

type Skill

type Skill struct {
	Dir            string
	Frontmatter    Frontmatter
	RawFrontmatter map[string]any
	Body           string
	RawContent     string
}

Skill represents a parsed skill package.

func Load

func Load(dir string) (*Skill, error)

Load reads and parses a SKILL.md file from the given directory.

func (*Skill) UnrecognizedFields

func (s *Skill) UnrecognizedFields() []string

UnrecognizedFields returns frontmatter field names not in the spec.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL