Documentation
¶
Overview ¶
Package skills loads SKILL.md directories (Agent Skills standard). It never executes scripts/ and only reads references/ and assets/.
Index ¶
- Constants
- func IconNames() []string
- func IconOrDefault(icon string) string
- func Label(name, displayName string) string
- func NormalizeDisplayName(name string) string
- func ValidIcon(icon string) bool
- func ValidName(name string) bool
- type Skill
- func Builtins() []Skill
- func Load(root fs.FS, builtin bool) (ok []Skill, failed map[string]error)
- func LoadDir(dir string) (ok []Skill, failed map[string]error, err error)
- func LoadLinkedDir(dir string) (ok []Skill, failed map[string]error, err error)
- func Parse(name string, fsys fs.FS) (Skill, []string, error)
- func ParseContent(name string, raw []byte) (Skill, error)
Constants ¶
const MaxFileBytes = 256 << 10
MaxFileBytes is the largest file ReadFile returns.
Variables ¶
This section is empty.
Functions ¶
func IconOrDefault ¶ added in v1.34.0
IconOrDefault keeps hand-written skills usable when an icon is unknown.
func NormalizeDisplayName ¶ added in v1.34.0
NormalizeDisplayName 让手写文件、创建审批和各界面使用同一个单行展示值。
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 Load ¶
Load parses every directory of root as a skill. Directories that fail are returned in failed, keyed by name.
func LoadDir ¶
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
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 ¶
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
ParseContent 在保存前按加载时的同一规则校验 SKILL.md。
func (Skill) ReadFile ¶
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 ¶
References lists the regular files under references/, as paths ReadFile takes. Symlinks are left out (ReadFile refuses them).