Documentation
¶
Overview ¶
Package skill loads skills, prompts that the model or the user can invoke, and renders them for an invocation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
Catalog is immutable; reloading builds a new one.
func NewCatalog ¶
NewCatalog keeps the first skill of each name, so callers pass skills in order of precedence.
func (*Catalog) Active ¶
Active may walk the workspace to match Paths, so a conversation computes it once and offers the same skills to the user and the model.
func (*Catalog) Invoke ¶
func (c *Catalog) Invoke(ctx context.Context, in InvokeInput) (*Invocation, error)
type Invocation ¶
type Spec ¶
type Spec struct {
Name string
Description string
WhenToUse string
// FilePath is reread on every invocation unless the skill is frozen.
// Bundled skills have none.
FilePath string
// BaseDir is where the skill's relative references resolve.
BaseDir string
// Source is "builtin", "user" or "project", shown to the user.
Source string
// Privileged lets the skill run its commands, allow tools and pick a
// model. Only trusted skills get it.
Privileged bool
DisableModelInvocation bool
DisableUserInvocation bool
ArgumentHint string
// Context is "fork" for a skill that runs in a sub-agent, else "inline".
Context string
Agent string
// Model overrides the model of a forked skill's sub-agent.
Model string
AllowedTools []string
// Paths, if set, activate the skill only in a workspace containing a
// match.
Paths []string
// contains filtered or unexported fields
}
func LoadDir ¶
LoadDir loads each *.md file in dir and each subdirectory with a SKILL.md at any depth below it, named after the subdirectory. A missing dir holds no skills.
func (Spec) Freeze ¶
Freeze snapshots the file so later edits don't change the skill. Project skills are frozen on load, so what runs is what the user trusted.
func (Spec) Privileges ¶
Privileges lists, for the user to review, what the skill does only when privileged: the commands it runs, the tools it allows and the model it picks.
type UsageTracker ¶
type UsageTracker struct {
// contains filtered or unexported fields
}
UsageTracker persists invocation counts so the listing can favor skills used often and recently.
func NewUsageTracker ¶
func NewUsageTracker(path string) (*UsageTracker, error)