skill

package
v0.7.45 Latest Latest
Warning

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

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

Documentation

Overview

Package skill reads Agent Skills folders: a SKILL.md whose frontmatter names the skill and says when to use it, and the files it uses. A persistent agent's skills are such folders, the built-in ones from the binary and the person's own from a folder or a zip on their computer. Every folder is held to the same bounds before anything reads it: regular files and folders only, no link, no name that climbs out, at most MaxFiles files and MaxBytes bytes.

Index

Constants

View Source
const (
	MaxFiles       = 500
	MaxBytes       = 32 << 20
	MaxNameBytes   = 64
	MaxDescription = 1024
)

The bounds of a skill folder, and of the format's name and description.

View Source
const File = "SKILL.md"

File is the skill's instruction file at its folder's root.

Variables

This section is empty.

Functions

func CopyTo

func CopyTo(fsys fs.FS, dst string) error

CopyTo copies the skill folder fsys into dst, which must not exist: its files 0644, or 0755 when the source gives an executable bit, its folders 0755. fsys is held to the bounds first.

func DescriptionValid

func DescriptionValid(d string) error

DescriptionValid says d is a skill's description: text a System Prompt quotes, so no control or formatting character.

func Digest

func Digest(dir string) (string, error)

Digest is a digest of the skill folder at dir: each file's path and bytes, in order, so two folders with the same files have the same one.

func NameValid

func NameValid(n string) bool

NameValid says n is a skill's name: also its folder's, so it never climbs out of the folder that holds the skills.

Types

type Meta

type Meta struct {
	Name        string
	Description string
}

Meta is what a SKILL.md's frontmatter says of its skill.

func Load

func Load(fsys fs.FS) (Meta, error)

Load holds the skill folder fsys to the bounds and reads its meta.

func Parse

func Parse(b []byte) (Meta, error)

Parse reads a SKILL.md's frontmatter: a YAML block between two lines of "---" at its start, with a name and a description. Other fields the format or a harness defines are left as they are.

func Stage

func Stage(src, work string) (string, Meta, error)

Stage takes the skill at src, a folder or a .zip on this computer, into a new folder under work, held to the bounds, and returns that folder and the skill's meta. A folder is read without following a link anywhere in it; a zip's entries are taken as files and folders only, beneath its root or its one top folder. The skill's folder is named by its SKILL.md, and a folder or top folder of another name is refused.

Jump to

Keyboard shortcuts

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