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
713 B
JSON
16 lines
713 B
JSON
{
|
|
"description": "Automatically format JavaScript/TypeScript files after any Edit operation using prettier. This hook runs 'npx prettier --write' on any .js, .ts, .jsx, or .tsx file that Claude modifies, ensuring consistent code formatting. Uses npx so prettier doesn't need to be globally installed. Includes error suppression so it won't fail if prettier is not available.",
|
|
"hooks": {
|
|
"PostToolUse": [
|
|
{
|
|
"matcher": "Edit",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "if [[ \"$CLAUDE_TOOL_FILE_PATH\" =~ \\.(js|ts|jsx|tsx)$ ]]; then npx prettier --write \"$CLAUDE_TOOL_FILE_PATH\" 2>/dev/null || true; fi"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
} |