skills

package
v1.1.68 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateProjectSkillsDir

func CreateProjectSkillsDir(projectDir string) error

CreateProjectSkillsDir creates the .skills directory in the project root.

func ProjectSkillDirs

func ProjectSkillDirs(projectRoot string) []string

ProjectSkillDirs returns project-local skill directories in priority order.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages skill discovery and loading.

func NewManager

func NewManager(globalDir, projectDir string, additionalProjectDirs ...string) *Manager

NewManager creates a new skills manager.

func NewManagerWithProjectDirs

func NewManagerWithProjectDirs(globalDir string, projectDirs []string) *Manager

NewManagerWithProjectDirs creates a new skills manager with explicit project directories in priority order.

func (*Manager) BuildAllSkillsContext

func (m *Manager) BuildAllSkillsContext() string

BuildAllSkillsContext returns a summary of all available skills for the system prompt.

func (*Manager) BuildSkillContext

func (m *Manager) BuildSkillContext(name string) string

BuildSkillContext returns the content of a skill for injection into the system prompt. It includes the SKILL.md content plus all auto-loaded references.

func (*Manager) Get

func (m *Manager) Get(name string) *Skill

Get returns a skill by name.

func (*Manager) List

func (m *Manager) List() []*Skill

List returns all loaded skills sorted by name.

func (*Manager) ListBySource

func (m *Manager) ListBySource(source string) []*Skill

ListBySource returns skills filtered by source.

func (*Manager) ListReferences

func (m *Manager) ListReferences(skillName string) []*SkillReference

ListReferences returns the reference files for a skill with their load status.

func (*Manager) Load

func (m *Manager) Load() error

Load discovers and loads all skills from global and project directories. Project-local skills override global skills with the same name.

func (*Manager) LoadReference

func (m *Manager) LoadReference(skillName, refPath string) (string, bool)

LoadReference loads a specific reference file by path for a skill. Returns the content and true if successful.

func (*Manager) Names

func (m *Manager) Names() []string

Names returns a list of all skill names.

type Skill

type Skill struct {
	Name        string            // skill name (directory name)
	Path        string            // absolute path to SKILL.md
	Dir         string            // skill directory
	Description string            // first line or heading description
	Content     string            // full SKILL.md content
	Source      string            // "global" or "project"
	References  []*SkillReference // parsed references
}

Skill represents a loaded skill.

type SkillReference

type SkillReference struct {
	Path     string // relative path (e.g. "references/audio.md")
	FullPath string // absolute path
	Label    string // display label (e.g. "音频")
	AutoLoad bool   // true if marked [已加载], false if [待按需加载]
	Loaded   bool   // whether this reference has been loaded
	Content  string // loaded content
}

SkillReference represents a reference file within a skill.

Jump to

Keyboard shortcuts

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