UNPKG

skills-mcp

Version:

Bring Claude's Skills pattern to any MCP-compatible agent

25 lines 833 B
import { parsedSkillFileSchema } from './schemas.js'; export class ValidationError extends Error { constructor(message) { super(message); this.name = 'ValidationError'; } } /** * Assert skill metadata from YAML frontmatter is valid */ export function assertParsedSkillFile(parsedSkillFile, skillFilePath) { const validatedSkillFile = parsedSkillFileSchema.safeParse(parsedSkillFile); if (!validatedSkillFile.success) { throw new ValidationError(`Invalid skill file at ${skillFilePath}: ${validatedSkillFile.error.message}`); } } // Skill IDs should be lowercase with hyphens const validPattern = /^[a-z0-9]+(-[a-z0-9]+)*$/; /** * Validate skill directory name */ export function validateSkillId(skillId) { return validPattern.test(skillId); } //# sourceMappingURL=validation.js.map