skill

package
v0.29.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package skill loads and validates SKILL.md files (agentskills.io format). Skills live under skills/ in the KB root, one directory per skill, named exactly as the skill's frontmatter `name` (D191).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CatalogEntry

type CatalogEntry struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Version     string `json:"version,omitempty"`
	Path        string `json:"path"`
}

CatalogEntry is a compact representation for progressive disclosure (~100 tokens).

func Catalog

func Catalog(skills []Skill) []CatalogEntry

Catalog returns compact catalog entries for progressive disclosure.

type Issue

type Issue struct {
	Path    string
	Rule    string
	Message string
	Warning bool // true = warning, false = error
}

Issue represents a validation issue for a skill. Rule names the check that failed, so a caller can attribute a refusal without parsing the message.

func FirstError added in v0.12.0

func FirstError(issues []Issue) *Issue

FirstError returns the first error-severity issue in issues, or nil when they are all warnings — the shape both channels need to decide whether to refuse.

func Validate

func Validate(s *Skill) []Issue

Validate is the single authority on whether a skill is well-formed (D191). Both channels that can introduce one call it: artifact_write over MCP, and BuildManifest for a skill that arrived through git. They used to disagree, and the git side was the weaker one — a malformed artifact it accepted broke the sync of the whole KB later, far from its cause.

Errors (they break a channel or a client):

  • the frontmatter is readable at all, and is valid YAML by the strict rules a client applies (see strictFrontmatterYAML)
  • name required, matching skillNameRe, at most maxSkillNameLen
  • frontmatter name equal to the directory basename
  • description required

Warnings (they degrade quality, they break nothing):

  • body over maxSkillBodyLines
  • description over maxSkillDescriptionLen

type Skill

type Skill struct {
	Name        string // from frontmatter
	Description string // from frontmatter (keyword-rich, activation trigger)
	License     string // optional
	Version     string // semver, optional
	Body        string // markdown body (< 500 lines / < 5000 tokens guideline)
	DirPath     string // directory path relative to KB root (e.g. "skills/myns--myskill")
	ServiceRef  string // optional link to a Service concept

	// Frontmatter is the raw YAML block between the --- delimiters, and
	// FrontmatterErr is why the OKF reader could not parse it (empty when it
	// could). Both are carried so Validate can judge the frontmatter itself
	// rather than only its extracted fields: the OKF reader is lenient by
	// design and accepts blocks that no client can load, and the field values
	// it produces in that case look perfectly ordinary (D212).
	//
	// A caller that leaves them empty gets no frontmatter check, which is the
	// right default for a Skill assembled in memory rather than parsed.
	Frontmatter    string
	FrontmatterErr string
}

Skill represents a parsed SKILL.md file.

func LoadAllFromFS

func LoadAllFromFS(fsys fs.FS, root string) ([]Skill, []error)

LoadAllFromFS scans the root directory in fsys and loads all SKILL.md files. Each subdirectory of root that contains SKILL.md is treated as a skill. Returns skills and any errors encountered (non-fatal per skill).

func LoadAllSkills

func LoadAllSkills(kbRoot string) ([]Skill, []error)

LoadAllSkills scans the skills/ directory under kbRoot and loads all SKILL.md files. Returns skills and any errors encountered (non-fatal per skill). A KB with no skills/ directory has no skills, which is not an error.

func LoadSkill

func LoadSkill(dirPath string) (*Skill, error)

Jump to

Keyboard shortcuts

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