metadata

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package metadata models and parses SKILL.md YAML frontmatter, including the declared requires block.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidFrontmatter = errors.New("invalid frontmatter")

ErrInvalidFrontmatter is returned for malformed or schema-invalid SKILL.md frontmatter.

Functions

This section is empty.

Types

type Document

type Document struct {
	Frontmatter Frontmatter
	Body        []byte
	Warnings    []string
}

Document is the result of parsing a SKILL.md: its frontmatter, the markdown body, and any non-fatal warnings.

func Parse

func Parse(content []byte) (Document, error)

Parse extracts and validates the frontmatter from SKILL.md content, returning the document with its markdown body and any unknown-key warnings. A missing name is rejected.

func ParseLenient added in v0.1.0

func ParseLenient(content []byte) (Document, error)

ParseLenient is like Parse but accepts a missing name (the skill folder supplies identity during discovery, FR-007); a present name must still be kebab-case and the description is still required. It is the parser used by the recursive scanner so a name-less SKILL.md is discoverable rather than fatal.

type Frontmatter

type Frontmatter struct {
	Name          string   `json:"name"`
	Description   string   `json:"description"`
	Version       string   `json:"version,omitempty"`
	License       string   `json:"license,omitempty"`
	Compatibility any      `json:"compatibility,omitempty"`
	Requires      Requires `json:"requires,omitempty"`
}

Frontmatter is the parsed SKILL.md YAML frontmatter (FR-012).

func (Frontmatter) Validate

func (f Frontmatter) Validate() error

Validate checks the required-field and naming rules (FR-012, FR-013).

func (Frontmatter) ValidateLenient added in v0.1.0

func (f Frontmatter) ValidateLenient() error

ValidateLenient is like Validate but treats a missing name as acceptable: a discovered skill takes its identity from its folder, so the frontmatter name is optional. A name that *is* present must still be lowercase kebab-case, and the description remains required.

type Requires

type Requires struct {
	Skills      []string `json:"skills,omitempty"`
	Commands    []string `json:"commands,omitempty"`
	Environment []string `json:"environment,omitempty"`
	MCP         []string `json:"mcp,omitempty"`
}

Requires holds declared needs that are recorded and surfaced, never resolved transitively (FR-032).

Jump to

Keyboard shortcuts

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