skill

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(cfg *types.Config, baseDir string) error

Apply merges every enabled pack's skills into cfg. Precedence is packs < user: a user skill of the same name wins; a pack-vs-pack clash is last-wins with a warning. Call this BEFORE plugin.Apply so packs also win over plugin skills (plugin.Apply skips names already present in cfg.Skills).

func HarvestPack

func HarvestPack(root string) ([]types.Skill, error)

HarvestPack walks a skill-pack root and returns every contributed skill. Discovery is recursive: any subdirectory containing a SKILL.md is a skill, its Name taken from the file's frontmatter (falling back to the directory name) and its Dir set to that directory so the load_skill tool can resolve bundled scripts and references. Once a directory is recognized as a skill its subtree is pruned — a skill's own references/examples cannot define further skills.

Precedence when the root itself holds a SKILL.md: subdirectory skills win. If the recursive walk finds ≥1 skill, those are returned and a root SKILL.md is treated as a pack overview and ignored — so a multi-skill pack that ships an overview SKILL.md at its root still contributes its real subdirectory skills. Only when the walk yields ZERO skills AND a root SKILL.md exists is the root itself the single skill (Name from its frontmatter, falling back to filepath.Base(root), Dir=root) — this supports a bare fetched SKILL.md / the agentskills.io single-file form installed via InstallDir.

Dotted directories (e.g. .git) and nested symlinks are skipped. A missing or unreadable directory yields no skills and no error.

func LoadRegistry

func LoadRegistry(baseDir string) (*registry.Registry[Entry], error)

LoadRegistry reads <baseDir>/skills.yaml, returning an empty registry if the file does not exist yet.

func SkillsDir

func SkillsDir(baseDir string) string

SkillsDir is where installed skill-pack checkouts live, parallel to plugins.

Types

type Entry

type Entry = registry.Entry

Entry is one installed skill pack's registry record.

type Manager

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

Manager performs skill-pack install/update/remove against a base directory.

func NewManager

func NewManager(baseDir string) *Manager

NewManager returns a Manager rooted at baseDir (use plugin.BaseDir() in prod).

func (*Manager) Install

func (mgr *Manager) Install(src, ref string, link bool) (string, []types.Skill, error)

Install clones/copies a skill pack, verifies it contributes at least one skill, places it at skills/<name>, and records it in the registry as DISABLED. It returns the derived pack name and the harvested skills (with Dir set to their final on-disk location).

func (*Manager) InstallDir added in v0.4.0

func (mgr *Manager) InstallDir(dir, name, sourceURL string) (string, []types.Skill, error)

InstallDir installs an already-prepared local skill directory (e.g. an unzipped archive or a fetched SKILL.md) as pack <name>, DISABLED. Unlike Install it does no git/link handling: dir is copied verbatim. sourceURL is recorded as the pack's registry provenance (the original .zip path or SKILL.md URL) — not dir, which is a throwaway extraction temp dir.

func (*Manager) LinkTarget added in v0.2.3

func (mgr *Manager) LinkTarget(name string) (string, bool)

LinkTarget reports whether an installed pack is a symlink (a --link install) and, if so, the path it points at.

func (*Manager) List

func (mgr *Manager) List() ([]Entry, error)

List returns all installed skill packs from the registry.

func (*Manager) Remove

func (mgr *Manager) Remove(name string) error

Remove deletes an installed pack's files and registry record.

func (*Manager) SetEnabled

func (mgr *Manager) SetEnabled(name string, enabled bool) error

SetEnabled flips a pack's enabled flag in the registry.

func (*Manager) Skills

func (mgr *Manager) Skills(name string) ([]types.Skill, error)

Skills harvests the skills contributed by an installed pack (for `list`).

func (*Manager) Update

func (mgr *Manager) Update(name string) error

Update fast-forwards an installed pack's git checkout. Packs installed from a local path have no .git and cannot be updated this way.

Jump to

Keyboard shortcuts

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