Created
March 10, 2026 05:38
-
-
Save schpet/dc1d51800c05edbb1b2e1110e84004c6 to your computer and use it in GitHub Desktop.
A private skills repository — a space for your own skills and workflows for AI coding agents. 1) create a repo 2) add this install.sh 3) put skills in a skills/ directory 4) run ./install.sh to symlink into ~/.claude/skills, ~/.codex/skills, ~/.pi/agent/skills 5) clone & install on all your machines to keep skills in sync
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # install.sh — wire skills/ into each agent's global skills directory. | |
| # | |
| # Two modes: | |
| # dir-symlink The agent dir itself becomes a symlink to skills/. | |
| # New skills created by that agent land in the repo automatically. | |
| # Used for: claude-code, pi | |
| # | |
| # per-skill Individual symlinks are created inside the agent's existing dir. | |
| # Used for agents that manage hidden state inside their skills dir. | |
| # Used for: codex (.system/ must stay) | |
| # | |
| # Run after cloning on a new machine, or after adding a new agent. | |
| set -euo pipefail | |
| REPO="$(cd "$(dirname "$(realpath "$0")")" && pwd)" | |
| SKILLS_SRC="$REPO/skills" | |
| # --- dir-symlink mode --- | |
| link_dir() { | |
| local agent_name="$1" | |
| local link="$2" | |
| echo "" | |
| echo "[$agent_name] dir-symlink -> $link" | |
| if [ -L "$link" ]; then | |
| local current | |
| current="$(readlink "$link")" | |
| if [ "$current" = "$SKILLS_SRC" ]; then | |
| echo " ok $link -> $SKILLS_SRC" | |
| return | |
| fi | |
| echo " upd $link (was $current)" | |
| ln -sfn "$SKILLS_SRC" "$link" | |
| elif [ -d "$link" ]; then | |
| echo " SKIP $link is a real directory — remove it manually then re-run" | |
| else | |
| mkdir -p "$(dirname "$link")" | |
| ln -s "$SKILLS_SRC" "$link" | |
| echo " new $link -> $SKILLS_SRC" | |
| fi | |
| } | |
| # --- per-skill mode --- | |
| link_skill() { | |
| local skill_dir="$1" | |
| local target_dir="$2" | |
| local skill_name | |
| skill_name="$(basename "$skill_dir")" | |
| local link="$target_dir/$skill_name" | |
| if [ -L "$link" ]; then | |
| local current | |
| current="$(readlink "$link")" | |
| if [ "$current" = "$skill_dir" ]; then | |
| echo " ok $link" | |
| return | |
| fi | |
| echo " upd $link" | |
| ln -sfn "$skill_dir" "$link" | |
| elif [ -e "$link" ]; then | |
| echo " SKIP $link (not a symlink — remove manually)" | |
| else | |
| ln -s "$skill_dir" "$link" | |
| echo " new $link" | |
| fi | |
| } | |
| link_skills_dir() { | |
| local agent_name="$1" | |
| local target_dir="$2" | |
| echo "" | |
| echo "[$agent_name] per-skill -> $target_dir" | |
| mkdir -p "$target_dir" | |
| for skill_dir in "$SKILLS_SRC"/*/; do | |
| [ -d "$skill_dir" ] || continue | |
| link_skill "${skill_dir%/}" "$target_dir" | |
| done | |
| } | |
| # Agents where the whole dir becomes the repo (new skills auto-land here) | |
| link_dir "claude-code" "$HOME/.claude/skills" | |
| link_dir "pi" "$HOME/.pi/agent/skills" | |
| # Agents with internal state in their skills dir — use per-skill symlinks | |
| link_skills_dir "codex" "$HOME/.codex/skills" | |
| echo "" | |
| echo "done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment