Download the PHP package stolt/skill-validator without Composer
On this page you can find all versions of the php package stolt/skill-validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stolt/skill-validator
More information about stolt/skill-validator
Files in stolt/skill-validator
Package skill-validator
Short Description A library for parsing and validating SKILL.md files or raw SKILL.md content.
License MIT
Informations about the package skill-validator
skill-validator
A PHP library to parse and validate SKILL.md files or raw SKILL.md content against the
SKILL.md format specification.
Installation and usage
Usage
The SkillMd class from the stolt/skill-md package is the primary abstraction for a validated skill. Every valid
result exposes a SkillMd instance, and the validator also accepts SkillMd instances directly as input.
The validator can validate existing SKILL.md files, raw SKILL.md content, or the mentioned SkillMd instances.
Validating a SKILL.md file
Validating all SKILL.md files in a directory
The method returns an array<string, ValidationResult> keyed by absolute file path, covering all SKILL.md files found
recursively under the given directory.
Validating raw SKILL.md content
Validating a SkillMd instance
[!TIP] The
validatealias method accepts a file path, directory path, raw content, or aSkillMdinstance and delegates to the appropriate method automatically.
Accessing validation results and metadata
Validation returns a Stolt\Ai\Skill\ValidationResult object. When the SKILL.md content is valid, a SkillMd
instance is available directly. The parsed metadata is also accessible as a Stolt\Ai\Skill\Metadata object.
Round-tripping between content and SkillMd
Because validateSkillMd() accepts a SkillMd instance and toSkillMd() returns one, validation results and
SkillMd objects round-trip cleanly:
For an actual integration, the project list-skills-command can also be consolidated.
Validation rules
The validator checks that a SKILL.md document:
- starts with YAML frontmatter delimited by
---lines, - contains the required
namefield, - contains the required
descriptionfield, - uses a non-empty, lowercase, hyphenated skill name,
- contains Markdown instructions after the frontmatter,
- only uses supported frontmatter fields,
- uses lists for list-like fields such as
tags,paths, andallowed-tools, - uses a boolean value for
disable-model-invocation.
Supported frontmatter fields include:
namedescriptionwhen_to_useallowed-toolsdisable-model-invocationargument-hintargumentspathsmodeleffortmetadatacompatibilitylicenseauthorversiontags
Running tests
License
This library is licensed under the MIT license. Please see LICENSE.md for more details.
Changelog
Please see CHANGELOG.md for more details.
Inspiration
This library idea is inspired by the work on agent-skills-validator by ronaldtebrake.
Contributing
Please see CONTRIBUTING.md for more details.