Spec Validator API
The Spec Validator validates rendered SKILL.md files against the agentskills.io specification. It ensures generated skills conform to the required format and metadata standards.Validation Rules
The validator checks:- Name: kebab-case, max 64 chars, matches
^[a-z0-9]([a-z0-9-]*[a-z0-9])?$ - Description: max 1024 chars, required
- allowed-tools: must be a YAML list (not comma-separated string)
- version: must be present (warning if missing)
- Frontmatter: valid YAML between
---delimiters
Functions
validateSkillMd
Validate a SKILL.md file content against the agentskills.io spec.The full SKILL.md file content including frontmatter
SpecValidationResult with any violations found
Example
extractFrontmatter
Extract and parse YAML frontmatter from SKILL.md content.The full SKILL.md file content
Record<string, unknown> | null - Parsed frontmatter object or null if not found/invalid
Example
Classes
SpecValidationResult
Result of spec validation. Collects violations (errors and warnings) found during validation.Properties
All violations (errors and warnings) found during validation
True if no error-level violations exist (read-only getter)
All error-level violations (read-only getter)
All warning-level violations (read-only getter)
Methods
Add an error-level violation
Add a warning-level violation
Example
Types
SpecViolation
A single spec violation.The frontmatter field that violated the spec (e.g., “name”, “description”, “allowed-tools”)
Human-readable description of the violation
Violation severity. Errors prevent skill activation, warnings are informational.
Constants
MAX_DESCRIPTION_LENGTH
Maximum description length per agentskills.io spec.Validation Examples
Valid Skill
isValid = true, no violations
Invalid Name
isValid = false
Error: name: Name 'Debug_Test_Failure' does not match spec regex ^[a-z0-9]([a-z0-9-]*[a-z0-9])?$
Missing Description
isValid = false
Error: description: Missing required field 'description'
Invalid allowed-tools
isValid = false
Error: `allowed-tools: Must be a YAML list, not a comma-separated string. Use:
allowed-tools:
- Tool1
- Tool2`
Missing Version (Warning)
isValid = true (warnings don’t fail validation)
Warning: version: Missing 'version' field (recommended by spec)
Description Too Long
isValid = false
Error: description: Description exceeds 1024 chars (got 1025)
Common Violations
| Violation | Severity | How to Fix |
|---|---|---|
| Missing frontmatter | Error | Add --- delimiters at start of file |
| Invalid YAML | Error | Check YAML syntax (indentation, quotes) |
| Missing name | Error | Add name: skill-name to frontmatter |
| Invalid name format | Error | Use lowercase kebab-case (a-z, 0-9, hyphens) |
| Name too long | Error | Keep name under 64 characters |
| Missing description | Error | Add description: ... to frontmatter |
| Description too long | Error | Keep description under 1024 characters |
| allowed-tools as string | Error | Use YAML list syntax, not comma-separated |
| Missing version | Warning | Add version: 1.0.0 (recommended) |
Integration
The Spec Validator is automatically used by Auto-Skill’s skill generator:Related
- Path Security - Path validation and sanitization
- Config - Configuration management
- agentskills.io - Official skill specification