structure

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 11 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 CheckFlatOrphanFiles added in v1.3.0

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

CheckFlatOrphanFiles checks root-level non-SKILL.md files for references in the SKILL.md body. Files not referenced are reported as potentially orphaned. This is a simpler check than CheckOrphanFiles since all files are at the root.

func CheckFrontmatter

func CheckFrontmatter(s *skill.Skill, opts Options) []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, opts Options) []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, opts Options) ([]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
	AllowExtraFrontmatter bool
	AllowFlatLayouts      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