Pull a skill, agent, or prompt from the catalog into the local environment. If already installed locally, overwrite with the latest from the source (refresh).
The user provides a skill name or description.
Pull the latest catalog before reading:
cd <LIBRARY_SKILL_DIR>
git pull- Read
library.yaml - Search across
library.skills,library.agents, andlibrary.prompts - Match by name (exact) or description (fuzzy/keyword match)
- If multiple matches, show them and ask the user to pick one
- If no match, tell the user and suggest
/library search
If the entry has a requires field:
- For each typed reference (
skill:name,agent:name,prompt:name):- Look it up in
library.yaml - If found, recursively run the
useworkflow for that dependency first - If not found, warn the user: "Dependency not found in library catalog"
- Look it up in
- Process all dependencies before the requested item
- Read
default_dirsfromlibrary.yaml - If user said "global" or "globally" → use the
globalpath - If user specified a custom path → use that path
- Otherwise → use the
defaultpath - Select the correct section based on type (skills/agents/prompts)
If source is a local path (starts with / or ~):
- Resolve
~to the home directory - Get the parent directory of the referenced file
- For skills: copy the entire parent directory to the target:
cp -R <parent_directory>/ <target_directory>/<name>/
- For agents: copy just the agent file to the target:
cp <agent_file> <target_directory>/<agent_name>.md
- For prompts: copy just the prompt file to the target:
cp <prompt_file> <target_directory>/<prompt_name>.md
- If the agent or prompt is nested in a subdirectory under the
agents/orcommands/directories, copy the subdirectory to the target as well, creating the subdir if it doesn't exist. This is useful because it keeps the agents or commands grouped together.
If source is a GitHub URL:
- Parse the URL to extract:
org,repo,branch,file_path- Browser URL pattern:
https://github.com/<org>/<repo>/blob/<branch>/<path> - Raw URL pattern:
https://raw.githubusercontent.com/<org>/<repo>/<branch>/<path>
- Browser URL pattern:
- Determine the clone URL:
https://github.com/<org>/<repo>.git - Determine the parent directory path within the repo (everything before the filename)
- Clone into a temporary directory:
tmp_dir=$(mktemp -d) git clone --depth 1 --branch <branch> https://github.com/<org>/<repo>.git "$tmp_dir"
- Copy the parent directory of the file to the target:
cp -R "$tmp_dir/<parent_path>/" <target_directory>/<name>/
- Clean up:
rm -rf "$tmp_dir"
If clone fails (private repo), try SSH:
git clone --depth 1 --branch <branch> [email protected]:<org>/<repo>.git "$tmp_dir"- Confirm the target directory exists
- Confirm the main file (SKILL.md, AGENT.md, or prompt file) exists in it
- Report success with the installed path
Tell the user:
- What was installed and where
- Any dependencies that were also installed
- If this was a refresh (overwrite), mention that