Documentation
¶
Overview ¶
Package skill 将技能指令按需注入 system prompt。 Keywords 匹配到用户输入(或未配置 Keywords)的 skill 才会被注入,节省 token。 技能源支持代码内定义(New)与文件系统目录加载(NewFromFS)。
文件布局遵循标准 skill 规范:dir/<skill>/SKILL.md 是唯一必需文件, frontmatter 提供元数据(name/description,缺省回落目录名与正文首行), frontmatter 之后的正文是指令。scripts/、references/、assets/ 等子资源 由正文相对路径引用(模型用文件工具按需读取),加载器不感知。
Index ¶
Constants ¶
View Source
const SkillFile = "SKILL.md"
SkillFile 是技能的指令文件名。
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Hook ¶
type Hook struct {
// contains filtered or unexported fields
}
type Skill ¶
type Skill struct {
Name string
Description string
// Instructions 是注入给模型的完整指令内容(已剥离 frontmatter)。
Instructions string
// Keywords 命中用户输入则注入;为空表示总是注入(仅代码内定义用,
// 文件加载不提供)。
Keywords []string
// Path 是 SKILL.md 的 FS 相对路径(宿主提示"全文见此"用)。
Path string
}
func ParseSkill ¶ added in v1.3.11
ParseSkill 从 SKILL.md 内容解析技能,供宿主内嵌技能加载(go:embed 等 非 FileSystem 来源)。dir 是技能目录名(name 缺省回落与 Path 用)。
Click to show internal directories.
Click to hide internal directories.