Documentation
¶
Index ¶
- Variables
- func BuildSkillPrompt(ctx context.Context) string
- func FormatSkillMD(skill *Skill) (string, error)
- func LoadSkills(dir string) (skills map[string]Skill)
- func ParseSkill(path string, skill *Skill) error
- func Query(q string) (string, error)
- func SetAutoInject(name string, autoInject bool, global bool) error
- func SkillFiles(dir string) (skillFiles []string)
- func Use(name string) (content string, err error)
- type Resource
- type Skill
- type SkillInfo
- type Store
- func (store *Store) List() []string
- func (store *Store) Load() (err error)
- func (store *Store) Query(query string) (matched map[string]Skill)
- func (store *Store) Save() error
- func (store *Store) SetAutoInject(name string, autoInject bool) error
- func (store *Store) Use(name string) (content string, err error)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func BuildSkillPrompt ¶
BuildSkillPrompt builds a system prompt string from all available skills.
It loads from local (.dscli/skills) and global (~/.dscli/skills) stores, merging with local priority. Two injection strategies:
- auto_inject skills: full content injected directly, no LLM fetch needed
- manual skills: name/description list only, LLM fetches via skill_by_name
Use skill_search tool for keyword-based discovery of manual skills. Store loading errors are gracefully degraded to empty stores so that skill failures never block conversation.
func FormatSkillMD ¶ added in v0.7.5
FormatSkillMD 生成带 frontmatter 的 SKILL.md 内容,用于 skill_create 工具。 只序列化 frontmatter 必要字段(name, description, keywords, auto_inject), 正文部分直接拼接。
func ParseSkill ¶
ParseSkill 解析指定路径的 SKILL.md 文件,填充 skill 对象。 path 必须是 SKILL.md 文件的完整路径。
func SetAutoInject ¶
SetAutoInject 设置技能的 auto_inject 属性。 优先修改本地 store;若指定了 global 则修改全局 store。
func SkillFiles ¶
SkillFiles returns all skill files (SKILL.md) under `dir`. It walks the directory tree recursively and returns absolute paths.
Types ¶
type Resource ¶
type Skill ¶
type Skill struct {
Name string `yaml:"name,omitzero"`
Description string `yaml:"description,omitzero"`
Path string `yaml:"path,omitzero"` // 技能根目录
Content string `yaml:"content,omitzero"` // SKILL.md 正文
Keywords []string `yaml:"keywords,omitzero"`
Scripts []Resource `yaml:"scripts,omitzero"`
References []Resource `yaml:"references,omitzero"`
Templates []Resource `yaml:"templates,omitzero"`
Examples []Resource `yaml:"examples,omitzero"` // 示例文件
AutoInject bool `yaml:"auto_inject,omitzero"` // 自动注入到对话上下文,无需 LLM 主动获取
Source string `yaml:"-"` // "local" 或 "global",由加载侧注入
}
func (*Skill) FormatFull ¶
FormatFull 格式化技能的完整信息,供 LLM 使用。 包含:摘要、正文、资源列表(仅路径和描述,不含内容,LLM 按需读取)。
type SkillInfo ¶
type SkillInfo struct {
Name string `json:"name"`
Scope string `json:"scope"` // "local" 或 "global"
AutoInject bool `json:"auto_inject"` // 是否自动注入到对话上下文
}
SkillInfo 包含技能的基本信息和作用域
Source Files
¶
- skill.go
- store.go