agent-skills-ts-sdk is a TypeScript implementation of the AgentSkills specification. It parses SKILL.md files, validates frontmatter, generates prompt blocks, and applies patches. This package sits adjacent to the core WebMCP runtime and does not depend on it.
Installation
Minimal example
Parsing
parseSkillContent(content, options?)
Parses a SKILL.md string into frontmatter properties and a markdown body.
<script> element (which may have a leading newline), use embedded mode:
parseFrontmatter(content, options?)
Parses YAML frontmatter into the spec’s hyphenated keys. Trims required fields and preserves metadata scalars as strings.
frontmatterToProperties(frontmatter)
Converts a SkillFrontmatter object to a camelCased SkillProperties shape without re-parsing.
extractBody(content)
Strips frontmatter and returns the markdown body.
findSkillMdFile(files)
Finds the SKILL.md entry in an in-memory file list. Does not assume a filesystem.
readSkillProperties(files, options?)
Reads and parses skill properties from an in-memory file list.
extractResourceLinks(body)
Extracts resource links from the markdown body.
Validation
validateSkillContent(content)
Validates a single SKILL.md string. Checks frontmatter fields, unknown fields, and structural rules.
validateSkillProperties(properties, options?)
Validates a SkillProperties object against name/description/compatibility rules.
validateSkillEntries(files, options?)
Mirrors the reference library’s skills-ref validate for in-memory file lists. Hosts supply their own storage model.
Validation rules
Validation constants
Prompt utilities
toPrompt(entries)
Builds an <available_skills> XML block from parsed entries or raw SKILL.md content.
toDisclosurePrompt(entries)
Generates a disclosure prompt, optionally including resource names for tier-3 hints.
toDisclosureInstructions(options)
Generates canonical read-protocol instruction text.
toReadToolSchema(skills, options?)
Builds a strict JSON Schema declaration for a read tool.
handleSkillRead(args)
Handles 2-level read requests in memory (overview vs. specific resource).
Diff and patch
createSkillPatch(oldContent, newContent, options?)
Builds a contextual patch from two SKILL.md strings.
applySkillPatch(content, patch, options?)
Applies patch operations and returns structured errors when a patch cannot be applied or yields invalid SKILL.md.
diffSkillContent(oldContent, newContent)
Returns a line-based diff for display or patch construction.
validateSkillPatch(patch)
Runtime validation for model-provided patch payloads.
Utilities
Types
Core types
Storage types
Prompt types
Patch types
Read tool types
Error classes
Specification compliance
This package mirrors the AgentSkills specification for content parsing and validation. It aligns with the Python skills-ref reference implementation. Directory-level checks are surfaced throughvalidateSkillEntries so hosts can supply their own storage model.