skills

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package skills provides parsing and access to SKILL.md-based skill directories via fs.FS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetResource

func GetResource(fsys fs.FS, name string, path string) ([]byte, error)

GetResource reads a file from the named skill's directory at the given relative path.

func ListResources

func ListResources(fsys fs.FS, name string) ([]string, error)

ListResources returns the relative paths of all files under the named skill directory, excluding SKILL.md itself.

Types

type SearchMode

type SearchMode int

SearchMode determines how multiple search terms are combined.

const (
	SearchAND SearchMode = iota // all terms must match
	SearchOR                    // at least one term must match
)

type Skill

type Skill struct {
	Meta SkillMeta `json:"meta"`
	Body string    `json:"body"`
}

Skill holds a fully parsed skill: metadata + body.

func GetSkill

func GetSkill(fsys fs.FS, name string) (*Skill, error)

GetSkill reads and parses the SKILL.md from the named skill directory, returning the full metadata and body.

type SkillMeta

type SkillMeta struct {
	Name        string `yaml:"name" json:"name"`
	Description string `yaml:"description" json:"description"`
	Version     string `yaml:"version,omitempty" json:"version,omitempty"`
	Dir         string `yaml:"-" json:"dir"` // directory name within the fs.FS
}

SkillMeta holds the frontmatter metadata of a SKILL.md file.

func ListSkills

func ListSkills(fsys fs.FS) ([]SkillMeta, error)

ListSkills scans the root of fsys for subdirectories containing SKILL.md, parses their frontmatter, and returns the metadata.

func SearchSkills

func SearchSkills(fsys fs.FS, query string, mode SearchMode) ([]SkillMeta, error)

SearchSkills searches for skills matching query terms against name, description, and body. Multiple terms (space-separated) are combined using the given SearchMode (AND or OR). An empty query returns all skills.

Jump to

Keyboard shortcuts

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