Skip to content

API Reference parrot.skills.loader

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.skills.loader

View source

SkillsDirectoryLoader — Filesystem discovery for skills.

Scans configured filesystem paths to discover both single-file (.md) and composite (dir/SKILL.md) skill layouts. Discovered skills are hot-added to a :class:~parrot.skills.file_registry.SkillFileRegistry via :meth:load_into.

Boot-time usage::

loader = SkillsDirectoryLoader(paths=[Path(".agent/skills/")])
count = await loader.load_into(registry)

Alias SkillDefinition

Re-exported from parrot.skills.models.SkillDefinition.

Alias SkillFileRegistry

Re-exported from parrot.skills.file_registry.SkillFileRegistry.

Alias SkillLoadReject

Re-exported from parrot.skills.models.SkillLoadReject.

Class SkillsDirectoryLoader

Discover and load skills from one or more filesystem directories.

Supports two skill layouts:

  • Single-file: {dir}/{name}.md — a plain Markdown file with YAML frontmatter.
  • Composite: {dir}/{name}/SKILL.md — a directory containing SKILL.md plus adjacent asset files (scripts, templates, etc.).

Failed parses are logged as warnings and skipped; the loader never crashes on malformed input.

Example::

loader = SkillsDirectoryLoader(
    paths=[Path(".agent/skills/")],
    logger=self.logger,
)
count = await loader.load_into(self._skill_file_registry)
Parameter Type Default Description
paths List[Path] List of filesystem paths to scan. Paths that do not exist or are not directories are logged at DEBUG level and skipped.
logger Optional[Logger] None Optional logger; if not provided, a module-level logger is used.
max_tokens Optional[int] None

Method SkillsDirectoryLoader.discover

Scan all configured paths and return discovered SkillDefinitions.

Iterates each path in sorted order for deterministic discovery. Skips non-existent paths and malformed skill files with a warning.

discover() -> List[SkillDefinition]

Returns: List[SkillDefinition] — List of successfully parsed :class:~parrot.skills.models.SkillDefinition instances. Empty list if no skills are found or all paths are invalid.

Method SkillsDirectoryLoader.load_into

Discover skills and hot-add them to an existing registry.

Calls :meth:discover to enumerate all skills, then adds each to registry via :meth:~parrot.skills.file_registry.SkillFileRegistry.add. Individual registration failures are logged as warnings.

load_into(registry: SkillFileRegistry) -> int

Parameter Type Default Description
registry SkillFileRegistry The :class:~parrot.skills.file_registry.SkillFileRegistry to hot-add discovered skills into.

Returns: int — Count of successfully loaded (registered) skills.

Alias discover_skills_in_dir

Re-exported from parrot.skills.parsers.discover_skills_in_dir.

Alias resolve_skill_max_tokens

Re-exported from parrot.skills.parsers.resolve_skill_max_tokens.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally