skill

package
v0.2.3-beta.2 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package skill implements user-installed Markdown skills and the SKILL tool that invokes them.

Skills live in two directories. Both layouts are identical:

<root>/skills/
  <skill-name>/
    SKILL.md

LoadRegistry reads EvvaHome first then WorkDir, so a workdir-local skill transparently overrides a same-named home skill. The first line of every SKILL.md is parsed as `# <skill-name> <description>`; the body is whatever follows. The SKILL tool wraps the body as "Follow these instructions" when the model invokes a skill, so the file content is treated as opaque Markdown — the package does not impose structure beyond the title line.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Names

func Names() []tools.ToolName

Names lists every tool name this package contributes. Callers compose this into a profile's ActiveTools list the same way they do fs.Names() etc.

Types

type Lookup

type Lookup func() *Registry

Lookup is the late-binding shape NewSkill accepts. The host (cmd/evva) loads the registry at startup and installs it on the agent's ToolState; the SkillTool reads it through Lookup at Execute time so construction order between the tool and the registry doesn't matter — mirrors meta.SpawnerLookup and meta.DeferredLookup.

type Registry

type Registry struct {

	// Warnings collects non-fatal load issues (malformed first lines, name
	// mismatches, unreadable files). Callers may surface these at startup;
	// the loader never blocks boot on them.
	Warnings []string
	// contains filtered or unexported fields
}

Registry is the merged catalog of installed skills. Construct via LoadRegistry; methods are safe to call from any goroutine because the map is set once at construction and only read afterwards.

func LoadRegistry

func LoadRegistry(homeSkillsDir, workdirSkillsDir string) (*Registry, error)

LoadRegistry scans homeSkillsDir then workdirSkillsDir and returns the merged registry. Missing directories are treated as empty — having no skills installed is the normal state, not an error.

The order matters: workdir skills overwrite home skills with the same folder name. The override is recorded as a warning so the user can spot surprise shadowing.

func (*Registry) Get

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

Get returns the meta for a skill by name. ok=false when unknown.

func (*Registry) List

func (r *Registry) List() []SkillMeta

List returns every known skill sorted by name. Used by the sysprompt builder so the # Skills section is deterministic across runs.

func (*Registry) LoadBody

func (r *Registry) LoadBody(name string) (string, error)

LoadBody reads the full SKILL.md content for the named skill verbatim. The SKILL tool wraps this output before returning it to the model.

func (*Registry) Names

func (r *Registry) Names() []string

Names returns just the skill names, sorted. Convenience for callers that only need the catalog identifiers (e.g. the unknown-skill error message).

type SkillMeta

type SkillMeta struct {
	Name        string
	Description string
	Path        string // absolute path to SKILL.md
	Source      SkillSource
}

SkillMeta is the resolved metadata for a single skill. Body content is loaded on demand via Registry.LoadBody so the prompt path stays cheap.

type SkillSource

type SkillSource string

SkillSource identifies which directory a skill was loaded from. WorkDir always wins on a name clash; this field is exposed mostly for logging and a future `/skills` slash command that wants to surface the origin.

const (
	SourceHome    SkillSource = "home"
	SourceWorkDir SkillSource = "workdir"
)

type SkillTool

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

SkillTool is the LLM-facing tool that invokes a user-installed skill by name. Execute returns the SKILL.md body wrapped as an instruction block so the model treats it as guidance to follow, not raw content to summarize.

func NewSkill

func NewSkill(lookup Lookup) *SkillTool

NewSkill constructs a SkillTool that reads its registry via lookup at Execute time. lookup may be nil (yields a clear runtime error if the model invokes the tool); it may also return nil (same outcome).

func (*SkillTool) Description

func (t *SkillTool) Description() string

func (*SkillTool) Execute

func (t *SkillTool) Execute(_ context.Context, logger *slog.Logger, input json.RawMessage) (tools.Result, error)

func (*SkillTool) Name

func (t *SkillTool) Name() string

func (*SkillTool) Schema

func (t *SkillTool) Schema() json.RawMessage

Jump to

Keyboard shortcuts

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