Repository navigation
Expand file tree
/
Copy pathsettings-examples.json
More file actions
114 lines (114 loc) · 3.48 KB
/
Copy pathsettings-examples.json
File metadata and controls
114 lines (114 loc) · 3.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
{
"_comment": "Example .claude/settings.json wiring all 10 hook scripts. Copy to your project's .claude/settings.json and adjust paths. Scripts are referenced via $CLAUDE_PROJECT_DIR so the hook works from any subdirectory.",
"hooks": {
"PreToolUse": [
{
"_comment": "Block edits to .env, lock files, .git/, and paths containing 'secret' or 'credential'.",
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/hooks/scripts/protect-files.sh"
}
]
},
{
"_comment": "Block dangerous shell commands: rm -rf /, DROP TABLE, force-push to main, curl|bash.",
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/hooks/scripts/block-dangerous-commands.sh"
}
]
},
{
"_comment": "Block SQL mutation statements (INSERT, UPDATE, DELETE, DROP, CREATE, ALTER, TRUNCATE). Allows SELECT.",
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/hooks/scripts/validate-sql.sh"
}
]
}
],
"PostToolUse": [
{
"_comment": "Auto-format edited files: prettier (.ts/.js), black (.py), gofmt (.go), rubocop (.rb).",
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/hooks/scripts/auto-format.sh"
}
]
},
{
"_comment": "Run linter on edited files: ESLint (.ts/.js/.tsx/.jsx), ruff (.py), rubocop (.rb). Non-blocking.",
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/hooks/scripts/lint-on-save.sh"
}
]
},
{
"_comment": "Log every tool use (tool name, file path, command) as a JSON line to ~/.claude/tool-usage.log.",
"matcher": "",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/hooks/scripts/log-tool-usage.sh"
}
]
},
{
"_comment": "Find and run a related test file after a source file is edited. Non-blocking.",
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/hooks/scripts/test-after-edit.sh"
}
]
}
],
"Notification": [
{
"_comment": "Send a native desktop notification. Cross-platform: macOS, Linux, Windows.",
"matcher": "",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/hooks/scripts/notify-desktop.sh"
}
]
}
],
"SessionStart": [
{
"_comment": "After context compaction, re-inject git branch, recent commits, and a project reminder.",
"matcher": "compact",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/hooks/scripts/inject-context.sh"
}
]
}
],
"Stop": [
{
"_comment": "Before Claude finishes, check for uncommitted changes and ask it to commit them.",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/hooks/scripts/stop-check.sh"
}
]
}
]
}
}