Created
February 24, 2026 18:13
-
-
Save fubits1/7ec1009d905ac2434e3b60a4700aecab to your computer and use it in GitHub Desktop.
Claude Hook: Formatting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| INPUT=$(cat) | |
| FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path') | |
| # Run prettier on all supported files | |
| npx -y prettier --write "$FILE_PATH" >/dev/null 2>&1 | |
| # Additionally run markdownlint on .md files | |
| if [[ "$FILE_PATH" == *.md ]]; then | |
| npx -y markdownlint-cli2 --fix "$FILE_PATH" >/dev/null 2>&1 | |
| fi | |
| exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "hooks": { | |
| "PostToolUse": [ | |
| { | |
| "matcher": "Write|Edit", | |
| "hooks": [ | |
| { | |
| "type": "command", | |
| "command": "~/.claude/hooks/fix-formatting.sh" | |
| } | |
| ] | |
| } | |
| ] | |
| }, | |
| "enabledPlugins": { | |
| "svelte@svelte": true | |
| }, | |
| "effortLevel": "medium" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment