Files
claude-foundations/memory/gotchas-skills.md
Paul O'Reilly 0c068ffd8b Reflect 2 session logs into topic memory files
Updated: gotchas-skills.md (+$VAR paths, $() subshells, relative path
resolution), decisions.md (+CLAUDE_PROJECT_ROOT, settings.yaml relative
paths), process-lessons.md (+research history before building validators).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 11:22:35 +13:00

2.2 KiB

Skills Gotchas

Symptom: install.sh fails with exit 1 on a broken symlink. Cause: readlink -f on a broken symlink returns an empty string, causing comparison failure under set -e. Fix: Remove stale symlinks before re-running install. When skills move directories (e.g., from ~/dev/claude/custom-claude-skills/ to ~/dev/claude/projects/custom-claude-skills/), old symlinks break.

$VAR and ${VAR} in bang-command paths rejected by permission checker

Symptom: Skill fails with "Shell expansion syntax in paths requires manual approval" on cat $HOME/dev/claude/... or cat ${HOME}/.... Cause: Claude Code's Bash permission checker rejects any $VAR or ${VAR} expansion in file path arguments, even if the outer command matches an allowed-tools pattern. Fix: Replace bang-commands that need dynamic paths with plain-text instructions telling Claude to use the Read tool at runtime. The Read tool bypasses the shell permission checker entirely.

$() command substitution in bang-commands is rejected

Symptom: Bang-command like git log --since="$(git log ...)" fails even though Bash(git *) is in allowed-tools. Cause: The permission checker rejects any command containing $() subshells regardless of the outer pattern match. Fix: Keep bang-commands simple. If complex logic is needed, have the skill instructions tell Claude to run it via tool calls instead.

Relative paths in bang-commands resolve differently based on CWD

Symptom: cat ../claude-foundations/settings.yaml resolves to the wrong path (outside sandbox) when skill is invoked from an unexpected CWD. Fix: Use CLAUDE_PROJECT_ROOT env var instead of relative paths. Env var expansion (without $) isn't rejected by the permission checker when used in the SKILL.md body instructions rather than bang-commands.

Skills created mid-session are not available as slash commands

Symptom: A newly created skill doesn't appear when you type /skillname. Cause: Skills are discovered at session start, not dynamically during the session. Fix: Start a new Claude Code session to pick up newly created skills.