skills

package
v1.57.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ToolNameReadSkill     = "read_skill"
	ToolNameReadSkillFile = "read_skill_file"
	ToolNameRunSkill      = "run_skill"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PreparedSkillFork

type PreparedSkillFork struct {
	// SkillName is the validated skill name, suitable for span attributes,
	// log fields, and sub-session titles ("Skill: <name>").
	SkillName string
	// Task is the caller-supplied task description, intended to be used as
	// the implicit user message of the child session.
	Task string
	// Content is the expanded SKILL.md content, intended to be used as the
	// system message of the child session.
	Content string
	// Model is the optional model override declared in the SKILL.md
	// frontmatter. Empty means "use the parent agent's current model".
	Model string
}

PreparedSkillFork carries the validated and expanded data needed to launch a skill as an isolated sub-agent. Callers (typically the runtime) use it to build the child session; this lets the skill-specific business rules (lookup, fork validation, content expansion) live with the toolset rather than the runtime.

type RunSkillArgs

type RunSkillArgs struct {
	Name string `json:"name" jsonschema:"The name of the skill to run as a sub-agent"`
	Task string `json:"task" jsonschema:"A clear description of the task the skill sub-agent should achieve"`
}

RunSkillArgs specifies the parameters for the run_skill tool.

type Toolset

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

Toolset provides the read_skill and read_skill_file tools that let an agent load skill content and supporting resources by name. It hides whether a skill is local or remote — the agent just sees a name and description.

func NewSkillsToolset

func NewSkillsToolset(loadedSkills []skills.Skill, workingDir string) *Toolset

func (*Toolset) FindSkill

func (s *Toolset) FindSkill(name string) *skills.Skill

FindSkill returns the skill with the given name, or nil if not found.

func (*Toolset) Instructions

func (s *Toolset) Instructions() string

func (*Toolset) PrepareForkSubSession

func (s *Toolset) PrepareForkSubSession(ctx context.Context, args RunSkillArgs) (*PreparedSkillFork, *tools.ToolCallResult)

PrepareForkSubSession validates a run_skill request and loads the expanded skill content. It returns either a populated PreparedSkillFork, or a ToolCallResult describing why the call cannot proceed (skill missing, skill not configured for fork mode, content read failure). The caller is responsible for the runtime-specific orchestration (sub-session creation, tracing, event forwarding).

func (*Toolset) ReadSkillContent

func (s *Toolset) ReadSkillContent(ctx context.Context, name string) (string, error)

ReadSkillContent returns the content of a skill's SKILL.md by name. For local skills, it expands any !`command` patterns in the content by executing the commands and replacing the patterns with their stdout output. Command expansion is disabled for remote skills to prevent arbitrary code execution.

func (*Toolset) ReadSkillFile

func (s *Toolset) ReadSkillFile(skillName, relativePath string) (string, error)

ReadSkillFile returns the content of a supporting file within a skill. The path is relative to the skill's base directory (e.g. "references/FORMS.md").

func (*Toolset) Skills

func (s *Toolset) Skills() []skills.Skill

Skills returns the loaded skills (used by the app layer for slash commands).

func (*Toolset) Tools

func (s *Toolset) Tools(context.Context) ([]tools.Tool, error)

Jump to

Keyboard shortcuts

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