skills

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package skills contains the filesystem and validation logic for the folder-shaped Agent Skills format (agentskills.io): SKILL.md frontmatter validation, bundled-file discovery, and safe path handling for downloads.

Index

Constants

View Source
const (
	// MaxSkillMDBytes is the backend limit for the literal SKILL.md payload.
	MaxSkillMDBytes = 1 << 20 // 1 MB
	// MaxFileBytes is the backend per-file limit for bundled resources.
	MaxFileBytes = 100 << 20 // 100 MB
)

Variables

This section is empty.

Functions

func ReadSkillMD

func ReadSkillMD(folder string) ([]byte, error)

ReadSkillMD reads the literal SKILL.md bytes from a skill folder root, returning friendly errors for the common failure modes.

func SafeJoin

func SafeJoin(dir, relPath string) (string, error)

SafeJoin joins a server-supplied manifest path onto a local destination directory, refusing absolute paths, backslashes, and any path that would escape dir.

func ValidateName

func ValidateName(name string) error

ValidateName checks the SKILL.md frontmatter `name` field against the backend rule and returns a friendly error when it does not conform.

Types

type File

type File struct {
	// Path is the manifest path: relative to the skill folder root, with
	// forward slashes.
	Path string
	// AbsPath is the on-disk location of the file.
	AbsPath string
	// Size is the file size in bytes.
	Size int64
}

File is one bundled asset discovered inside a skill folder.

func Walk

func Walk(root string) ([]File, error)

Walk discovers the bundled files of a skill folder. It skips the root SKILL.md (uploaded separately as the skill body), dotfiles, and dot directories (.git, .DS_Store, …), and returns entries sorted by path.

type Frontmatter

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

Frontmatter holds the SKILL.md fields the CLI surfaces. Parsing never rewrites the markdown — the literal bytes are uploaded as-is.

func ParseFrontmatter

func ParseFrontmatter(md []byte) (*Frontmatter, error)

ParseFrontmatter extracts the YAML frontmatter block from raw SKILL.md bytes. The file must start with a `---` line closed by another `---` line.

Jump to

Keyboard shortcuts

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