skill

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package skill loads and validates Prism Agent Skills from SKILL.md files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadMany

func LoadMany(skillsRoot string, names []string) (map[string]*Skill, error)

LoadMany loads all named skills from skillsRoot and returns a map keyed by skill name. All errors are collected so callers see every missing skill at once.

func ValidateStructure

func ValidateStructure(dir string) error

ValidateStructure ensures a skill directory has SKILL.md, references/, and scripts/.

Types

type Skill

type Skill struct {
	// Required frontmatter fields per agentskills.io spec.
	Name        string `yaml:"name"`
	Description string `yaml:"description"`

	// Optional frontmatter fields Prism honours when present.
	Compatibility string            `yaml:"compatibility"`
	Metadata      map[string]string `yaml:"metadata"`

	// Body is the Markdown body of SKILL.md after the frontmatter block.
	Body string `yaml:"-"`
	// Dir is the skill directory path (useful for loading references/scripts).
	Dir string `yaml:"-"`
}

Skill holds the parsed SKILL.md frontmatter and body for one Agent Skill.

func DiscoverAll

func DiscoverAll(skillsRoot string) ([]*Skill, error)

DiscoverAll loads every skill subdirectory under skillsRoot. Structure and frontmatter validation errors are aggregated.

func LoadDir

func LoadDir(skillsRoot, name string) (*Skill, error)

LoadDir resolves a skill by name from the skills root directory. It expects skills/<name>/SKILL.md to exist.

func ParseFile

func ParseFile(skillMDPath string) (*Skill, error)

ParseFile reads a SKILL.md file and returns a Skill.

func (*Skill) CollectScriptPath

func (s *Skill) CollectScriptPath() string

CollectScriptPath returns the expected path to scripts/collect.sh. It does not guarantee the file exists.

func (*Skill) FullText

func (s *Skill) FullText() string

FullText returns the skill content formatted for prompt injection. It includes a Markdown heading, the description, optional compatibility note, and the full skill body.

func (*Skill) MetadataSummary

func (s *Skill) MetadataSummary() string

MetadataSummary returns a one-line summary for the skills index section ("progressive disclosure metadata phase").

func (*Skill) ReferenceContent

func (s *Skill) ReferenceContent() (string, error)

ReferenceContent reads references/REFERENCE.md for the skill if present. Returns an empty string without error when the file does not exist.

Jump to

Keyboard shortcuts

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