Overview
Skills are reusable instruction sets stored inSKILL.md files that extend loaf’s capabilities with domain-specific workflows, templates, and references. When you mention a skill by name (using $skill-name) or when your task matches a skill’s description, loaf automatically loads and follows those instructions.
How Skills Work
Discovery
Loaf automatically discovers skills from multiple directories in priority order:- Repository skills -
.agents/skills/directories from your current working directory up to the git root - Loaf data directory -
~/.loaf/skills/for user-installed skills - Home directory -
~/.agents/skills/for global skills
SKILL.md file:
Skill Structure
A skill directory typically contains:SKILL.md(required) - Main instruction filescripts/(optional) - Executable scripts referenced by the skillreferences/(optional) - Documentation, examples, or reference materialsassets/(optional) - Templates, config files, or other resources
Using Skills
Explicit Mentions
Mention a skill by name using the$ prefix:
., _, :, -
Auto-Matching
Loaf can automatically select skills when your task description clearly matches a skill’s description, even without explicit$ mention.
Auto-matching is evaluated per turn - skills don’t carry over to subsequent messages unless re-mentioned.
Progressive Disclosure
When using a skill, loaf follows a progressive disclosure pattern:- Opens the
SKILL.mdfile and reads only what’s needed - Resolves relative paths (e.g.,
scripts/foo.py) relative to the skill directory - Loads specific referenced files from
references/only when required - Reuses assets and templates instead of recreating from scratch
Skill Metadata
Skill Definition
Each discovered skill is represented internally as:Description Extraction
The skill description is extracted fromSKILL.md by:
- Splitting content into paragraphs
- Finding the first non-header, non-code paragraph
- Cleaning markdown formatting (bold, code, bullets)
- Using first meaningful text as description
Skill Catalog
The skill catalog aggregates all discovered skills:Directory Scanning
Skill discovery includes:- Depth limit: Maximum 6 levels deep
- Directory limit: Maximum 2,000 directories per root
- Deduplication: Symlinks are resolved and deduplicated
- Exclusions: Dotfiles (starting with
.) are skipped
Selection and Context
When skills are selected for a prompt:Implementation Details
Source Files
src/skills/loader.ts- Skill discovery and catalog loadingsrc/skills/matcher.ts- Skill mention parsingsrc/skills/prompt.ts- Skill context buildingsrc/skills/types.ts- Type definitions
Key Functions
Best Practices
Writing Skills
- Clear description - First paragraph should clearly explain the skill’s purpose
- Progressive structure - Put essential instructions first, details later
- Relative paths - Use relative paths for scripts and references
- Self-contained - Include all necessary templates and references
- Tested workflows - Ensure scripts work across environments
Using Skills
- Explicit over implicit - Use
$skill-namewhen you know which skill to use - Single responsibility - One skill per specific workflow
- Combine when needed - Multiple skills can work together
- Check availability - Use
loaf skills listto see available skills
Repository Integration
For project-specific skills:Related
- Custom Tools - Extend loaf with executable tools
- Creating Skills - Authoring your own skills