mirror of
https://github.com/davila7/claude-code-templates.git
synced 2026-09-19 01:30:23 +08:00
e5177fbe27
✅ Fixed ALL remaining hooks (20 total): - Updated post-tool/ and pre-tool/ hooks to Claude Code array format - Fixed git-add-changes, format-javascript-files, format-python-files, run-tests-after-changes - Fixed backup-before-edit, notify-before-bash 🧠 Added AI Hook Specification System: - CLAUDE_HOOK_SPECIFICATION.md - Complete hook format guide for AI - AI_HOOK_TEMPLATE.json - Structured template with examples for AI parsing - HOOK_PATTERNS_COMPRESSED.json - Compressed patterns for rapid AI reference 📊 Technical Improvements: - All 20 hooks now use proper array/matcher structure - Regenerated components.json with corrected hook metadata - Added comprehensive validation rules and anti-patterns - Included environment variables and cross-platform compatibility guides 🎯 AI Context Enhancement: - Future Claude Code sessions can reference these files for correct hook generation - Compressed format optimizes AI parsing while maintaining completeness - Common patterns and validation rules prevent structure errors 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
16 lines
672 B
JSON
16 lines
672 B
JSON
{
|
|
"description": "Automatically format Python files after any Edit operation using black formatter. This hook runs 'black' on any .py file that Claude modifies, ensuring consistent Python code formatting. Requires black to be installed ('pip install black'). The command includes error suppression (2>/dev/null || true) so it won't fail if black is not installed.",
|
|
"hooks": {
|
|
"PostToolUse": [
|
|
{
|
|
"matcher": "Edit",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "if [[ \"$CLAUDE_TOOL_FILE_PATH\" == *.py ]]; then black \"$CLAUDE_TOOL_FILE_PATH\" 2>/dev/null || true; fi"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
} |