skill

package
v1.129.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package skill defines the shared types used by every source of glab agent skills (bundled, remote, etc.). It intentionally has no dependencies on the source packages — those import this one.

Index

Constants

View Source
const FileName = "SKILL.md"

FileName is the canonical filename for a skill, per the Agent Skills specification (https://agentskills.io).

Variables

This section is empty.

Functions

func ContentHash added in v1.102.0

func ContentHash(files map[string][]byte) string

ContentHash returns a stable sha256 over a file tree. Empty input returns "" so "nothing on disk yet" callsites don't need a special case.

Types

type Frontmatter added in v1.123.0

type Frontmatter struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description"`
}

Frontmatter holds the SKILL.md frontmatter keys glab reads.

func ParseFrontmatter added in v1.123.0

func ParseFrontmatter(content []byte) (Frontmatter, error)

ParseFrontmatter decodes the frontmatter of a SKILL.md.

type FrontmatterParts added in v1.123.0

type FrontmatterParts struct {
	// Head is any leading whitespace plus the opening `---` line.
	Head []byte
	// Block is the YAML between the delimiters, without the final line break.
	Block []byte
	// Tail starts at the line break before the closing `---` and runs to EOF.
	Tail []byte
}

FrontmatterParts is a SKILL.md split around its YAML frontmatter so a caller can edit Block and reassemble the file byte-for-byte otherwise.

func SplitFrontmatter added in v1.123.0

func SplitFrontmatter(content []byte) (FrontmatterParts, error)

SplitFrontmatter splits content at the first pair of `---` delimiters. LF and CRLF line endings are both preserved in Head and Tail.

func (FrontmatterParts) Join added in v1.123.0

func (p FrontmatterParts) Join() []byte

Join reassembles the file from its parts.

type Skill

type Skill struct {
	Name        string
	Description string
	Source      Source
	Files       map[string][]byte
}

Skill is a single agent skill. Files maps each path inside the skill directory (relative to the skill root, e.g. "SKILL.md" or "scripts/extract.py") to its contents. Discovery-only operations (such as `glab skills list`) may return Skill values with Files unpopulated; full skill content is only guaranteed after a Get-style lookup.

func (Skill) SkillFile

func (s Skill) SkillFile() []byte

SkillFile returns the contents of the canonical SKILL.md for this skill, or nil if Files is unpopulated. It is shorthand for s.Files[FileName].

type Source

type Source string

Source identifies where a Skill was loaded from.

const (
	SourceBundled Source = "bundled"
	SourceRemote  Source = "remote"
)

Jump to

Keyboard shortcuts

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