Documentation
¶
Overview ¶
Package skill loads SKILL.md capability bundles from disk and exposes them to an agent.
A skill is a folder holding a SKILL.md whose YAML frontmatter carries at least a name and a description, followed by markdown instructions and optional bundled resources:
skills/
incident-triage/
SKILL.md
runbook.md
queries/slow-requests.sql
Progressive disclosure ¶
Only each skill's name and description sit in the model's context. The instructions load when the model chooses a skill and calls load_skill. That property is the whole point: twenty skills cost twenty one-line descriptions rather than twenty documents, so a large library stays affordable.
What this package will not do ¶
It does not execute anything. A skill is instructions and reference material; bundled files are read, never run. A format that silently executes code from a folder someone cloned is a supply-chain problem, and loading a skill is not a decision a user makes consciously enough to carry that risk.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Tools ¶
func Tools(lib *Library) []interfaces.Tool
Tools returns the tools that expose a library to a model.
Two tools, deliberately: one to read a skill's instructions, one to read a bundled file. Registering a tool per skill instead would put every skill's full schema in context on every request, which is exactly the cost progressive disclosure exists to avoid.
Types ¶
type Library ¶
type Library struct {
// contains filtered or unexported fields
}
Library is a set of loaded skills.
func LoadDir ¶
LoadDir loads every skill under root.
A directory containing a SKILL.md is a skill. Directories are walked one level deep, which matches how skill collections are laid out in practice and avoids surprising recursion into unrelated trees.
func (*Library) Catalog ¶
Catalog renders the name-and-description index that sits in the model's context.
This is the entire context cost of a skill library until one is invoked.
type Skill ¶
type Skill struct {
// Name identifies the skill to the model. Required.
Name string `yaml:"name"`
// Description tells the model when to use it. Required, and the only part
// besides the name that is always in context -- so it is what determines
// whether the skill is ever chosen.
Description string `yaml:"description"`
// Version is optional metadata.
Version string `yaml:"version,omitempty"`
// Tags are optional grouping labels.
Tags []string `yaml:"tags,omitempty"`
// Instructions is the markdown body, loaded on demand.
Instructions string `yaml:"-"`
// Dir is the skill's directory on disk.
Dir string `yaml:"-"`
// Resources are the bundled files, relative to Dir.
Resources []string `yaml:"-"`
}
Skill is one loaded capability bundle.
func (*Skill) ReadResource ¶
ReadResource returns a bundled file's contents.
The path is confined to the skill's directory: a resource name that escapes it, by traversal or symlink, is refused. A skill folder arrives by git clone, so treating its contents as trusted paths would let one read arbitrary files off the host.