Skip to content

strands.vended_plugins.skills.skill

Skill data model and loading utilities for AgentSkills.io skills.

This module defines the Skill dataclass and provides classmethods for discovering, parsing, and loading skills from the filesystem or raw content. Skills are directories containing a SKILL.md file with YAML frontmatter metadata and markdown instructions.

@dataclass
class Skill()

Defined in: src/strands/vended_plugins/skills/skill.py:206

Represents an agent skill with metadata and instructions.

A skill encapsulates a set of instructions and metadata that can be dynamically loaded by an agent at runtime. Skills support progressive disclosure: metadata is shown upfront in the system prompt, and full instructions are loaded on demand via a tool.

Skills can be created directly or via convenience classmethods::

skill = Skill.from_file(”./skills/my-skill”)

skill = Skill.from_content(”---\nname: my-skill\n…”)

skills = Skill.from_directory(”./skills/”)

Attributes:

  • name - Unique identifier for the skill (1-64 chars, lowercase alphanumeric + hyphens).
  • description - Human-readable description of what the skill does.
  • instructions - Full markdown instructions from the SKILL.md body.
  • path - Filesystem path to the skill directory, if loaded from disk.
  • allowed_tools - List of tool names the skill is allowed to use. (Experimental: not yet enforced)
  • metadata - Additional key-value metadata from the SKILL.md frontmatter.
  • license - License identifier (e.g., “Apache-2.0”).
  • compatibility - Compatibility information string.
@classmethod
def from_file(cls, skill_path: str | Path, *, strict: bool = False) -> Skill

Defined in: src/strands/vended_plugins/skills/skill.py:246

Load a single skill from a directory containing SKILL.md.

Resolves the filesystem path, reads the file content, and delegates to from_content for parsing. After loading, sets the skill’s path and validates the skill name against the parent directory.

Arguments:

  • skill_path - Path to the skill directory or the SKILL.md file itself.
  • strict - If True, raise on any validation issue. If False (default), warn and load anyway.

Returns:

A Skill instance populated from the SKILL.md file.

Raises:

  • FileNotFoundError - If the path does not exist or SKILL.md is not found.
  • ValueError - If the skill metadata is invalid.
@classmethod
def from_content(cls, content: str, *, strict: bool = False) -> Skill

Defined in: src/strands/vended_plugins/skills/skill.py:294

Parse SKILL.md content into a Skill instance.

This is a convenience method for creating a Skill from raw SKILL.md content (YAML frontmatter + markdown body) without requiring a file on disk.

Example::

content = '''--- name: my-skill description: Does something useful

Section titled “content = '''--- name: my-skill description: Does something useful”

Follow these steps… ''' skill = Skill.from_content(content)

Arguments:

  • content - Raw SKILL.md content with YAML frontmatter and markdown body.
  • strict - If True, raise on any validation issue. If False (default), warn and load anyway.

Returns:

A Skill instance populated from the parsed content.

Raises:

  • ValueError - If the content is missing required fields or has invalid frontmatter.
@classmethod
def from_directory(cls,
skills_dir: str | Path,
*,
strict: bool = False) -> list[Skill]

Defined in: src/strands/vended_plugins/skills/skill.py:337

Load all skills from a parent directory containing skill subdirectories.

Each subdirectory containing a SKILL.md file is treated as a skill. Subdirectories without SKILL.md are silently skipped.

Arguments:

  • skills_dir - Path to the parent directory containing skill subdirectories.
  • strict - If True, raise on any validation issue. If False (default), warn and load anyway.

Returns:

List of Skill instances loaded from the directory.

Raises:

  • FileNotFoundError - If the skills directory does not exist.