skill

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SkillFileName is the standard skill file name (Claude Code format)
	SkillFileName = "SKILL.md"
	// LegacySkillFileName is the legacy JSON format
	LegacySkillFileName = "skill.json"
)

Variables

This section is empty.

Functions

func SkillsDir

func SkillsDir() (string, error)

SkillsDir returns the global skills directory path

Types

type Command

type Command struct {
	Name        string `yaml:"name" json:"name"`
	Description string `yaml:"description,omitempty" json:"description,omitempty"`

	// Content is the markdown prompt content (after frontmatter)
	Content string `yaml:"-" json:"-"`

	// FileName is the source file name (e.g., "review.md")
	FileName string `yaml:"-" json:"-"`
}

Command represents a single command within a skill Each command is a .md file with YAML frontmatter

func (*Command) ToMarkdown

func (c *Command) ToMarkdown() string

ToMarkdown converts a command to markdown format with YAML frontmatter

type Skill

type Skill struct {
	Name        string `yaml:"name" json:"name"`
	Description string `yaml:"description,omitempty" json:"description,omitempty"`

	// Content is the markdown prompt content (after frontmatter) for the default command
	Content string `yaml:"-" json:"-"`

	// Commands are additional subcommands defined in separate .md files
	// Invoked as skill-name:command-name
	Commands []*Command `yaml:"-" json:"-"`

	// Path is the directory containing this skill
	Path string `yaml:"-" json:"-"`

	// Scope indicates where this skill came from ("local" or "global")
	Scope string `yaml:"-" json:"-"`

	// Legacy fields (for backwards compatibility with skill.json)
	Version string            `yaml:"version,omitempty" json:"version,omitempty"`
	Author  string            `yaml:"author,omitempty" json:"author,omitempty"`
	Prompts map[string]string `yaml:"prompts,omitempty" json:"prompts,omitempty"`
	Files   []string          `yaml:"files,omitempty" json:"files,omitempty"`
}

Skill represents a skill/plugin configuration Skills use SKILL.md format with YAML frontmatter (matching Claude Code) A skill can have multiple commands (subcommands) via additional .md files

func GlobalSkills

func GlobalSkills() ([]*Skill, error)

GlobalSkills loads all skills from the global skills directory

func Load

func Load(dir string) (*Skill, error)

Load loads a skill from a directory It first tries SKILL.md (Claude Code format), then falls back to skill.json It also loads any additional .md files as subcommands

func LoadAll

func LoadAll(dir string) ([]*Skill, error)

LoadAll loads all skills from a directory

func ProjectSkills

func ProjectSkills(projectDir string) ([]*Skill, error)

ProjectSkills loads all skills from a project's .claude/skills directory

func (*Skill) AddCommand

func (s *Skill) AddCommand(cmd *Command) error

AddCommand adds a new command to the skill

func (*Skill) CommandNames

func (s *Skill) CommandNames() []string

CommandNames returns the names of all commands in the skill

func (*Skill) GetCommand

func (s *Skill) GetCommand(name string) *Command

GetCommand returns a command by name, or nil if not found

func (*Skill) HasCommands

func (s *Skill) HasCommands() bool

HasCommands returns true if the skill has any subcommands

func (*Skill) RemoveCommand

func (s *Skill) RemoveCommand(name string) error

RemoveCommand removes a command from the skill

func (*Skill) Save

func (s *Skill) Save(dir string) error

Save saves a skill to a directory in SKILL.md format

func (*Skill) SaveCommand

func (s *Skill) SaveCommand(cmd *Command) error

SaveCommand saves a single command to the skill directory

func (*Skill) ToMarkdown

func (s *Skill) ToMarkdown() string

ToMarkdown converts the skill to SKILL.md format

func (*Skill) Validate

func (s *Skill) Validate() error

Validate checks if the skill has required fields

Jump to

Keyboard shortcuts

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