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 ¶
- func CheckFlatOrphanFiles(dir, body string) []types.Result
- func CheckFrontmatter(s *skill.Skill, opts Options) []types.Result
- func CheckInternalLinks(dir, body string) []types.Result
- func CheckMarkdown(dir, body string) []types.Result
- func CheckOrphanFiles(dir, body string, opts Options) []types.Result
- func CheckStructure(dir string, opts Options) []types.Result
- func CheckTokens(dir, body string, opts Options) ([]types.Result, []types.TokenCount, []types.TokenCount)
- func FindUnclosedFence(content string) (int, bool)
- func Validate(dir string, opts Options) *types.Report
- func ValidateMulti(dirs []string, opts Options) *types.MultiReport
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckFlatOrphanFiles ¶ added in v1.3.0
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 ¶
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 ¶
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 ¶
CheckMarkdown validates markdown structure in the skill.
func CheckOrphanFiles ¶
CheckOrphanFiles walks scripts/, references/, and assets/ to find files that are never referenced (directly or transitively) from SKILL.md. Directories listed in opts.AllowDirs are skipped with an informational note, since the validator cannot know their expected reference patterns.
func CheckStructure ¶
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. Directories listed in opts.AllowDirs are accepted without warning and are exempt from deep-nesting checks.
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 ¶
FindUnclosedFence checks for unclosed code fences (``` or ~~~). Returns the line number of the unclosed opening fence and true, or 0 and false.
func ValidateMulti ¶
func ValidateMulti(dirs []string, opts Options) *types.MultiReport
ValidateMulti validates each directory and returns an aggregated report.