#!/usr/bin/env bash
# list-skills - Show all available skill names without descriptions
# For Claude to quickly see what exists before searching

set -euo pipefail

# Detect if running from repo or installed location
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [[ "$SCRIPT_DIR" == *"/.claude/plugins/cache/"* ]]; then
    # Installed as plugin
    SKILLS_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
else
    # Running from repo
    SKILLS_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
fi

# Find all SKILL.md files and extract their paths
find "$SKILLS_DIR" -name "SKILL.md" -type f | \
    sed "s|$SKILLS_DIR/||; s|/SKILL.md||" | \
    sort

exit 0
