Loading...
Loading...
Use when syncing skills from local folders, GitHub URLs, or skillsmp.com pages to multiple AI coding tool directories
npx skill4agent add chujianyun/skills sync-skillsdigraph when_sync {
"Need to sync skill?" [shape=diamond];
"Source type?" [shape=diamond];
"Local folder" [shape=box];
"GitHub URL" [shape=box];
"skillsmp.com URL" [shape=box];
"Need to sync skill?" -> "Source type?";
"Source type?" -> "Local folder" [label="Local path"];
"Source type?" -> "GitHub URL" [label="github.com"];
"Source type?" -> "skillsmp.com URL" [label="skillsmp.com"];
}| Tool | Project Level | User Level |
|---|---|---|
| Claude Code | | |
| GitHub Copilot | | |
| Google Antigravity | | |
| Cursor | | |
| OpenCode | | |
| OpenAI Codex | | |
| Gemini CLI | | |
| Windsurf | | |
| Qwen Code | | |
| Qoder | | |
| OpenClaw | | |
./sync-skill.sh <source># Local folder
./sync-skill.sh /Users/user/skills/my-skill
# GitHub repository
./sync-skill.sh https://github.com/user/skill-repo
# skillsmp.com page
./sync-skill.sh https://skillsmp.com/skills/skill-name# Local folder
/Users/user/skills/my-skill
./skills/my-skill
~/skills/my-skill
# GitHub URL
https://github.com/user/skill-repo
https://github.com/user/skill-repo.git
git@github.com:user/skill-repo.git
# skillsmp.com URL
https://skillsmp.com/skills/skill-name
https://www.skillsmp.com/skills/skill-namecp -r /path/to/skill-name ~/.claude/skills/
cp -r /path/to/skill-name ~/.qoder/skills/
# ... for each existing target# Clone to temp
git clone https://github.com/user/skill-repo.git /tmp/skill-sync
# Copy skill folder (might be in subdirectory)
cp -r /tmp/skill-sync/skill-name ~/.claude/skills/
# ... for each existing target
# Cleanup
rm -rf /tmp/skill-sync# Fetch page content
curl -s https://skillsmp.com/skills/skill-name > /tmp/skill-page.html
# Parse and download skill files
# Extract skill content from page
# Create skill directory structure
# Copy to each targetsync-skill.sh# User says: "Sync the skill at /path/to/my-skill"
./sync-skill.sh /path/to/my-skill
# User says: "Sync this GitHub repo: https://github.com/user/skill"
./sync-skill.sh https://github.com/user/skillfunction detectSource(input) {
// Local folder
if (input.startsWith('/') || input.startsWith('./') || input.startsWith('~')) {
return { type: 'local', path: input };
}
// GitHub URL
if (input.includes('github.com')) {
const url = input.replace(/\.git$/, '');
return { type: 'github', url };
}
// skillsmp.com URL
if (input.includes('skillsmp.com')) {
return { type: 'skillsmp', url: input };
}
throw new Error(`Unknown source type: ${input}`);
}# Check if directory exists and collect for confirmation
check_and_sync() {
local source=$1
local skill_name=$2
# Array of all target directories
local targets=(
"$HOME/.claude/skills"
"$HOME/.qoder/skills"
"$HOME/.copilot/skills"
# ... all others
)
local existing_targets=()
# First pass: collect existing directories
for target in "${targets[@]}"; do
if [ -d "$target" ]; then
existing_targets+=("$target")
fi
done
# List existing targets and ask for confirmation
if [ ${#existing_targets[@]} -eq 0 ]; then
echo "❌ No target directories found. Please install at least one AI coding tool."
exit 1
fi
echo "📋 Found ${#existing_targets[@]} existing target directory(s):"
echo ""
for i in "${!existing_targets[@]}"; do
echo " $((i+1)). ${existing_targets[$i]}"
done
echo ""
read -p "✅ Sync to these directories? (y/N): " confirm
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
echo "❌ Sync cancelled by user."
exit 1
fi
echo ""
echo "🚀 Starting sync..."
# Second pass: sync to confirmed targets
for target in "${existing_targets[@]}"; do
echo " → Syncing to $target..."
# Perform sync
done
}# Clone to temp directory
git clone https://github.com/user/repo.git /tmp/skill-sync-XXXXX
# Find skill folder (might be root or subdirectory)
if [ -f /tmp/skill-sync-XXXXX/SKILL.md ]; then
skill_folder="/tmp/skill-sync-XXXXX"
elif [ -d /tmp/skill-sync-XXXXx/skills/* ]; then
skill_folder="/tmp/skill-sync-XXXXx/skills/*"
fi
# Copy to each existing target
for target in "${existing_targets[@]}"; do
cp -r "$skill_folder" "$target/"
done
# Cleanup
rm -rf /tmp/skill-sync-XXXXX# Fetch page
url="https://skillsmp.com/skills/skill-name"
curl -s "$url" > /tmp/skill-page.html
# Extract skill name and files
skill_name=$(grep -o '<h1[^>]*>.*</h1>' /tmp/skill-page.html | sed 's/<[^>]*>//g')
# Download or extract skill content
# This depends on skillsmp.com's structure
# Might need to parse JSON, download files, etc.
# Create skill directory
mkdir -p "/tmp/$skill_name"
# Save content to SKILL.md
# ... parsing logic ...
# Sync to targets
for target in "${existing_targets[@]}"; do
cp -r "/tmp/$skill_name" "$target/"
done| Mistake | Fix |
|---|---|
| Syncing without user confirmation | Always list targets and wait for |
| Syncing to non-existent directories | Always check |
| Leaving temp files | Always cleanup |
| GitHub subdirectory confusion | Check for SKILL.md in root and subdirectories |
| Not handling .git suffix | Strip |
| skillsmp.com parsing failures | Inspect page structure first, adapt parsing |
| Forgetting to show skill name | Always display skill name in confirmation prompt |
"Overwriting existing skill at $target/$skill_name"