refactor(agent): consolidate skill definition into single SKILL.md with YAML frontmatter

Merge skill.yaml (metadata) and prompt.md (prompt template) into a
single SKILL.md file with YAML frontmatter, matching the agent-skill
convention used by opencode and Claude Code.

- Add frontmatter parser (_parse_skill_file) to SkillRegistry
- Remove skill.yaml, prompt.md, empty skills/__init__.py
- Remove obsolete load_handler method
- Update tests for new format and cleaned-up fields
This commit is contained in:
Will Miao
2026-07-02 21:29:02 +08:00
parent cf898da193
commit 63785f82b5
5 changed files with 80 additions and 119 deletions

View File

@@ -30,13 +30,14 @@ class TestSkillRegistryDiscovery:
def test_skill_has_correct_model_type_filter(self, registry):
skill = registry.get_skill("enrich_hf_metadata")
assert skill.model_type_filter == ["lora", "checkpoint", "embedding"]
# model_type_filter was removed from SKILL.md — defaults to None (all types)
assert skill.model_type_filter is None
def test_skill_has_permissions(self, registry):
skill = registry.get_skill("enrich_hf_metadata")
assert skill.permissions.write_metadata is True
assert skill.permissions.write_previews is True
assert "huggingface.co" in skill.permissions.network_domains
# network_domains defaults to () since permissions block was removed
def test_get_skill_returns_none_for_unknown(self, registry):
assert registry.get_skill("nonexistent_skill") is None
@@ -51,13 +52,9 @@ class TestSkillRegistryLoading:
assert "trigger_words" in prompt
def test_load_prompt_raises_for_unknown_skill(self, registry):
with pytest.raises(FileNotFoundError):
with pytest.raises((FileNotFoundError, ValueError)):
registry.load_prompt("nonexistent")
def test_load_handler_raises_when_handler_missing(self, registry):
with pytest.raises(FileNotFoundError):
registry.load_handler("enrich_hf_metadata")
class TestSkillDefinition:
def test_applies_to_model_type_with_filter(self):