parser
parser
¶
SkillParser — strict spec validation + tolerant field mapping.
The parser is the single chokepoint for converting raw frontmatter dicts into normalized SkillManifest instances. It runs two passes:
- Strict pass — validates required fields, length limits, naming rules.
- Tolerant pass — maps non-spec top-level fields to their canonical locations under metadata.diapason.* via FIELD_MAPPING.
The mapping table is data, not code paths. Adding support for a new vendor's fields means adding entries to FIELD_MAPPING — no logic changes.
Classes¶
SkillParseError
¶
Bases: ValueError
Raised when a skill frontmatter cannot be parsed.
SkillParser
¶
Parse SKILL.md frontmatter into a SkillManifest.
Two-pass design:
- :meth:
parse_frontmatterruns the strict pass + tolerant pass and returns a normalized :class:SkillManifest.
Methods:¶
parse_frontmatter
¶
parse_frontmatter(
frontmatter: Dict[str, Any],
*,
markdown_content: str = "",
) -> SkillManifest
Parse a frontmatter dict, returning a SkillManifest.
Runs strict validation first, then applies tolerant field mapping.