skills

package
v1.6.13 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSystemPromptInjection

func BuildSystemPromptInjection(skills []Skill) string

BuildSystemPromptInjection generates the skills section for the system prompt. It follows the Lazy Load pattern: listing available skills and instructing the agent to read definition files.

Types

type ExecutionMode added in v1.6.4

type ExecutionMode string

ExecutionMode defines how a group of skills should be executed

const (
	ModeParallel ExecutionMode = "parallel"
	ModeSerial   ExecutionMode = "serial"
)

type ExecutionPlan added in v1.6.4

type ExecutionPlan struct {
	Steps []ExecutionStep
}

ExecutionPlan represents the ordered execution of skills

type ExecutionStep added in v1.6.4

type ExecutionStep struct {
	Mode   ExecutionMode
	Skills []*Skill
}

ExecutionStep represents a single step in an execution plan

type Planner added in v1.6.4

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

Planner handles skill intention recognition and execution planning

func NewPlanner added in v1.6.4

func NewPlanner(r *Registry) *Planner

NewPlanner creates a new skill planner

func (*Planner) Plan added in v1.6.4

func (p *Planner) Plan(ctx context.Context, input string) (*ExecutionPlan, error)

Plan creates an execution plan based on the input text

type Registry added in v1.6.4

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

Registry manages the registration and lookup of skills

func NewRegistry added in v1.6.4

func NewRegistry() *Registry

NewRegistry creates a new skill registry

func (*Registry) All added in v1.6.4

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

All returns all registered skills

func (*Registry) Get added in v1.6.4

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

Get returns a skill by name

func (*Registry) LoadSkills added in v1.6.4

func (r *Registry) LoadSkills(skills []Skill)

LoadSkills registers a list of skills

func (*Registry) LookupCommand added in v1.6.4

func (r *Registry) LookupCommand(cmd string) (*Skill, bool)

LookupCommand finds a skill by command trigger (e.g., "/help")

func (*Registry) LookupKeyword added in v1.6.4

func (r *Registry) LookupKeyword(text string) (*Skill, bool)

LookupKeyword finds a skill by keyword trigger

func (*Registry) MatchAll added in v1.6.4

func (r *Registry) MatchAll(text string) []*Skill

MatchAll finds all skills matching the input via command, keyword, or regex

func (*Registry) MatchRegex added in v1.6.4

func (r *Registry) MatchRegex(text string) (*Skill, []string)

MatchRegex finds the first skill matching a regex trigger

func (*Registry) Register added in v1.6.4

func (r *Registry) Register(skill *Skill)

Register adds a skill to the registry and indexes its triggers

type Skill

type Skill struct {
	Name         string                 `yaml:"name"`
	Description  string                 `yaml:"description"`
	Path         string                 `yaml:"-"` // Absolute path to the SKILL.md file
	Content      string                 `yaml:"-"` // The markdown content (instructions)
	Triggers     []Trigger              `yaml:"triggers"`
	Tags         []string               `yaml:"tags"`
	Priority     int                    `yaml:"priority"`
	Timeout      time.Duration          `yaml:"timeout"`
	Retries      int                    `yaml:"retries"`
	Fallback     string                 `yaml:"fallback"`
	Dependencies []string               `yaml:"dependencies"`
	Metadata     map[string]interface{} `yaml:"metadata,omitempty"`
}

Skill represents a loaded AgentSkill

func LoadSkillsFromDirs

func LoadSkillsFromDirs(ctx context.Context, l *logger.Logger, dirs []string) ([]Skill, error)

LoadSkillsFromDirs scans the provided directories for SKILL.md files and loads them.

type Trigger added in v1.6.4

type Trigger struct {
	Type    string `yaml:"type"`
	Pattern string `yaml:"pattern"`
}

Trigger represents a skill activation trigger

Jump to

Keyboard shortcuts

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