Documentation
¶
Overview ¶
Package skills loads SKILL.md files: YAML frontmatter (name, description, optional allowed-tools) followed by Markdown instructions.
Index ¶
- type Registry
- func (r *Registry) Get(name string) (Skill, bool)
- func (r *Registry) Len() int
- func (r *Registry) List() []Skill
- func (r *Registry) Register(s Skill) bool
- func (r *Registry) Search(query string, limit int) []Skill
- func (r *Registry) Shadowed() []ShadowedSkill
- func (r *Registry) Skipped() []SkippedSkill
- type Root
- type ShadowedSkill
- type Skill
- type SkippedSkill
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds the skills found at startup. The first registration of a name wins, so roots are loaded in priority order.
func LoadRoots ¶
LoadRoots scans each root (in priority order) for SKILL.md files and registers them; a later root never replaces an earlier skill of the same name. Missing roots are skipped; an invalid SKILL.md is logged and skipped.
func (*Registry) Register ¶
Register adds s unless a skill with the same name (case-insensitive) is already registered; it reports whether s was added.
func (*Registry) Search ¶
Search ranks skills against query: each query word found in the name scores 3, in the description 1 (substring match, case-insensitive). CJK runs are also split into overlapping two-character words so "前端页面设计" finds a description saying "前端设计". Skills scoring 0 are dropped; ties keep name order. At most limit skills are returned.
func (*Registry) Shadowed ¶
func (r *Registry) Shadowed() []ShadowedSkill
Shadowed reports the same-name skills dropped in favour of an earlier root.
func (*Registry) Skipped ¶
func (r *Registry) Skipped() []SkippedSkill
Skipped reports the SKILL.md files that could not be registered.
type Root ¶
type Root struct {
Dir string
// Workspace marks a root inside the workspace (project skills).
Workspace bool
}
Root is one directory scanned for skills.
type ShadowedSkill ¶
ShadowedSkill is a skill whose name was already registered by an earlier root: Winner is the SKILL.md that stays in effect, Loser the dropped one.
type Skill ¶
type Skill struct {
Name string
Description string
// AllowedTools is informational only (shown, never enforced).
AllowedTools []string
// AlwaysLoad (frontmatter metadata.always_load or always_load) asks for
// the body to be put in the system prompt instead of loaded on demand.
AlwaysLoad bool
// Workspace marks a skill found under the workspace (vs the user's home).
Workspace bool
// Path is the SKILL.md file; Dir its directory (other skill files live there).
Path string
Dir string
}
Skill is one parsed SKILL.md.
type SkippedSkill ¶
SkippedSkill is a SKILL.md that was found but not registered, with the reason (a parse or validation error).