skills

package
v2.8.0-dev.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package skills loads SKILL.md bundles from .agents/skills/<name>/ and exposes them as an ADK Toolset the agent can invoke.

The schema mirrors Anthropic's published SKILL.md frontmatter so users can drop existing skill bundles directly into a project.

Bodies load lazily on invocation — we keep cold-start fast by skipping skill.WithCompletePreloadSource.

Index

Constants

View Source
const SkillDirName = "skills"

SkillDirName is the project-local directory holding skill bundles.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	Name        string
	Description string
}

Info is the per-skill metadata surfaced to hosts that want to render a /skills view.

type Option

type Option func(*loadOptions)

Option configures a Load / LoadAll call. All options are optional; the zero-options call matches the pre-#322 loader behavior exactly.

func WithHomeAgentsSkillsDir

func WithHomeAgentsSkillsDir(dir string) Option

WithHomeAgentsSkillsDir supplies an extra user-scope skills root — typically $HOME/.agents/ (LoadAll appends the "skills" suffix itself, same as it does for the positional args). This source layers between the project-scoped source and the ~/.core-agent/ fallback, so precedence is project > home-agents > core-home. Empty is legal and equals "no home-agents source."

func WithInterpolator

func WithInterpolator(fn func(string) string) Option

WithInterpolator supplies a string transform applied to every .md file loaded from a skill directory — SKILL.md and referenced files under references/. Used to substitute ${env:VAR} references declared in .agents/env.yaml (see pkg/agentenv). Passing nil is legal and equals "no interpolation."

type Skills

type Skills struct {
	Toolset adktool.Toolset
	Infos   []Info
}

Skills bundles the discovered skills' toolset (for agent.WithToolsets) alongside the metadata list.

func Load

func Load(ctx context.Context, agentsDir string, gate *permissions.Gate, opts ...Option) (Skills, error)

Load discovers skills under agentsDir/skills/ only. A missing directory (or empty agentsDir) yields a zero Skills with no error.

Deprecated since v2.1: use LoadAll to also pick up user-global skills from userCoreHome/skills/. Load remains as a one-source wrapper around LoadAll for callers that explicitly don't want the global path.

gate (optional) wraps the resulting toolset so skill invocations go through the permission system. Pass nil to skip gating.

func LoadAll

func LoadAll(ctx context.Context, projectAgentsDir, userCoreHome string, gate *permissions.Gate, opts ...Option) (Skills, error)

LoadAll discovers skills from up to three sources and merges them into a single toolset:

  1. projectAgentsDir/skills/ — project-scoped skills, checked in to the repo (or wherever .agents/ lives). Takes precedence on name collision.
  2. WithHomeAgentsSkillsDir/skills/ — portable user-scope skills (typically $HOME/.agents/skills/), layered under project scope but above the ~/.core-agent/ fallback. Off unless the option is passed. See the note at WithHomeAgentsSkillsDir.
  3. userCoreHome/skills/ — user-global skills (typically ~/.core-agent/skills/). Bottom layer.

Any path may be "" to skip that source. Missing directories (vs missing parent) are silently treated as empty — most operators won't have any populated.

Sources are merged via nested overlayFS so the underlying skilltoolset sees a single virtual root; higher-precedence entries win on name collision. Every source shares the same sanitizingFS wrapper so extended-frontmatter properties get filtered the same way.

gate (optional) wraps the resulting toolset so skill invocations go through the permission system. Pass nil to skip gating.

func (Skills) Empty

func (s Skills) Empty() bool

Empty reports whether no skills were discovered.

Jump to

Keyboard shortcuts

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