skills

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

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) All

func (l *Loader) All() []*Skill

All returns all loaded skills sorted by name.

func (*Loader) Descriptions

func (l *Loader) Descriptions() string

Descriptions returns a compact multi-line string listing all skills. This is injected into the system prompt (Layer 1 — low token cost).

func (*Loader) Get

func (l *Loader) Get(name string) *Skill

Get returns a skill by name, or nil if not found.

func (*Loader) GetBySlash

func (l *Loader) GetBySlash(slash string) *Skill

GetBySlash returns a skill by its slash command, or nil if not found.

func (*Loader) GetContent

func (l *Loader) GetContent(name string) string

GetContent returns the full skill body wrapped in XML-like tags for injection into tool_result (Layer 2 — on-demand, full content).

func (*Loader) Rescan

func (l *Loader) Rescan(projectDir string)

Rescan re-scans all skill sources (preserving built-ins).

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

func (l *Loader) ScanProjectSkills(projectDir string)

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

func (l *Loader) SlashCommands() []*Skill

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL