Skip to content

Commit 8db72a7

Browse files
Davide Gallitelliclaude
andcommitted
fix(skills): fix stale docstring, add invalid content test
- Fix stale "auto-resolved to raw content" in AgentSkills docstring - Add test for non-SKILL.md content (HTML page → ValueError) - Add from_url() example to Skill class docstring Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b11b4e3 commit 8db72a7

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/strands/vended_plugins/skills/agent_skills.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ def __init__(
8686
- A ``str`` or ``Path`` to a skill directory (containing SKILL.md)
8787
- A ``str`` or ``Path`` to a parent directory (containing skill subdirectories)
8888
- A ``Skill`` dataclass instance
89-
- An ``https://`` URL pointing to a SKILL.md file or a GitHub
90-
repository/directory URL (auto-resolved to raw content)
89+
- An ``https://`` URL pointing directly to raw SKILL.md content
9190
state_key: Key used to store plugin state in ``agent.state``.
9291
max_resource_files: Maximum number of resource files to list in skill responses.
9392
strict: If True, raise on skill validation issues. If False (default), warn and load anyway.

src/strands/vended_plugins/skills/skill.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ class Skill:
224224
# Load all skills from a parent directory
225225
skills = Skill.from_directory("./skills/")
226226
227+
# From an HTTPS URL
228+
skill = Skill.from_url("https://example.com/SKILL.md")
229+
227230
Attributes:
228231
name: Unique identifier for the skill (1-64 chars, lowercase alphanumeric + hyphens).
229232
description: Human-readable description of what the skill does.

tests/strands/vended_plugins/skills/test_skill.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,16 @@ def test_from_url_strict_mode(self):
627627
with pytest.raises(ValueError):
628628
Skill.from_url("https://example.com/SKILL.md", strict=True)
629629

630+
def test_from_url_invalid_content_raises(self):
631+
"""Test that non-SKILL.md content (e.g. HTML page) raises ValueError."""
632+
from unittest.mock import patch
633+
634+
html_content = "<html><body>Not a SKILL.md</body></html>"
635+
636+
with patch(f"{self._SKILL_MODULE}.urllib.request.urlopen", return_value=self._mock_urlopen(html_content)):
637+
with pytest.raises(ValueError, match="frontmatter"):
638+
Skill.from_url("https://example.com/SKILL.md")
639+
630640

631641
class TestSkillClassmethods:
632642
"""Tests for Skill classmethod existence."""

0 commit comments

Comments
 (0)