structure

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package structure validates the directory layout, frontmatter, token counts, markdown syntax, internal links, and orphan files of a skill package. It is the main validation entry point used by the CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckFrontmatter

func CheckFrontmatter(s *skill.Skill) []types.Result

CheckFrontmatter validates the YAML frontmatter of a parsed skill. It checks required fields (name, description), enforces format and length constraints, validates optional fields, and warns about unrecognized or keyword-stuffed fields.

func CheckInternalLinks(dir, body string) []types.Result

CheckInternalLinks validates relative (internal) links in the skill body. Broken internal links indicate a structural problem: the skill references files that don't exist in the package.

func CheckMarkdown

func CheckMarkdown(dir, body string) []types.Result

CheckMarkdown validates markdown structure in the skill.

func CheckOrphanFiles

func CheckOrphanFiles(dir, body string) []types.Result

CheckOrphanFiles walks scripts/, references/, and assets/ to find files that are never referenced (directly or transitively) from SKILL.md.

func CheckStructure

func CheckStructure(dir string) []types.Result

CheckStructure validates the directory layout of a skill package. It checks for the required SKILL.md file, flags unrecognized directories and extraneous root files, and warns about deep nesting in recognized directories.

func CheckTokens

func CheckTokens(dir, body string) ([]types.Result, []types.TokenCount, []types.TokenCount)

CheckTokens counts tokens for the SKILL.md body, reference files, asset files, and non-standard files. It returns validation results, standard token counts, and non-standard ("other") token counts.

func FindUnclosedFence

func FindUnclosedFence(content string) (int, bool)

FindUnclosedFence checks for unclosed code fences (``` or ~~~). Returns the line number of the unclosed opening fence and true, or 0 and false.

func Validate

func Validate(dir string, opts Options) *types.Report

Validate runs all checks against the skill in the given directory.

func ValidateMulti

func ValidateMulti(dirs []string, opts Options) *types.MultiReport

ValidateMulti validates each directory and returns an aggregated report.

Types

type Options

type Options struct {
	SkipOrphans bool
}

Options configures which checks Validate runs.

Jump to

Keyboard shortcuts

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