Documentation
¶
Index ¶
- Constants
- func DisplayName(slug string) string
- func FormatSkillMD(fm Frontmatter, body string) (string, error)
- func FrontmatterToMeta(fm Frontmatter) map[string]any
- func ValidateDescription(description string) error
- func ValidateFrontmatter(fm Frontmatter) error
- func ValidateName(name string) error
- func ValidateNameMatchesDir(name, dirName string) error
- func ValidateSkillDirectory(dirPath string) error
- type Frontmatter
Constants ¶
const SkillMainFile = "SKILL.md"
SkillMainFile is the filename for the main skill definition file in a skill directory.
const WorkflowsDir = "workflows"
WorkflowsDir is the directory name where workflow files are stored.
Variables ¶
This section is empty.
Functions ¶
func DisplayName ¶
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 FrontmatterToMeta ¶
func FrontmatterToMeta(fm Frontmatter) map[string]any
FrontmatterToMeta converts all Frontmatter fields into a map suitable for the MCP Resource/ResourceContent _meta field. It includes the computed DisplayName and flattens the Metadata sub-map entries into the top level.
func ValidateDescription ¶
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 ¶
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 ¶
ValidateNameMatchesDir returns an error if the frontmatter name does not match the directory name.
func ValidateSkillDirectory ¶
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.