skill

package
v0.54.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package skill parses SKILL.md frontmatter for transitive dependency resolution and the sandbox directory name a skill occupies.

Index

Constants

This section is empty.

Variables

View Source
var MarkerNames = [...]string{"SKILL.md", "skill.md", "Skill.md"}

MarkerNames are the spellings of the file that marks a skill directory, in lookup order; the first one present is read.

Functions

func SandboxName added in v0.48.0

func SandboxName(skillPath string) string

SandboxName is the directory name a skill takes under <configDir>/skills/. It prefers a valid SKILL.md frontmatter name so nested forge skills that share a leaf directory (github, gitlab) upload to distinct destinations. When the frontmatter is missing, unreadable, or not a valid name, it falls back to filepath.Base.

Declared names are only consulted for absolute paths: a relative path would be read against the process's current working directory, not the harness tree, so a CWD-relative SKILL.md could choose the identity mergeSkills sees. LoadWithBase resolves a harness's relative skill paths against the caller's workspace root (or fetches them for a URL-sourced harness) before any merge, so the fallback to filepath.Base is reached only for paths nothing resolved.

func ValidName added in v0.48.0

func ValidName(name string) bool

ValidName reports whether name is a single sandbox-safe path segment: alphanumeric, hyphen, underscore, or dot, not starting with a dot (a dot-prefixed directory is hidden from skill discovery).

Types

type SkillMeta

type SkillMeta struct {
	Name         string   `yaml:"name"`
	Description  string   `yaml:"description,omitempty"`
	Dependencies []string `yaml:"dependencies,omitempty"`
	Policy       string   `yaml:"policy,omitempty"`
}

SkillMeta holds parsed YAML frontmatter from a SKILL.md file.

func ParseFrontmatter

func ParseFrontmatter(content []byte) (*SkillMeta, error)

ParseFrontmatter extracts the YAML frontmatter block (delimited by "---") from SKILL.md content and unmarshals it into SkillMeta. Returns nil (no error) if the content has no frontmatter. Returns an error only if frontmatter is present but malformed.

Jump to

Keyboard shortcuts

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