Add unified scripts system with find-skills and run

Consolidates skill discovery and adds generic runner for cross-platform compatibility.

Changes:
- Created scripts/find-skills: Unified tool (show all + filter by pattern)
  - Shows descriptions by default
  - Searches personal first, then core (shadowing)
  - Logs searches for gap analysis
  - Bash 3.2 compatible

- Created scripts/run: Generic runner for any skill script
  - Searches personal superpowers first, then core
  - Enables running arbitrary skill scripts without CLAUDE_PLUGIN_ROOT env var
  - Example: scripts/run skills/collaboration/remembering-conversations/tool/search-conversations

- Fixed bash 3.2 compatibility in list-skills, skills-search
  - Replaced associative arrays with newline-delimited lists
  - Works on macOS default bash (3.2) and Linux bash 4+

- Updated all documentation to reference scripts/find-skills
- Removed redundant wrapper scripts

This solves the CLAUDE_PLUGIN_ROOT environment variable issue - scripts
can now be called from anywhere without needing the env var set.
This commit is contained in:
Jesse Vincent
2025-10-10 20:37:04 -07:00
parent c023e803ac
commit 16b764689a
8 changed files with 234 additions and 28 deletions

View File

@@ -17,7 +17,7 @@ Personal skills shadow core skills when names match.
**RIGHT NOW**: Run this to see what skills are available:
```bash
${CLAUDE_PLUGIN_ROOT}/skills/getting-started/list-skills
${CLAUDE_PLUGIN_ROOT}/scripts/find-skills
```
**THEN**: Follow the workflows below based on what your partner is asking for.
@@ -51,17 +51,13 @@ ${CLAUDE_PLUGIN_ROOT}/skills/getting-started/list-skills
## Mandatory Workflow 2: Before ANY Task
**1. List available skills** (to avoid useless searches):
**1. Find skills** (shows all, or filter by pattern):
```bash
${CLAUDE_PLUGIN_ROOT}/skills/getting-started/list-skills
${CLAUDE_PLUGIN_ROOT}/scripts/find-skills # Show all
${CLAUDE_PLUGIN_ROOT}/scripts/find-skills PATTERN # Filter by pattern
```
**2. Search skills** (when you need something specific):
```bash
${CLAUDE_PLUGIN_ROOT}/skills/getting-started/skills-search PATTERN
```
**3. Search conversations:**
**2. Search conversations:**
Dispatch subagent (see Workflow 3) to check for relevant past work.
**If skills found:**
@@ -186,7 +182,7 @@ Your human partner's specific instructions describe WHAT to do, not HOW.
**Starting conversation?** You just read this. Good.
**Starting any task?** Run skills-search first, announce usage, follow what you find.
**Starting any task?** Run find-skills first, announce usage, follow what you find.
**Skill has checklist?** TodoWrite for every item.

View File

@@ -19,8 +19,8 @@ fi
PERSONAL_SUPERPOWERS_DIR="${PERSONAL_SUPERPOWERS_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/superpowers}"
PERSONAL_SKILLS_DIR="${PERSONAL_SUPERPOWERS_DIR}/skills"
# Collect all skill paths with deduplication
declare -A seen_skills
# Collect all skill paths with deduplication (bash 3.2 compatible)
seen_skills_list=""
all_skills=()
# Personal skills first (take precedence)
@@ -29,7 +29,7 @@ if [[ -d "$PERSONAL_SKILLS_DIR" ]]; then
skill_path="${file#$PERSONAL_SKILLS_DIR/}"
skill_path="${skill_path%/SKILL.md}"
if [[ -n "$skill_path" ]]; then
seen_skills["$skill_path"]=1
seen_skills_list="${seen_skills_list}${skill_path}"$'\n'
all_skills+=("$skill_path")
fi
done < <(find "$PERSONAL_SKILLS_DIR" -name "SKILL.md" -type f 2>/dev/null || true)
@@ -39,7 +39,9 @@ fi
while IFS= read -r file; do
skill_path="${file#$CORE_SKILLS_DIR/}"
skill_path="${skill_path%/SKILL.md}"
if [[ -n "$skill_path" ]] && [[ -z "${seen_skills[$skill_path]:-}" ]]; then
if [[ -n "$skill_path" ]]; then
# Skip if already seen in personal skills
echo "$seen_skills_list" | grep -q "^${skill_path}$" && continue
all_skills+=("$skill_path")
fi
done < <(find "$CORE_SKILLS_DIR" -name "SKILL.md" -type f 2>/dev/null || true)

View File

@@ -69,8 +69,8 @@ path_matches_core=$(echo "$all_skills_core" | grep -E "$@" 2>/dev/null || true)
# Combine all matches
all_matches=$(printf "%s\n%s\n%s\n%s" "$content_matches_personal" "$content_matches_core" "$path_matches_personal" "$path_matches_core" | grep -v '^$' || true)
# Deduplicate by skill path (personal shadows core)
declare -A seen_skills
# Deduplicate by skill path (personal shadows core) - bash 3.2 compatible
seen_skills_list=""
results=""
while IFS= read -r file; do
# Extract skill path relative to its base directory
@@ -82,8 +82,8 @@ while IFS= read -r file; do
skill_path="${skill_path%/SKILL.md}"
# Only include if we haven't seen this skill path yet
if [[ -z "${seen_skills[$skill_path]:-}" ]]; then
seen_skills["$skill_path"]=1
if ! echo "$seen_skills_list" | grep -q "^${skill_path}$"; then
seen_skills_list="${seen_skills_list}${skill_path}"$'\n'
results="${results}${file}"$'\n'
fi
done <<< "$all_matches"