skills

package
v1.41.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 15 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package skills loads SKILL.md directories (Agent Skills standard). It never executes scripts/ and only reads references/ and assets/.

Index

Constants

View Source
const MaxFileBytes = 256 << 10

MaxFileBytes is the largest file ReadFile returns.

Variables

This section is empty.

Functions

func IconNames added in v1.34.0

func IconNames() []string

IconNames 返回 Skill 可选择的内置图标。

func IconOrDefault added in v1.34.0

func IconOrDefault(icon string) string

IconOrDefault keeps hand-written skills usable when an icon is unknown.

func Label added in v1.34.0

func Label(name, displayName string) string

Label 优先保留显式显示名称,否则把稳定标识转为首字母大写的词组。

func NormalizeDisplayName added in v1.34.0

func NormalizeDisplayName(name string) string

NormalizeDisplayName 让手写文件、创建审批和各界面使用同一个单行展示值。

func ValidIcon added in v1.34.0

func ValidIcon(icon string) bool

func ValidName

func ValidName(name string) bool

ValidName reports whether name is a valid skill (or plugin) name: lowercase letters, digits and single hyphens between them.

Types

type Skill

type Skill struct {
	Name, Description, Body string
	DisplayName, Icon       string
	On                      []string
	Output, Model           string
	Tier                    string // godwit-model-tier; only "small" is kept
	Builtin                 bool
	External                bool   // loaded with LoadLinkedDir: an agent gateway put it there
	Version                 string // first 16 hex digits of SHA-256 of SKILL.md
	FS                      fs.FS  // the skill directory (built-ins)
	// contains filtered or unexported fields
}

func Builtins

func Builtins() []Skill

Builtins returns the skills compiled into the binary.

func Load

func Load(root fs.FS, builtin bool) (ok []Skill, failed map[string]error)

Load parses every directory of root as a skill. Directories that fail are returned in failed, keyed by name.

func LoadDir

func LoadDir(dir string) (ok []Skill, failed map[string]error, err error)

LoadDir loads the user skills in dir. A missing dir means none; any other error reading it is returned. Per-skill failures go in failed.

func LoadLinkedDir added in v1.37.0

func LoadLinkedDir(dir string) (ok []Skill, failed map[string]error, err error)

LoadLinkedDir is LoadDir for a directory an agent gateway fills (ADR 0041), which may link each skill's folder from its own library: a top-level symlink to a directory is loaded from where it points. Links inside a skill stay unreadable, as in LoadDir.

func Parse

func Parse(name string, fsys fs.FS) (Skill, []string, error)

Parse reads SKILL.md from fsys, the skill directory named name. The warnings are non-fatal (a scripts/ directory, which is never run).

func ParseContent added in v1.34.0

func ParseContent(name string, raw []byte) (Skill, error)

ParseContent 在保存前按加载时的同一规则校验 SKILL.md。

func (Skill) ReadFile

func (s Skill) ReadFile(p string) ([]byte, error)

ReadFile returns a file under references/ or assets/ of the skill directory. For user skills every path component must be a real directory or file inside the skill: symlinks are refused, so links cannot reach scripts/ or other skills.

func (Skill) References

func (s Skill) References() ([]string, error)

References lists the regular files under references/, as paths ReadFile takes. Symlinks are left out (ReadFile refuses them).

Jump to

Keyboard shortcuts

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