Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateToolDefinitions ¶
func GenerateToolDefinitions(skill *SkillPackage) (tools []types.Tool, scriptMap map[string]string)
GenerateToolDefinitions generates the list of OpenAI tools for a given skill. It returns the tool definitions and a map of tool names to script paths for execution. 优先使用 SKILL.md 中定义的工具,如果未定义则自动生成。
func SkillsToPrompt ¶
func SkillsToPrompt(skills map[string]*SkillPackage, tools []types.Tool) string
SkillsToPrompt converts a slice of SkillPackage objects to a prompt string
Types ¶
type SkillMeta ¶
type SkillMeta struct {
Name string `json:"name"`
Description string `json:"description"`
AllowedTools []string `json:"allowed-tools"`
Model string `json:"model,omitempty"`
Author string `json:"author,omitempty"`
Version string `json:"version,omitempty"`
License string `json:"license,omitempty"`
Tools []ToolDefinition `json:"tools,omitempty"` // 工具定义列表
}
SkillMeta corresponds to the content of SKILL.md frontmatter
type SkillPackage ¶
type SkillPackage struct {
Path string `json:"path"`
Meta SkillMeta `json:"meta"`
Body string `json:"body"` // Raw Markdown content of SKILL.md body
Resources SkillResources `json:"resources"`
BaseTools []types.Tool `json:"-"`
}
SkillPackage represents a fully and finely parsed Claude Skill package
func ParseSkillPackage ¶
func ParseSkillPackage(root fs.FS, dirPath string) (*SkillPackage, error)
ParseSkillPackage finely parses the Skill package in the given directory path
func ParseSkillPackages ¶
func ParseSkillPackages(root fs.FS) (skills []*SkillPackage, e error)
type SkillResources ¶
type SkillResources struct {
Scripts []string `json:"scripts"`
References []string `json:"references"`
Assets []string `json:"assets"`
Templates []string `json:"templates"`
}
SkillResources lists the relevant resource files in the skill package
type ToolDefinition ¶
type ToolDefinition struct {
Name string `json:"name"`
Script string `json:"script,omitempty"` // 可选,指定脚本路径
Description string `json:"description,omitempty"`
Parameters map[string]ToolParameter `json:"parameters,omitempty"`
}
ToolDefinition 定义单个工具的配置
func GetToolDefinitions ¶
func GetToolDefinitions(skill *SkillPackage) []ToolDefinition
GetToolDefinitions 返回 skill 中定义的工具列表(用于外部访问)
type ToolParameter ¶
type ToolParameter struct {
Type string `json:"type"`
Description string `json:"description,omitempty"`
Required bool `json:"required,omitempty"`
}
ToolParameter 定义工具参数
Click to show internal directories.
Click to hide internal directories.