Files
AI_template/.claude/hooks/config-protection.sh
olekhondera db5ba04fb9 feat: expand agents (10), skills (20), and hooks (11) with profile system
Agents:
- Add YAML frontmatter (model, tools) to all 7 existing agents
- New agents: planner (opus), build-error-resolver (sonnet), loop-operator (sonnet)

Skills:
- search-first: research before building (Adopt/Extend/Compose/Build)
- verification-loop: full quality gate pipeline (Build→TypeCheck→Lint→Test→Security→Diff)
- strategic-compact: when and how to run /compact effectively
- autonomous-loops: 6 patterns for autonomous agent workflows
- continuous-learning: extract session learnings into instincts

Hooks:
- Profile system (minimal/standard/strict) via run-with-profile.sh
- config-protection: block linter/formatter config edits (standard)
- suggest-compact: remind about /compact every ~50 tool calls (standard)
- auto-tmux-dev: suggest tmux for dev servers (standard)
- session-save/session-load: persist and restore session context (Stop/SessionStart)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 20:16:20 +02:00

44 lines
1012 B
Bash
Executable File

#!/bin/bash
# Block modifications to linter/formatter configuration files
# Event: PreToolUse | Matcher: Edit|Write
# Profile: standard
# Exit 2 = block, Exit 0 = allow
INPUT=$(cat)
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
if [ -z "$FILE_PATH" ]; then
exit 0
fi
# Protected config files (linters, formatters, build configs)
PROTECTED_CONFIGS=(
".eslintrc"
".eslintrc.js"
".eslintrc.json"
".eslintrc.yml"
"eslint.config.js"
"eslint.config.mjs"
".prettierrc"
".prettierrc.js"
".prettierrc.json"
"prettier.config.js"
"biome.json"
"biome.jsonc"
".editorconfig"
"tsconfig.json"
"tsconfig.base.json"
)
FILENAME=$(basename "$FILE_PATH")
for config in "${PROTECTED_CONFIGS[@]}"; do
if [ "$FILENAME" = "$config" ]; then
echo "Blocked: modifying config file '$FILENAME'. These files affect the entire project." >&2
echo "If this change is intentional, disable this hook: CLAUDE_DISABLED_HOOKS=config-protection.sh" >&2
exit 2
fi
done
exit 0