Documentation
¶
Overview ¶
Package skills implements the Agent Skills open standard (https://agentskills.io) for AI assistants.
A skill is a directory containing a SKILL.md file with YAML front-matter (name, description) and markdown instructions. Skills are discovered at session start via filesystem scan, a compact catalog is injected into the system prompt, and full instructions are loaded on demand when the model activates a skill via the activate_skill tool.
Index ¶
Constants ¶
const ActivateSkillToolName = "activate_skill"
ActivateSkillToolName is the name registered with the LLM.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActivateSkillError ¶ added in v0.17.130
type ActivateSkillError struct {
Code string `json:"code,omitempty"`
Message string `json:"message,omitempty"`
AvailableSkills string `json:"available_skills,omitempty"`
}
ActivateSkillError describes why activation failed and lists the names that would have worked.
type ActivateSkillErrorResponse ¶ added in v0.17.130
type ActivateSkillErrorResponse struct {
Error ActivateSkillError `json:"error,omitempty"`
}
ActivateSkillErrorResponse is returned instead of an error when the named skill does not exist, so the model can retry with a valid name.
type ActivateSkillRequest ¶
type ActivateSkillRequest struct {
Name string `json:"name" jsonschema:"required,title=Name,description=The name of the skill to activate."`
}
ActivateSkillRequest is the JSON input expected by the tool.
type ActivateSkillResponse ¶ added in v0.17.130
type ActivateSkillResponse struct {
Skill string `json:"skill,omitempty"`
Instructions string `json:"instructions,omitempty"`
Location string `json:"location,omitempty"`
}
ActivateSkillResponse is the successful tool result: the skill's full instructions plus the directory they were loaded from, so file-reading tools can resolve bundled resource paths.
type ActivateSkillTool ¶
type ActivateSkillTool struct {
// contains filtered or unexported fields
}
ActivateSkillTool implements tools.ITool. It loads and returns the full instructions for the named skill (tier-2 progressive disclosure).
func NewActivateSkillTool ¶
func NewActivateSkillTool(skills Skills) (*ActivateSkillTool, error)
NewActivateSkillTool creates the tool. The JSON schema for the "name" parameter is built with an enum constraint listing all available skill names, so the LLM receives concrete choices rather than a freeform string. Returns an error if loader is nil or has no skills loaded.
func (*ActivateSkillTool) Call ¶
Call parses the JSON input, looks up the skill, and returns its full body wrapped in <skill_content> tags along with a listing of bundled resources.
func (*ActivateSkillTool) Description ¶
func (t *ActivateSkillTool) Description() string
Description returns the prompt-facing description of the tool.
func (*ActivateSkillTool) Name ¶
func (t *ActivateSkillTool) Name() string
Name returns ActivateSkillToolName.
func (*ActivateSkillTool) Parameters ¶
func (t *ActivateSkillTool) Parameters() *jsonschema.Schema
Parameters returns the input schema, whose name property enumerates the available skill names.
type AgentConfig ¶ added in v0.17.130
type AgentConfig struct {
// Disabled specifies to skip the agent to load skills.
Disabled bool `json:"disabled,omitempty" yaml:"disabled,omitempty"`
// Paths specifies additional directories or tar archives to search for
// skills for the agent. They are searched after Config.Paths, and a
// skill found directly in one (./<skill>/SKILL.md) belongs to this agent
// unless its frontmatter names other agents. ./.<agent>/ folders inside
// still assign their skills to the agent they name.
// Later directories override earlier ones when two skills share the same name.
Paths []string `json:"paths,omitempty" yaml:"paths,omitempty"`
}
AgentConfig overrides the loader configuration for a single agent.
type Config ¶ added in v0.17.130
type Config struct {
// Strict mode enforces that an error is returned if a skill is invalid or failed to parse.
Strict bool `json:"strict,omitempty" yaml:"strict,omitempty"`
// EnableDefaultSkills enables the default skills,
// when the skill path does not include Agent name or Skill does not specify Agents field.
EnableDefaultSkills bool `json:"enable_default_skills,omitempty" yaml:"enable_default_skills,omitempty"`
// EnableStandardPaths enables to discover the standard paths for skills:
// ~/.agents/skills/.<agent>/<skill>/...
// ~/.agents/.<clientName>/skills/.<agent>/<skill>/...
// <cwd>/.agents/skills/.<agent>/<skill>/...
// <cwd>/.agents/.<clientName>/skills/.<agent>/<skill>/...
//
// If EnableStandardPaths is false, then only the Paths and Agents.Paths are used.
EnableStandardPaths bool `json:"enable_standard_paths,omitempty" yaml:"enable_standard_paths,omitempty"`
// Paths specifies the paths to search for skills.
// The following pattern is applied to paths:
// ./<skill>/...
// ./.<agent>/<skill>/...
// Later directories override earlier ones when two skills share the same name.
Paths []string `json:"paths,omitempty" yaml:"paths,omitempty"`
// Agents specifies override configuration for agents.
// If an agent configuration is present, then it will override the default configuration.
Agents map[string]*AgentConfig `json:"agents,omitempty" yaml:"agents,omitempty"`
}
Config specifies the configuration for the loader. Example of the directory structure: ~/.agents/skills/ ├── pdf-processing/ │ ├── SKILL.md ← discovered │ └── scripts/ │ └── extract.py ├── data-analysis/ │ └── SKILL.md ← discovered └── README.md ← ignored (not a skill directory)
~/.agents/.my-client/skills/ ├── .analyzer-agent/ ← agent name │ └── pdf-processing/ ← skill name │ ├── SKILL.md ← discovered │ └── scripts/ │ └── extract.py ├── data-analysis/ ← skill name │ └── SKILL.md ← discovered └── README.md ← ignored (not a skill directory)
func LoadConfig ¶ added in v0.17.130
LoadConfig reads a loader Config from a YAML or JSON file.
type Frontmatter ¶
type Frontmatter struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
License string `yaml:"license"`
Compatibility string `yaml:"compatibility"`
// AllowedTools is a space or comma separated list of tool names that are allowed to be used in the skill.
AllowedTools string `yaml:"allowed-tools"`
// Agents is a space or comma separated list of agent names that are allowed to use this skill.
Agents string `yaml:"agents"`
// Tags is a space or comma separated list of tags for filtering skills.
Tags string `yaml:"tags"`
// Metadata is a map of key-value pairs for additional metadata.
Metadata map[string]string `yaml:"metadata"`
}
Frontmatter holds the YAML metadata parsed from the header of a SKILL.md file.
type Loader ¶
type Loader interface {
// ClientName returns the name of the client that owns the skills.
ClientName() string
// Skills returns all loaded skills for the given agent sorted alphabetically by name.
// Use tags to filter skills by tags. The Skill must have all the tags provided.
Skills(agent string, tags ...string) Skills
// Agents returns a list agents names for which skills are loaded.
Agents() []string
}
Loader gives access to the skills discovered on the filesystem or in a tar archive, grouped by agent. Obtain one with NewLoader, or via llmfactory.Factory.Skills when skills are declared in the factory config.
type Skill ¶
type Skill struct {
Name string
Description string
AllowedTools []string
Agents []string
Tags []string
Metadata map[string]string
// Body is the markdown body after the frontmatter block
Body string
// Location is the relative path to the skill directory
Location string
// contains filtered or unexported fields
}
Skill represents a parsed agent skill.
func (*Skill) ListResources ¶ added in v0.17.130
ListResources returns relative paths to all non-SKILL.md files in the skill directory, including files in subdirectories (scripts/, references/, assets/).
func (*Skill) LoadResources ¶ added in v0.17.130
LoadResources reads and caches every file returned by ListResources, keyed by its relative path. Unreadable files are skipped. Resources are for your own tools to consume; they are not returned by the activate_skill tool.
type Skills ¶ added in v0.17.130
type Skills []*Skill
Skills is a list of parsed skills, ordered by name when returned by a Loader.
func (Skills) Filter ¶ added in v0.17.130
Filter returns a new Skills list filtered by the given name and tags. If name is empty, the skills are matched by tags only.