# Installation Workflow for Claude Skills Complete guide to previewing, downloading, and installing Claude skills from GitHub. ## Installation Process Overview 1. **Preview** - Show skill details and requirements 2. **Confirm** - Get user approval 3. **Download** - Fetch skill files from GitHub 4. **Install** - Place in correct directory structure 5. **Verify** - Confirm installation success 6. **Setup** - Run any required setup steps ## Step 1: Preview Skill ### Fetch SKILL.md Content ```bash # Get direct link to SKILL.md skill_url="https://github.com/OWNER/REPO/blob/main/PATH/SKILL.md" skill_path="PATH/SKILL.md" # Fetch content (first 50 lines for preview) gh api repos/OWNER/REPO/contents/$skill_path | \ jq -r '.content' | base64 -d | head -50 ``` ### Extract Key Information ```bash # Parse SKILL.md for important details skill_content=$(gh api repos/OWNER/REPO/contents/$skill_path | jq -r '.content' | base64 -d) # Extract name (first # heading) skill_name=$(echo "$skill_content" | grep -m1 '^# ' | sed 's/^# //') # Extract description (first paragraph after title) description=$(echo "$skill_content" | sed -n '/^# /,/^$/p' | grep -v '^#' | head -1) # Extract dependencies dependencies=$(echo "$skill_content" | grep -A10 -i "dependencies\|requirements\|prerequisites" | head -10) # Extract usage examples examples=$(echo "$skill_content" | grep -A10 -i "usage\|example\|quick start" | head -15) ``` ### Display Preview ```bash cat < "$dest_dir/SKILL.md" if [ -f "$dest_dir/SKILL.md" ]; then echo "✅ Downloaded SKILL.md" else echo "❌ Failed to download SKILL.md" return 1 fi } ``` ### Download Standard Skill (with references) ```bash download_standard_skill() { local repo=$1 local skill_path=$2 local dest_dir=$3 echo "📥 Downloading standard skill..." # Get skill directory path from SKILL.md path skill_dir_path=$(dirname "$skill_path") # Get all files in skill directory gh api "repos/$repo/contents/$skill_dir_path?recursive=1" | \ jq -r '.tree[] | select(.type == "blob") | .path' | \ while read file_path; do # Calculate relative path rel_path=${file_path#$skill_dir_path/} dest_file="$dest_dir/$rel_path" # Create subdirectories mkdir -p "$(dirname "$dest_file")" # Download file gh api "repos/$repo/contents/$file_path" | \ jq -r '.content' | base64 -d > "$dest_file" echo " ✓ $rel_path" done echo "✅ Downloaded all skill files" } ``` ### Download Plugin Skill (nested structure) ```bash download_plugin_skill() { local repo=$1 local skill_path=$2 local dest_dir=$3 echo "📥 Downloading plugin skill..." echo " (This may take a moment...)" # Clone repository to temporary location temp_dir=$(mktemp -d) gh repo clone "$repo" "$temp_dir" -- --depth 1 --quiet # Extract skill directory from SKILL.md path # Example: skills/playwright-skill/SKILL.md -> skills/playwright-skill skill_subdir=$(dirname "$skill_path") # Copy skill directory to destination if [ -d "$temp_dir/$skill_subdir" ]; then cp -r "$temp_dir/$skill_subdir/"* "$dest_dir/" echo "✅ Copied skill from $skill_subdir" else echo "❌ Skill directory not found: $skill_subdir" rm -rf "$temp_dir" return 1 fi # Cleanup rm -rf "$temp_dir" } ``` ### Download Complex Skill (with setup) ```bash download_complex_skill() { local repo=$1 local skill_path=$2 local dest_dir=$3 echo "📥 Downloading complex skill..." # Use plugin download method download_plugin_skill "$repo" "$skill_path" "$dest_dir" # Check for dependencies if [ -f "$dest_dir/package.json" ]; then echo "" echo "📦 This skill has npm dependencies." echo " Run: cd $dest_dir && npm install" fi if [ -f "$dest_dir/requirements.txt" ]; then echo "" echo "🐍 This skill has Python dependencies." echo " Run: cd $dest_dir && pip install -r requirements.txt" fi if [ -f "$dest_dir/setup.sh" ]; then echo "" echo "🔧 This skill has a setup script." read -p " Run setup.sh now? [y/N]: " run_setup if [[ "$run_setup" =~ ^[Yy] ]]; then (cd "$dest_dir" && bash setup.sh) fi fi } ``` ## Step 4: Verify Installation ### Check Required Files ```bash verify_installation() { local skill_dir=$1 local errors=0 echo "" echo "🔍 Verifying installation..." # Check SKILL.md exists if [ ! -f "$skill_dir/SKILL.md" ]; then echo " ❌ Missing SKILL.md" ((errors++)) else echo " ✅ SKILL.md present" fi # Check file permissions if [ ! -r "$skill_dir/SKILL.md" ]; then echo " ❌ SKILL.md not readable" ((errors++)) else echo " ✅ File permissions OK" fi # Check for reference files (optional but good) if [ -d "$skill_dir/references" ]; then ref_count=$(find "$skill_dir/references" -type f | wc -l) echo " ✅ Found $ref_count reference files" fi # Check for examples (optional) if [ -d "$skill_dir/examples" ]; then example_count=$(find "$skill_dir/examples" -type f | wc -l) echo " ✅ Found $example_count example files" fi return $errors } ``` ### Validate SKILL.md Content ```bash validate_skill_content() { local skill_file=$1 # Check for required sections local has_title=$(grep -q '^# ' "$skill_file" && echo "yes" || echo "no") local has_description=$(grep -qi 'description\|what.*does' "$skill_file" && echo "yes" || echo "no") local has_usage=$(grep -qi 'usage\|example\|how.*use' "$skill_file" && echo "yes" || echo "no") if [ "$has_title" = "yes" ] && [ "$has_description" = "yes" ]; then echo " ✅ SKILL.md structure valid" return 0 else echo " ⚠️ SKILL.md may be incomplete (missing title or description)" return 1 fi } ``` ## Step 5: Post-Installation ### Run Setup Scripts ```bash # Check for and run setup if [ -f "$skill_dir/setup.sh" ]; then echo "" echo "🔧 Running setup script..." (cd "$skill_dir" && bash setup.sh) if [ $? -eq 0 ]; then echo "✅ Setup completed successfully" else echo "⚠️ Setup script had warnings (check above)" fi fi ``` ### Install Dependencies ```bash # npm dependencies if [ -f "$skill_dir/package.json" ]; then echo "" echo "📦 Installing npm dependencies..." (cd "$skill_dir" && npm install --silent) echo "✅ npm dependencies installed" fi # Python dependencies if [ -f "$skill_dir/requirements.txt" ]; then echo "" echo "🐍 Installing Python dependencies..." pip install -q -r "$skill_dir/requirements.txt" echo "✅ Python dependencies installed" fi ``` ### Create Usage Instructions ```bash cat < "$skill_dir/SKILL.md" fi # 6. Verify if [ -f "$skill_dir/SKILL.md" ]; then echo "✅ Installation successful!" echo "📁 Location: $skill_dir" echo "🚀 Use: /$skill_dir_name" else echo "❌ Installation failed" return 1 fi } # Usage: # install_skill "lackeyjb/playwright-skill" "skills/playwright-skill/SKILL.md" "playwright-skill" ``` ## Error Handling ### Common Issues **Issue: Repository not found** ```bash if ! gh api "repos/$repo" &>/dev/null; then echo "❌ Repository not found or not accessible: $repo" echo " Check if the repository exists and is public" exit 1 fi ``` **Issue: SKILL.md not found** ```bash if ! gh api "repos/$repo/contents/$skill_path" &>/dev/null; then echo "❌ SKILL.md not found at: $skill_path" echo " Searching for SKILL.md in repository..." # Try to find it found_paths=$(gh api "repos/$repo/git/trees/main?recursive=1" | \ jq -r '.tree[] | select(.path | contains("SKILL.md")) | .path') if [ -n "$found_paths" ]; then echo " Found SKILL.md at:" echo "$found_paths" | sed 's/^/ /' else echo " No SKILL.md found in repository" fi exit 1 fi ``` **Issue: Permission denied** ```bash if [ ! -w ".claude/skills" ]; then echo "❌ Cannot write to .claude/skills directory" echo " Check permissions: ls -la .claude/skills" exit 1 fi ``` **Issue: Network/API error** ```bash if ! ping -c 1 api.github.com &>/dev/null; then echo "❌ Cannot reach GitHub API" echo " Check your internet connection" exit 1 fi ``` --- **Summary:** The installation workflow ensures safe, verified installation of Claude skills with proper error handling, user confirmation, and post-installation setup.