Module skills

Module skills 

Source
Expand description

Skills module for AGPM

This module provides functionality for managing Claude Skills, which are directory-based resources containing a SKILL.md file with frontmatter and optional supporting files.

§What are Skills?

Skills are directories that:

  • Contain a SKILL.md file with required YAML frontmatter
  • May include additional files (REFERENCE.md, scripts, examples)
  • Install to .claude/skills/<name>/ as directories
  • Can declare dependencies on other resources
  • Support patching for customization

§SKILL.md Format

---
name: Skill Name
description: What this skill does
version: 1.0.0  # optional
allowed-tools: Read, Grep  # optional
dependencies:  # optional
  agents:
    - path: agents/helper.md
---
# Skill content in markdown

§Async vs Sync Functions

This module uses a hybrid async/sync approach for performance and compatibility:

  • validate_skill_size: Async wrapper around sync walkdir. Integrates with the async installer pipeline while using spawn_blocking for the actual I/O. This prevents blocking the Tokio runtime during directory traversal.

  • extract_skill_metadata: Async for the same reason - wraps sync directory iteration in spawn_blocking to avoid blocking async contexts.

  • collect_skill_directory_info: Sync helper that performs the actual directory walk. Called via spawn_blocking from async functions. Uses walkdir which is inherently synchronous.

  • validate_skill_frontmatter: Pure sync function that only parses in-memory YAML. No I/O, so no need for async.

The walkdir crate is synchronous, so we wrap it in spawn_blocking rather than using a fake async interface. This is the recommended Tokio pattern for CPU-bound or blocking I/O operations.

Modules§

patches
Skill-specific patch support for modifying SKILL.md frontmatter.

Structs§

SkillDirectoryInfo
Information collected from iterating over a skill directory.
SkillFrontmatter
Frontmatter structure for SKILL.md files

Functions§

extract_skill_metadata
Extract metadata from a skill directory.
extract_skill_metadata_from_info
Extract metadata from pre-collected skill directory info.
validate_skill_frontmatter
Validate and extract frontmatter from SKILL.md content
validate_skill_size
Validate skill directory size and file count before installation.