mirror of
https://github.com/obra/superpowers.git
synced 2026-04-16 19:08:18 +00:00
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:
@@ -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.
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -81,7 +81,7 @@ gh repo edit --add-topic superpowers
|
||||
|
||||
**Personal skills shadow core skills** - if you have `~/.config/superpowers/skills/testing/test-driven-development/SKILL.md`, it will be used instead of the core version.
|
||||
|
||||
The `list-skills` and `skills-search` tools automatically search both locations with deduplication.
|
||||
The `find-skills` tool automatically searches both locations with deduplication.
|
||||
|
||||
## Writing Skills
|
||||
|
||||
@@ -145,7 +145,7 @@ File a bug at https://github.com/obra/superpowers/issues
|
||||
**Personal skills not being found:**
|
||||
- Check `~/.config/superpowers/skills/` exists
|
||||
- Verify skill has `SKILL.md` file
|
||||
- Run `${CLAUDE_PLUGIN_ROOT}/skills/getting-started/list-skills` to see if it appears
|
||||
- Run `${CLAUDE_PLUGIN_ROOT}/scripts/find-skills` to see if it appears
|
||||
|
||||
**GitHub push failed:**
|
||||
- Check `gh auth status`
|
||||
|
||||
@@ -576,7 +576,7 @@ Deploying untested skills = deploying untested code. It's a violation of quality
|
||||
How future Claude finds your skill:
|
||||
|
||||
1. **Encounters problem** ("tests are flaky")
|
||||
2. **Searches skills** using `skills-search` tool (checks personal then core)
|
||||
2. **Searches skills** using `find-skills` tool (checks personal then core)
|
||||
3. **Finds SKILL.md** (rich when_to_use matches)
|
||||
4. **Scans overview** (is this relevant?)
|
||||
5. **Reads patterns** (quick reference table)
|
||||
|
||||
Reference in New Issue
Block a user