We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 122182d commit 3d59ddeCopy full SHA for 3d59dde
2 files changed
.claude/hooks/post-edit-format.sh
@@ -0,0 +1,20 @@
1
+#!/bin/bash
2
+# PostToolUse hook - auto-formats files after Claude edits them
3
+
4
+input=$(cat)
5
+file_path=$(echo "$input" | jq -r '.tool_input.file_path // empty')
6
7
+if [[ -z "$file_path" ]]; then exit 0; fi
8
9
+case "$file_path" in
10
+ *.ts|*.svelte|*.js|*.css)
11
+ cd "$(dirname "$0")/../.." && pnpm exec prettier --write "$file_path" 2>/dev/null
12
+ ;;
13
+ *.rs)
14
+ rustfmt "$file_path" 2>/dev/null
15
16
+ *.go)
17
+ gofmt -w "$file_path" 2>/dev/null
18
19
+esac
20
+exit 0
.claude/settings.json
@@ -15,6 +15,17 @@
}
]
+ ],
+ "PostToolUse": [
+ {
21
+ "matcher": "Edit|Write",
22
+ "hooks": [
23
24
+ "type": "command",
25
+ "command": ".claude/hooks/post-edit-format.sh"
26
+ }
27
+ ]
28
29
30
31
0 commit comments