Includes: spec-driven and test-driven development best practices, reproduce-before-fixing debugging workflow, require-plan-file hook, find-project-root script, session logs, memory files for decisions/ gotchas/process-lessons, and updates to existing best practice topics. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
53 lines
1.5 KiB
Bash
Executable File
53 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Symlink all hooks from claude-foundations/hooks/ into ~/.claude/hooks/
|
|
# and print the settings.json configuration to add.
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
HOOKS_SRC="$(cd "$SCRIPT_DIR/../hooks" && pwd)"
|
|
HOOKS_DST="$HOME/.claude/hooks"
|
|
|
|
mkdir -p "$HOOKS_DST"
|
|
|
|
echo "Installing hooks from $HOOKS_SRC → $HOOKS_DST"
|
|
echo ""
|
|
|
|
for HOOK in "$HOOKS_SRC"/*.sh; do
|
|
NAME="$(basename "$HOOK")"
|
|
ln -sf "$HOOK" "$HOOKS_DST/$NAME"
|
|
echo " ✓ $NAME"
|
|
done
|
|
|
|
echo ""
|
|
echo "Hooks symlinked. Ensure your ~/.claude/settings.json includes:"
|
|
echo ""
|
|
cat <<'EOF'
|
|
{
|
|
"hooks": {
|
|
"PreCompact": [
|
|
{
|
|
"matcher": "auto",
|
|
"hooks": [{ "type": "command", "command": "~/.claude/hooks/pre-compact-backup.sh", "timeout": 15, "statusMessage": "Backing up transcript before compaction..." }]
|
|
},
|
|
{
|
|
"matcher": "manual",
|
|
"hooks": [{ "type": "command", "command": "~/.claude/hooks/pre-compact-backup.sh", "timeout": 15, "statusMessage": "Backing up transcript before compaction..." }]
|
|
}
|
|
],
|
|
"PostToolUse": [
|
|
{
|
|
"matcher": "Edit|Write|MultiEdit",
|
|
"hooks": [{ "type": "command", "command": "~/.claude/hooks/post-edit-lint.sh", "timeout": 30, "statusMessage": "Formatting and linting..." }]
|
|
}
|
|
],
|
|
"PreToolUse": [
|
|
{
|
|
"matcher": "ExitPlanMode",
|
|
"hooks": [{ "type": "command", "command": "~/.claude/hooks/require-plan-file.sh" }]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
EOF
|