skill

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: AGPL-3.0, Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package skill implements the skill system: named, reusable instruction packages the agent can invoke on demand. The format follows the agentskills.io open standard — a SKILL.md with YAML frontmatter (name, description, and optional license/compatibility fields) followed by Markdown instructions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

type Registry struct {

	// OnInvoke, if set, is called when a skill is invoked (before its instructions
	// are returned). Its return string is appended to the tool output — hosts use it
	// to reveal + unlock the skill's MCPs (e.g. append a deferred-tools name block
	// and add those tools to the session unlock set). Side effects (unlocking) run
	// here too.
	OnInvoke func(Skill) string
	// contains filtered or unexported fields
}

Registry is a name-indexed set of skills.

func LoadDir

func LoadDir(dir string) (*Registry, error)

LoadDir loads skills from a directory. Each skill is a subdirectory containing SKILL.md (or a bare .md file) with YAML frontmatter following the agentskills.io specification (name, description, and optional license/compatibility fields).

func NewRegistry

func NewRegistry(skills ...Skill) *Registry

NewRegistry builds a registry from skills.

func (*Registry) Add

func (r *Registry) Add(s Skill)

Add registers (or replaces) a skill.

func (*Registry) Get

func (r *Registry) Get(name string) (Skill, bool)

Get returns a skill by name.

func (*Registry) List

func (r *Registry) List() []Skill

List returns skills in registration order.

func (*Registry) Tool

func (r *Registry) Tool() tool.CoreTool

name returns that skill's instructions for the agent to follow.

type Skill

type Skill struct {
	Name          string
	Description   string
	License       string
	Compatibility string
	WhenToUse     string // legacy; new skills use Description for when-to-use
	Instructions  string
	// MCPs names MCP servers this skill unlocks when invoked (frontmatter `mcps:`).
	// Hosts use this to reveal + unlock those servers' deferred tools on load — see
	// Registry.OnInvoke.
	MCPs []string
	// Dir is the directory that contains this skill's SKILL.md file.
	// Empty for skills loaded from sources other than the filesystem.
	Dir string
}

Skill is one invokable instruction package. Fields align with the agentskills.io specification:

  • Name and Description are required
  • License, Compatibility are optional standard fields
  • WhenToUse is kept for backwards compatibility (pre-spec skills used it; new skills should fold this into Description instead)

Jump to

Keyboard shortcuts

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