skill

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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(fsys fs.FS, names []string) (map[string]*Skill, error)

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

func ValidateEvals added in v0.1.14

func ValidateEvals(fsys fs.FS, name string) (int, error)

func ValidateStructure

func ValidateStructure(fsys fs.FS, name string) error

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

Types

type EvalCase added in v0.1.14

type EvalCase struct {
	Name     string       `yaml:"name"`
	Prompt   string       `yaml:"prompt"`
	Expected EvalExpected `yaml:"expected"`
}

type EvalExpected added in v0.1.14

type EvalExpected struct {
	Includes []string `yaml:"includes"`
	Excludes []string `yaml:"excludes,omitempty"`
}

type EvalSuite added in v0.1.14

type EvalSuite struct {
	Version int        `yaml:"version"`
	Skill   string     `yaml:"skill"`
	Cases   []EvalCase `yaml:"cases"`
}

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 name (subdirectory name). For local installs callers may
	// combine this with a base path to locate reference/script files.
	// For remote FS the value is the skill name only (no absolute path).
	Dir string `yaml:"-"`
}

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

func DiscoverAll

func DiscoverAll(fsys fs.FS) ([]*Skill, error)

DiscoverAll loads every skill subdirectory under fsys (the skills root FS). Structure and frontmatter validation errors are aggregated.

func LoadDir

func LoadDir(fsys fs.FS, name string) (*Skill, error)

LoadDir resolves a skill by name from the given skills FS. It expects <name>/SKILL.md to exist within fsys.

func (*Skill) CollectScriptPath

func (s *Skill) CollectScriptPath(skillsRoot string) string

CollectScriptPath returns the expected path to scripts/collect.sh within the given skills FS root. 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(fsys fs.FS) (string, error)

ReferenceContent reads references/REFERENCE.md for the skill if present. fsys must be the skills root FS (the same one passed to LoadDir/LoadMany). 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