Skills API¶
The Skills system allows you to create reusable workflows and custom commands.
Skills Management¶
discover_skills¶
patchpal.skills.discover_skills(repo_root=None)
¶
Discover all available skills from personal and project directories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo_root
|
Optional[Path]
|
Repository root path (for project-specific skills) |
None
|
Returns:
| Type | Description |
|---|---|
Dict[str, Skill]
|
Dictionary mapping skill names to Skill objects |
Source code in patchpal/skills.py
list_skills¶
patchpal.skills.list_skills(repo_root=None)
¶
Get a list of all available skills.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo_root
|
Optional[Path]
|
Repository root path |
None
|
Returns:
| Type | Description |
|---|---|
List[Skill]
|
List of Skill objects sorted by name |
Source code in patchpal/skills.py
get_skill¶
patchpal.skills.get_skill(name, repo_root=None)
¶
Get a specific skill by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Skill name |
required |
repo_root
|
Optional[Path]
|
Repository root path |
None
|
Returns:
| Type | Description |
|---|---|
Optional[Skill]
|
Skill object or None if not found |
Source code in patchpal/skills.py
Skill Class¶
patchpal.skills.Skill(name, description, instructions, path)
¶
Usage Example¶
from patchpal.skills import list_skills, get_skill
# List all available skills
skills = list_skills()
for skill in skills:
print(f"/{skill.name} - {skill.description}")
# Get a specific skill
skill = get_skill("commit")
if skill:
print(f"Name: {skill.name}")
print(f"Description: {skill.description}")
print(f"Instructions:\n{skill.instructions}")
Creating Skills Programmatically¶
While skills are typically defined as markdown files, you can also work with them programmatically:
from pathlib import Path
from patchpal.skills import discover_skills
# Discover all skills in the repository and personal directories
repo_root = Path.cwd()
skills_dict = discover_skills(repo_root)
# Skills are keyed by name
for skill_name, skill in skills_dict.items():
print(f"{skill_name}: {skill.description}")
Skill File Format¶
Skills are markdown files with YAML frontmatter:
---
name: myskill
description: A custom skill that does something useful
---
Instructions for the agent...
1. First do this
2. Then do that
3. Finally, complete the task
Related¶
- Skills System Guide - Complete guide to creating and using skills
- Agent API - Using skills through the agent
- use_skill tool - Invoking skills programmatically