Documentation
¶
Index ¶
- func NewLoadSkillTool(loader *Loader) tool.InvokableTool
- type Loader
- func (l *Loader) All() []*Skill
- func (l *Loader) Descriptions() string
- func (l *Loader) Get(name string) *Skill
- func (l *Loader) GetBySlash(slash string) *Skill
- func (l *Loader) GetContent(name string) string
- func (l *Loader) Rescan(projectDir string)
- func (l *Loader) ScanAgentsSkills()
- func (l *Loader) ScanProjectSkills(projectDir string)
- func (l *Loader) ScanUserSkills()
- func (l *Loader) SlashCommands() []*Skill
- type Skill
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLoadSkillTool ¶
func NewLoadSkillTool(loader *Loader) tool.InvokableTool
NewLoadSkillTool creates the "load_skill" tool that loads a skill's full content on demand (Layer 2 injection via tool_result).
Types ¶
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader discovers and caches skills from built-in embeds and user directories.
func NewLoader ¶
func NewLoader() *Loader
NewLoader creates a Loader pre-populated with built-in skills, then scans the user skills directories (~/.agents/skills/ and ~/.jcode/skills/) for additional skills.
func (*Loader) Descriptions ¶
Descriptions returns a compact multi-line string listing all skills. This is injected into the system prompt (Layer 1 — low token cost).
func (*Loader) GetBySlash ¶
GetBySlash returns a skill by its slash command, or nil if not found.
func (*Loader) GetContent ¶
GetContent returns the full skill body wrapped in XML-like tags for injection into tool_result (Layer 2 — on-demand, full content).
func (*Loader) ScanAgentsSkills ¶
func (l *Loader) ScanAgentsSkills()
ScanAgentsSkills scans ~/.agents/skills/ for agent-defined skills. Each subdirectory (or symlink to a directory) containing a SKILL.md is treated as a skill. Agent skills are loaded before user skills, so user skills can override them.
func (*Loader) ScanProjectSkills ¶
ScanProjectSkills scans <projectDir>/.jcode/skills/ for project-local skills.
func (*Loader) ScanUserSkills ¶
func (l *Loader) ScanUserSkills()
ScanUserSkills scans ~/.jcode/skills/ for user-defined skills. Each subdirectory (or symlink to a directory) containing a SKILL.md is treated as a skill. User skills override built-in skills with the same name.
func (*Loader) SlashCommands ¶
SlashCommands returns all skills that have a slash command trigger.
type Skill ¶
type Skill struct {
Name string // directory name or frontmatter name
Description string // short description for system prompt (Layer 1)
Slash string // optional slash command trigger (e.g. "/review-pr")
Body string // full markdown content (Layer 2, on-demand)
Builtin bool // true if embedded in binary
Path string // filesystem path (empty for built-in)
}
Skill represents a loaded skill with metadata and content.