Help us shape the future of Go! Take the 2026 Go Developer Survey

skill

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package skill 解析通用 Agent Skills 格式(SKILL.md),按目录优先级生成去重、排序的 skill 目录, 显式引用时由 Session 读取正文;模型也可按 Path 用通用工具读取。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNameValid

func IsNameValid(name string) bool

IsNameValid Skill 引用名称是否合法?

Types

type Skill

type Skill struct {
	Name        string
	Description string
	// Path 是 SKILL.md 在所在 Executor 文件系统中的绝对路径;记录扫描时的路径,不解析符号链接。
	// 例如本机 skill 为 /home/me/.claude/skills/pdf/SKILL.md,openvaala 内置 skill 为 /skills/openvaala/SKILL.md。
	Path string
	// Executor 是 SKILL.md 所在的 Executor,例如内置 skill 为 "openvaala"。
	Executor string
	// contains filtered or unexported fields
}

Skill 是可供 Agent 选用的目录项,保存来源工作区供接受 slash 引用时读取正文。

func GetSkillsByNames

func GetSkillsByNames(names []string, catalog []*Skill) []*Skill

GetSkillsByNames 按目录顺序选择指定名称的 Skill。

func LoadSkills

func LoadSkills(ctx context.Context, directories []SkillDirectory) ([]*Skill, error)

LoadSkills 扫描并加载 Skill 目录。

func (*Skill) GetContent

func (s *Skill) GetContent(ctx context.Context) (string, error)

GetContent 从来源工作区读取 Skill 文件当前的完整内容。

type SkillDirectory

type SkillDirectory struct {
	Workspace  workspace.Workspace
	ExecutorID string
	Path       string
	Strict     bool
	// NamePrefix 加在目录里每个 skill 名前面:插件目录为 "<插件名>:",其他目录为空。
	NamePrefix string
}

SkillDirectory 指向递归包含多个技能的目录,或直接包含 SKILL.md 的单个技能目录,经 Workspace 读取。 ExecutorID 是目录所在的 Executor,写入这个目录里每个 Skill 的 Executor;Strict 为 true 时目录读不了或 skill 格式错误会让加载失败,否则跳过。

type SkillInfo

type SkillInfo struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Path        string `json:"path"`
	Executor    string `json:"executor"`
}

SkillInfo 是补全列表的显示信息,不含正文和文件读取依赖。

Jump to

Keyboard shortcuts

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