This commit is contained in:
John Lancaster
2026-06-20 14:13:22 -05:00
parent 19f3c1740a
commit f54cacd6cb
4 changed files with 21 additions and 14 deletions
+7 -4
View File
@@ -138,7 +138,9 @@ class SkillFrontmatter(BaseModel):
@classmethod
def validate_name(cls, value: str) -> str:
if not SKILL_ID_RE.fullmatch(value):
raise ValueError("name must be lowercase kebab-case and start with a letter")
raise ValueError(
"name must be lowercase kebab-case and start with a letter"
)
if "anthropic" in value or "claude" in value:
raise ValueError("name must not contain reserved words anthropic or claude")
return value
@@ -188,8 +190,7 @@ class DocsRegistry:
docs_markdown_by_path: dict[str, str]
docs_markdown_path_index: tuple[str, ...]
tag_to_skill_ids: dict[str, tuple[str, ...]]
capability_to_skill_ids: dict[str, tuple[str, ...]
]
capability_to_skill_ids: dict[str, tuple[str, ...]]
def _parse_frontmatter(markdown: str, *, path: str) -> tuple[dict[str, Any], str]:
@@ -234,7 +235,9 @@ def _walk_markdown(
return results
def _validate_skill_frontmatter(raw: dict[str, Any], *, skill_dir_name: str) -> SkillFrontmatter:
def _validate_skill_frontmatter(
raw: dict[str, Any], *, skill_dir_name: str
) -> SkillFrontmatter:
model = SkillFrontmatter.model_validate(raw)
if model.name != skill_dir_name:
raise ValueError("frontmatter name must exactly match skill directory name")