From 5a59d463de1e8f9d687ff90deacad2b66fb116e8 Mon Sep 17 00:00:00 2001 From: Paul O'Reilly Date: Tue, 17 Mar 2026 11:15:45 +1300 Subject: [PATCH] Fix skill frontmatter and simplify distill skill instructions Replace non-ASCII characters in log and distill-best-practices frontmatter that silently prevented skill loading. Simplify distill skill instructions. Update install.sh for new skills. Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/install.sh | 8 ++-- skills/distill-best-practices/SKILL.md | 59 +++++++++----------------- skills/log/SKILL.md | 4 +- skills/reflect-logs/SKILL.md | 2 +- 4 files changed, 29 insertions(+), 44 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 048828a..7ad9723 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,13 +1,15 @@ #!/usr/bin/env bash set -euo pipefail -# Symlink all skills from this repo into ~/.claude/skills/ (personal scope) -# so they're available across all Claude Code projects. +# Symlink all skills from this repo into the active Claude profile's skills/ +# directory so they're available across all Claude Code projects. +# +# Uses CLAUDE_CONFIG_DIR if set (active profile), otherwise falls back to ~/.claude. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO_DIR="$(dirname "$SCRIPT_DIR")" SKILLS_SRC="$REPO_DIR/skills" -SKILLS_DST="$HOME/.claude/skills" +SKILLS_DST="${CLAUDE_CONFIG_DIR:-$HOME/.claude}/skills" GREEN='\033[0;32m' YELLOW='\033[1;33m' diff --git a/skills/distill-best-practices/SKILL.md b/skills/distill-best-practices/SKILL.md index cb410da..363b425 100644 --- a/skills/distill-best-practices/SKILL.md +++ b/skills/distill-best-practices/SKILL.md @@ -3,7 +3,7 @@ name: distill-best-practices description: > Cross-project best practices distillation. Reads changed memory files from all tracked projects and proposes additions, updates, or removals to claude-foundations/best-practices/. - Run from any project — always targets claude-foundations as output. Interactive — presents + Run from any project -- always targets claude-foundations as output. Interactive -- presents proposals for approval before making changes. allowed-tools: Read, Edit, Write, Glob, Grep, Bash(git -C *), Bash(git rev-parse *), Bash(ls *), Bash(cat *), Bash(head *), Bash(date *) --- @@ -14,47 +14,30 @@ You are extracting generalisable best practices from project-specific memory fil ## Pre-gathered context -### CLAUDE_PROJECT_ROOT -!`test -n "$CLAUDE_PROJECT_ROOT" && echo "$CLAUDE_PROJECT_ROOT" || echo "NOT_SET"` - -### Distill state -!`cat $CLAUDE_PROJECT_ROOT/projects/claude-foundations/best-practices/.distill-state.json 2>/dev/null || echo "{}"` - -### Settings -!`cat $CLAUDE_PROJECT_ROOT/projects/claude-foundations/settings.yaml 2>/dev/null || echo "Settings not found — CLAUDE_PROJECT_ROOT may not be set"` - -### Current best-practices index -!`cat $CLAUDE_PROJECT_ROOT/projects/claude-foundations/BESTPRACTICES.md 2>/dev/null || echo "Index not found"` - -### Available best-practices files -!`ls -1 $CLAUDE_PROJECT_ROOT/projects/claude-foundations/best-practices/ 2>/dev/null || echo "No best-practices directory"` - -### Projects directory listing -!`ls -1d $CLAUDE_PROJECT_ROOT/projects/*/ 2>/dev/null || echo "No projects directory"` +### Pre-gathered context (read at runtime) +The following files should be read using the Read tool at the start of execution: +- `~/dev/claude/projects/claude-foundations/best-practices/.distill-state.json` — Distill state (if not found, treat as `{}`) +- `~/dev/claude/projects/claude-foundations/settings.yaml` — Settings (if not found, use defaults from instructions) +- `~/dev/claude/projects/claude-foundations/BESTPRACTICES.md` — Current best-practices index +- Use Glob to list `~/dev/claude/projects/claude-foundations/best-practices/*.md` for available topic files +- Use Glob to list `~/dev/claude/projects/*/` for the projects directory listing ## Instructions -### Step 0: Detect project root - -Check the pre-gathered `CLAUDE_PROJECT_ROOT` value above. If it shows `NOT_SET` or the pre-gathered context is missing: - -1. Walk up from the current working directory to find the **highest** parent directory containing a `CLAUDE.md` file — that is the project root. -2. Use that path as `PROJECT_ROOT` for all subsequent steps. - -If `CLAUDE_PROJECT_ROOT` was set, use that value as `PROJECT_ROOT`. - -The key paths derived from the root: -- **Settings**: `/projects/claude-foundations/settings.yaml` -- **Best practices dir**: `/projects/claude-foundations/best-practices/` -- **Best practices index**: `/projects/claude-foundations/BESTPRACTICES.md` -- **Distill state**: `/projects/claude-foundations/best-practices/.distill-state.json` - ### Step 1: Discover changes per project -Read `settings.yaml` (pre-gathered above, or read it now if Step 0 detected the root manually). +The project root is `~/dev/claude` (hardcoded — change at the top of the `!`command`` blocks if your layout differs). -For each project in `distill.projects`, get its path: `//`. -Also process any `distill.extra_projects` entries — these have a `path` field relative to `PROJECT_ROOT`. +Key paths: +- **Settings**: `~/dev/claude/projects/claude-foundations/settings.yaml` +- **Best practices dir**: `~/dev/claude/projects/claude-foundations/best-practices/` +- **Best practices index**: `~/dev/claude/projects/claude-foundations/BESTPRACTICES.md` +- **Distill state**: `~/dev/claude/projects/claude-foundations/best-practices/.distill-state.json` + +Read `settings.yaml` (pre-gathered above). + +For each project in `distill.projects`, get its path: `~/dev/claude//`. +Also process any `distill.extra_projects` entries — these have a `path` field relative to `~/dev/claude`. For each project (from both lists): @@ -126,11 +109,11 @@ For each approved proposal: If a new best-practices topic file is needed: - Create it following the format of existing files (top-level heading, subheadings per entry, 2-6 lines per entry) -- Add it to `/projects/claude-foundations/BESTPRACTICES.md` with a one-line description +- Add it to `~/dev/claude/projects/claude-foundations/BESTPRACTICES.md` with a one-line description ### Step 6: Update distill state -Write `/projects/claude-foundations/best-practices/.distill-state.json`: +Write `~/dev/claude/projects/claude-foundations/best-practices/.distill-state.json`: ```json { diff --git a/skills/log/SKILL.md b/skills/log/SKILL.md index 9104179..85ceba5 100644 --- a/skills/log/SKILL.md +++ b/skills/log/SKILL.md @@ -3,7 +3,7 @@ name: log description: > End-of-session logging. Captures key decisions, gotchas, open questions, and discussion points into memory/log/ for later reflection. Run before ending a session to preserve - context. Fast and low-friction — just run /log. + context. Fast and low-friction -- just run /log. allowed-tools: Read, Write, Glob, Bash(date *), Bash(ls *), Bash(cat *), Bash(find *), Bash(rm *), Bash(mkdir *) --- @@ -21,7 +21,7 @@ You are capturing key points from the current session into a structured log file !`ls -1 memory/log/ 2>/dev/null || echo "No log directory yet"` ### Settings -!`cat settings.yaml 2>/dev/null || cat $CLAUDE_PROJECT_ROOT/projects/claude-foundations/settings.yaml 2>/dev/null || echo "No settings file found — using defaults: retention_days=7, warn_unreflected_days=14"` +(Read `~/dev/claude/projects/claude-foundations/settings.yaml` using the Read tool. If not found, use defaults: retention_days=7, warn_unreflected_days=14) ### Reflection state (to check what has been reflected) !`cat .reflection-state.json 2>/dev/null || echo "No reflection state yet"` diff --git a/skills/reflect-logs/SKILL.md b/skills/reflect-logs/SKILL.md index e3c80fe..19b2312 100644 --- a/skills/reflect-logs/SKILL.md +++ b/skills/reflect-logs/SKILL.md @@ -26,7 +26,7 @@ You are processing session logs into structured, topic-based memory files. !`ls -1 memory/ 2>/dev/null || echo "No memory directory"` ### Settings -!`cat settings.yaml 2>/dev/null || cat $CLAUDE_PROJECT_ROOT/projects/claude-foundations/settings.yaml 2>/dev/null || echo "No settings file found — using defaults: max_logs_per_run=10, retention_days=7, warn_unreflected_days=14"` +(Read `~/dev/claude/projects/claude-foundations/settings.yaml` using the Read tool. If not found, use defaults: max_logs_per_run=10, retention_days=7, warn_unreflected_days=14) ### Recent git log (for staleness detection) !`git log --oneline -30 2>/dev/null || echo "Not a git repo"`