skillformat

package
v0.18.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const SkillMainFile = "SKILL.md"

SkillMainFile is the filename for the main skill definition file in a skill directory.

Variables

This section is empty.

Functions

func DisplayName

func DisplayName(slug string) string

DisplayName converts a skill slug (e.g., "code-review") to a human-readable display name (e.g., "Code Review").

func FormatSkillMD

func FormatSkillMD(fm Frontmatter, body string) (string, error)

FormatSkillMD serializes a Frontmatter and body back into a complete SKILL.md string with YAML frontmatter delimiters.

func ValidateDescription

func ValidateDescription(description string) error

ValidateDescription checks that a description is non-empty and at most 1024 characters.

func ValidateFrontmatter

func ValidateFrontmatter(fm Frontmatter) error

ValidateFrontmatter validates all fields of a parsed Frontmatter struct.

func ValidateName

func ValidateName(name string) error

ValidateName checks that a skill name conforms to the Agent Skills spec: 1-64 characters, lowercase letters/numbers/hyphens only, no leading/trailing hyphens, no consecutive hyphens.

func ValidateNameMatchesDir

func ValidateNameMatchesDir(name, dirName string) error

ValidateNameMatchesDir returns an error if the frontmatter name does not match the directory name.

func ValidateSkillDirectory

func ValidateSkillDirectory(dirPath string) error

ValidateSkillDirectory validates a skill directory: checks that SKILL.md exists, parses and validates its frontmatter, and ensures the frontmatter name matches the directory name.

Types

type Frontmatter

type Frontmatter struct {
	Name          string            `yaml:"name"`
	Description   string            `yaml:"description"`
	License       string            `yaml:"license,omitempty"`
	Compatibility string            `yaml:"compatibility,omitempty"`
	Metadata      map[string]string `yaml:"metadata,omitempty"`
	AllowedTools  string            `yaml:"allowed-tools,omitempty"`
}

Frontmatter represents the YAML frontmatter of a SKILL.md file, following the Agent Skills specification.

func ParseAndValidateFrontmatter

func ParseAndValidateFrontmatter(content string) (Frontmatter, string, error)

ParseAndValidateFrontmatter parses YAML frontmatter from markdown content and validates the result. Returns the parsed frontmatter, body content, and any error from parsing or validation.

func ParseFrontmatter

func ParseFrontmatter(content string) (Frontmatter, string, error)

ParseFrontmatter extracts YAML frontmatter and body content from markdown. If no frontmatter is found (no opening ---), returns zero-value Frontmatter, the full content as body, and a nil error.

Jump to

Keyboard shortcuts

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