skills

package
v0.3.34 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingYAMLFrontmatter is returned when the yaml frontmatter is missing.
	ErrMissingYAMLFrontmatter = fmt.Errorf("agents: missing yaml frontmatter")
	// ErrInvalidSkillFormat is returned when the skill format is invalid.
	ErrInvalidSkillFormat = fmt.Errorf("agents: invalid skill format")
)

Functions

This section is empty.

Types

type Catalog

type Catalog interface {
	// Load loads the catalog from the configured roots.
	Load() error
	// Skills returns the list of skills in the catalog.
	Skills() []Skill
	// Skill returns the skill with the given name, or nil if it does not exist.
	Skill(name string) (Skill, bool)
	// Enable is enabling a skill in the catalog.
	Enable(name string)
	// Disable is disabling a skill in the catalog.
	Disable(name string)
	// Clear clears the catalog of skills.
	Clear()
}

Catalog represents a catalog of skills.

type CatalogImpl

type CatalogImpl struct {
	// contains filtered or unexported fields
}

CatalogImpl represents a catalog of skills.

func NewCatalog

func NewCatalog(opts ...CatalogOpt) *CatalogImpl

NewCatalog creates a new Catalog.

func (*CatalogImpl) Clear

func (c *CatalogImpl) Clear()

Clear clears the catalog of skills.

func (*CatalogImpl) Disable

func (c *CatalogImpl) Disable(name string)

Disable is disabling a skill in the catalog. It removes the skill from the active skills map.

func (*CatalogImpl) Enable

func (c *CatalogImpl) Enable(name string)

Enable is enabling a skill in the catalog.

func (*CatalogImpl) Load

func (c *CatalogImpl) Load() error

Load loads the catalog from the configured roots.

func (*CatalogImpl) Skill

func (c *CatalogImpl) Skill(name string) (Skill, bool)

Skill returns the skill with the given name, or nil if it does not exist.

func (*CatalogImpl) Skills

func (c *CatalogImpl) Skills() []Skill

Skills returns the list of skills in the catalog.

type CatalogImplOpts

type CatalogImplOpts struct {
	// Roots is the list of root directories to scan for skills.
	Roots []string
}

CatalogOpts is a slice of CatalogOpt functions.

func DefaultCatalogOpts

func DefaultCatalogOpts() *CatalogImplOpts

DefaultCatalogOpts returns the default options for creating a Catalog.

type CatalogOpt

type CatalogOpt func(*CatalogImplOpts)

CatalogOpt represents options for creating a Catalog.

func WithRoots

func WithRoots(roots ...string) CatalogOpt

WithRoots returns a CatalogOpt that sets the roots of the catalog.

type Parser

type Parser interface {
	// Parse parses a SKILL.md file and returns a Skill.
	Parse(r io.Reader) (Skill, error)
}

Parser respresents a parser that can parse SKILL.md files.

type ParserImpl

type ParserImpl struct{}

ParserImpl is an implementation of the Parser interface.

func NewParser

func NewParser() *ParserImpl

NewParser returns a new Parser.

func (*ParserImpl) Parse

func (p *ParserImpl) Parse(r io.Reader) (Skill, error)

Parse parses a skill definition from an io.Reader.

type Skill

type Skill interface {
	// RootPath returns the root path of the skill.
	RootPath() string
	// Name returns the name of the skill.
	Name() string
	// Description returns the description of the skill.
	Description() string
	// License returns the license of the skill.
	License() string
	// Compatibility returns the compatibility of the skill.
	Compatibility() string
	// Metadata returns the metadata of the skill.
	Metadata() map[string]any
	// AllowedTools returns the allowed tools of the skill.
	AllowedTools() string
	// Body returns the body of the skill.
	Body() string

	yaml.Unmarshaler
}

Skill represents a skill parsed from a SKILL.md file.

func LoadSkills

func LoadSkills(path string) ([]Skill, error)

LoadSkills loads a skill by seeking skills files in the given path.

type SkillImpl

type SkillImpl struct {
	// contains filtered or unexported fields
}

SkillImpl represents a skill parsed from a SKILL.md file.

func (*SkillImpl) AllowedTools

func (s *SkillImpl) AllowedTools() string

AllowedTools returns the allowed tools of the skill.

func (*SkillImpl) Body

func (s *SkillImpl) Body() string

Body returns the body of the skill.

func (*SkillImpl) Compatibility

func (s *SkillImpl) Compatibility() string

Compatibility returns the compatibility of the skill.

func (*SkillImpl) Description

func (s *SkillImpl) Description() string

Description returns the description of the skill.

func (*SkillImpl) License

func (s *SkillImpl) License() string

License returns the license of the skill.

func (*SkillImpl) Metadata

func (s *SkillImpl) Metadata() map[string]any

Metadata returns the metadata of the skill.

func (*SkillImpl) Name

func (s *SkillImpl) Name() string

Name returns the name of the skill.

func (*SkillImpl) RootPath

func (s *SkillImpl) RootPath() string

RootPath returns the root path of the skill.

func (*SkillImpl) UnmarshalYAML

func (s *SkillImpl) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals the skill from YAML.

Jump to

Keyboard shortcuts

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