@yeongjaeyou/claude-code-config 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/code-review-handler.md +203 -0
- package/.claude/agents/issue-resolver.md +123 -0
- package/.claude/agents/python-pro.md +7 -2
- package/.claude/agents/web-researcher.md +5 -1
- package/.claude/commands/ask-deepwiki.md +46 -11
- package/.claude/commands/council.md +144 -36
- package/.claude/commands/gh/auto-review-loop.md +201 -0
- package/.claude/commands/gh/create-issue-label.md +4 -0
- package/.claude/commands/gh/decompose-issue.md +24 -2
- package/.claude/commands/gh/post-merge.md +52 -10
- package/.claude/commands/gh/resolve-and-review.md +69 -0
- package/.claude/commands/gh/resolve-issue.md +3 -0
- package/.claude/commands/tm/convert-prd.md +4 -0
- package/.claude/commands/tm/post-merge.md +7 -1
- package/.claude/commands/tm/resolve-issue.md +4 -0
- package/.claude/commands/tm/sync-to-github.md +4 -0
- package/.claude/settings.json +15 -0
- package/.claude/skills/claude-md-generator/SKILL.md +130 -0
- package/.claude/skills/claude-md-generator/references/examples.md +261 -0
- package/.claude/skills/claude-md-generator/references/templates.md +156 -0
- package/.claude/skills/hook-creator/SKILL.md +88 -0
- package/.claude/skills/hook-creator/references/examples.md +339 -0
- package/.claude/skills/hook-creator/references/hook-events.md +193 -0
- package/.claude/skills/skill-creator/SKILL.md +160 -13
- package/.claude/skills/skill-creator/references/output-patterns.md +82 -0
- package/.claude/skills/skill-creator/references/workflows.md +28 -0
- package/.claude/skills/skill-creator/scripts/package_skill.py +10 -10
- package/.claude/skills/skill-creator/scripts/quick_validate.py +45 -15
- package/.claude/skills/slash-command-creator/SKILL.md +108 -0
- package/.claude/skills/slash-command-creator/references/examples.md +161 -0
- package/.claude/skills/slash-command-creator/references/frontmatter.md +74 -0
- package/.claude/skills/slash-command-creator/scripts/init_command.py +221 -0
- package/.claude/skills/subagent-creator/SKILL.md +127 -0
- package/.claude/skills/subagent-creator/assets/subagent-template.md +31 -0
- package/.claude/skills/subagent-creator/references/available-tools.md +63 -0
- package/.claude/skills/subagent-creator/references/examples.md +213 -0
- package/.claude/skills/youtube-collector/README.md +107 -0
- package/.claude/skills/youtube-collector/SKILL.md +158 -0
- package/.claude/skills/youtube-collector/references/data-schema.md +110 -0
- package/.claude/skills/youtube-collector/scripts/collect_videos.py +304 -0
- package/.claude/skills/youtube-collector/scripts/fetch_transcript.py +138 -0
- package/.claude/skills/youtube-collector/scripts/fetch_videos.py +229 -0
- package/.claude/skills/youtube-collector/scripts/register_channel.py +247 -0
- package/.claude/skills/youtube-collector/scripts/setup_api_key.py +151 -0
- package/package.json +1 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hook-creator
|
|
3
|
+
description: Create and configure Claude Code hooks for customizing agent behavior. Use when the user wants to (1) create a new hook, (2) configure automatic formatting, logging, or notifications, (3) add file protection or custom permissions, (4) set up pre/post tool execution actions, or (5) asks about hook events like PreToolUse, PostToolUse, Notification, etc.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Hook Creator
|
|
7
|
+
|
|
8
|
+
Create Claude Code hooks that execute shell commands at specific lifecycle events.
|
|
9
|
+
|
|
10
|
+
## Hook Creation Workflow
|
|
11
|
+
|
|
12
|
+
1. **Identify the use case** - Determine what the hook should accomplish
|
|
13
|
+
2. **Select the appropriate event** - Choose from available hook events (see references/hook-events.md)
|
|
14
|
+
3. **Design the hook command** - Write shell command that processes JSON input from stdin
|
|
15
|
+
4. **Configure the matcher** - Set tool/event filter (use `*` for all, or specific tool names like `Bash`, `Edit|Write`)
|
|
16
|
+
5. **Choose storage location** - User settings (`~/.claude/settings.json`) or project (`.claude/settings.json`)
|
|
17
|
+
6. **Test the hook** - Verify behavior with a simple test case
|
|
18
|
+
|
|
19
|
+
## Hook Configuration Structure
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"hooks": {
|
|
24
|
+
"<EventName>": [
|
|
25
|
+
{
|
|
26
|
+
"matcher": "<ToolPattern>",
|
|
27
|
+
"hooks": [
|
|
28
|
+
{
|
|
29
|
+
"type": "command",
|
|
30
|
+
"command": "<shell-command>"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Common Patterns
|
|
40
|
+
|
|
41
|
+
### Reading Input Data
|
|
42
|
+
|
|
43
|
+
Hooks receive JSON via stdin. Use `jq` to extract fields:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Extract tool input field
|
|
47
|
+
jq -r '.tool_input.file_path'
|
|
48
|
+
|
|
49
|
+
# Extract with fallback
|
|
50
|
+
jq -r '.tool_input.description // "No description"'
|
|
51
|
+
|
|
52
|
+
# Conditional processing
|
|
53
|
+
jq -r 'if .tool_input.file_path then .tool_input.file_path else empty end'
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Exit Codes for PreToolUse
|
|
57
|
+
|
|
58
|
+
- `0` - Allow the tool to proceed
|
|
59
|
+
- `2` - Block the tool and provide feedback to Claude
|
|
60
|
+
|
|
61
|
+
### Matcher Patterns
|
|
62
|
+
|
|
63
|
+
- `*` - Match all tools
|
|
64
|
+
- `Bash` - Match only Bash tool
|
|
65
|
+
- `Edit|Write` - Match Edit or Write tools
|
|
66
|
+
- `Read` - Match Read tool
|
|
67
|
+
|
|
68
|
+
## Quick Examples
|
|
69
|
+
|
|
70
|
+
**Log all bash commands:**
|
|
71
|
+
```bash
|
|
72
|
+
jq -r '"\(.tool_input.command)"' >> ~/.claude/bash-log.txt
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Auto-format TypeScript after edit:**
|
|
76
|
+
```bash
|
|
77
|
+
jq -r '.tool_input.file_path' | { read f; [[ "$f" == *.ts ]] && npx prettier --write "$f"; }
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Block edits to .env files:**
|
|
81
|
+
```bash
|
|
82
|
+
python3 -c "import json,sys; p=json.load(sys.stdin).get('tool_input',{}).get('file_path',''); sys.exit(2 if '.env' in p else 0)"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Resources
|
|
86
|
+
|
|
87
|
+
- **Hook Events Reference**: See `references/hook-events.md` for detailed event documentation with input/output schemas
|
|
88
|
+
- **Example Configurations**: See `references/examples.md` for complete, tested hook configurations
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
# Hook Examples
|
|
2
|
+
|
|
3
|
+
Complete, tested hook configurations for common use cases.
|
|
4
|
+
|
|
5
|
+
## Logging Hooks
|
|
6
|
+
|
|
7
|
+
### Log All Bash Commands
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"hooks": {
|
|
12
|
+
"PreToolUse": [
|
|
13
|
+
{
|
|
14
|
+
"matcher": "Bash",
|
|
15
|
+
"hooks": [
|
|
16
|
+
{
|
|
17
|
+
"type": "command",
|
|
18
|
+
"command": "jq -r '\"\\(.tool_input.command) - \\(.tool_input.description // \"No description\")\"' >> ~/.claude/bash-command-log.txt"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Log All File Edits
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"hooks": {
|
|
32
|
+
"PostToolUse": [
|
|
33
|
+
{
|
|
34
|
+
"matcher": "Edit|Write",
|
|
35
|
+
"hooks": [
|
|
36
|
+
{
|
|
37
|
+
"type": "command",
|
|
38
|
+
"command": "jq -r '\"[\\(now | strftime(\"%Y-%m-%d %H:%M:%S\"))] \\(.tool_name): \\(.tool_input.file_path)\"' >> ~/.claude/edit-log.txt"
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Auto-Formatting Hooks
|
|
48
|
+
|
|
49
|
+
### Format TypeScript Files
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"hooks": {
|
|
54
|
+
"PostToolUse": [
|
|
55
|
+
{
|
|
56
|
+
"matcher": "Edit|Write",
|
|
57
|
+
"hooks": [
|
|
58
|
+
{
|
|
59
|
+
"type": "command",
|
|
60
|
+
"command": "jq -r '.tool_input.file_path' | { read file_path; if echo \"$file_path\" | grep -q '\\.tsx\\?$'; then npx prettier --write \"$file_path\" 2>/dev/null; fi; }"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Format Python Files with Black
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"hooks": {
|
|
74
|
+
"PostToolUse": [
|
|
75
|
+
{
|
|
76
|
+
"matcher": "Edit|Write",
|
|
77
|
+
"hooks": [
|
|
78
|
+
{
|
|
79
|
+
"type": "command",
|
|
80
|
+
"command": "jq -r '.tool_input.file_path' | { read f; [[ \"$f\" == *.py ]] && black \"$f\" 2>/dev/null; }"
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Format Go Files
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"hooks": {
|
|
94
|
+
"PostToolUse": [
|
|
95
|
+
{
|
|
96
|
+
"matcher": "Edit|Write",
|
|
97
|
+
"hooks": [
|
|
98
|
+
{
|
|
99
|
+
"type": "command",
|
|
100
|
+
"command": "jq -r '.tool_input.file_path' | { read f; [[ \"$f\" == *.go ]] && gofmt -w \"$f\"; }"
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## File Protection Hooks
|
|
110
|
+
|
|
111
|
+
### Block Edits to Sensitive Files
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{
|
|
115
|
+
"hooks": {
|
|
116
|
+
"PreToolUse": [
|
|
117
|
+
{
|
|
118
|
+
"matcher": "Edit|Write",
|
|
119
|
+
"hooks": [
|
|
120
|
+
{
|
|
121
|
+
"type": "command",
|
|
122
|
+
"command": "python3 -c \"import json, sys; data=json.load(sys.stdin); path=data.get('tool_input',{}).get('file_path',''); blocked=['.env', 'package-lock.json', '.git/', 'secrets']; sys.exit(2 if any(p in path for p in blocked) else 0)\""
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Block Modifications to Production Directory
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"hooks": {
|
|
136
|
+
"PreToolUse": [
|
|
137
|
+
{
|
|
138
|
+
"matcher": "Edit|Write|Bash",
|
|
139
|
+
"hooks": [
|
|
140
|
+
{
|
|
141
|
+
"type": "command",
|
|
142
|
+
"command": "jq -r '.tool_input | .file_path // .command // \"\"' | grep -q '/prod/' && echo 'BLOCKED: Cannot modify production files' && exit 2 || exit 0"
|
|
143
|
+
}
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Notification Hooks
|
|
152
|
+
|
|
153
|
+
### macOS Desktop Notification
|
|
154
|
+
|
|
155
|
+
```json
|
|
156
|
+
{
|
|
157
|
+
"hooks": {
|
|
158
|
+
"Notification": [
|
|
159
|
+
{
|
|
160
|
+
"matcher": "",
|
|
161
|
+
"hooks": [
|
|
162
|
+
{
|
|
163
|
+
"type": "command",
|
|
164
|
+
"command": "jq -r '.message' | xargs -I{} osascript -e 'display notification \"{}\" with title \"Claude Code\"'"
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Linux Desktop Notification
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"hooks": {
|
|
178
|
+
"Notification": [
|
|
179
|
+
{
|
|
180
|
+
"matcher": "",
|
|
181
|
+
"hooks": [
|
|
182
|
+
{
|
|
183
|
+
"type": "command",
|
|
184
|
+
"command": "jq -r '.message' | xargs -I{} notify-send 'Claude Code' '{}'"
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Sound Notification (macOS)
|
|
194
|
+
|
|
195
|
+
```json
|
|
196
|
+
{
|
|
197
|
+
"hooks": {
|
|
198
|
+
"Notification": [
|
|
199
|
+
{
|
|
200
|
+
"matcher": "",
|
|
201
|
+
"hooks": [
|
|
202
|
+
{
|
|
203
|
+
"type": "command",
|
|
204
|
+
"command": "afplay /System/Library/Sounds/Glass.aiff"
|
|
205
|
+
}
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Validation Hooks
|
|
214
|
+
|
|
215
|
+
### Validate JSON Before Write
|
|
216
|
+
|
|
217
|
+
```json
|
|
218
|
+
{
|
|
219
|
+
"hooks": {
|
|
220
|
+
"PreToolUse": [
|
|
221
|
+
{
|
|
222
|
+
"matcher": "Write",
|
|
223
|
+
"hooks": [
|
|
224
|
+
{
|
|
225
|
+
"type": "command",
|
|
226
|
+
"command": "jq -e '.tool_input | select(.file_path | endswith(\".json\")) | .content' | jq . > /dev/null 2>&1 || { echo 'Invalid JSON content'; exit 2; }"
|
|
227
|
+
}
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Lint TypeScript Before Commit
|
|
236
|
+
|
|
237
|
+
```json
|
|
238
|
+
{
|
|
239
|
+
"hooks": {
|
|
240
|
+
"PreToolUse": [
|
|
241
|
+
{
|
|
242
|
+
"matcher": "Bash",
|
|
243
|
+
"hooks": [
|
|
244
|
+
{
|
|
245
|
+
"type": "command",
|
|
246
|
+
"command": "jq -r '.tool_input.command' | grep -q 'git commit' && npx eslint . --max-warnings 0 || exit 0"
|
|
247
|
+
}
|
|
248
|
+
]
|
|
249
|
+
}
|
|
250
|
+
]
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Session Hooks
|
|
256
|
+
|
|
257
|
+
### Initialize Environment on Session Start
|
|
258
|
+
|
|
259
|
+
```json
|
|
260
|
+
{
|
|
261
|
+
"hooks": {
|
|
262
|
+
"SessionStart": [
|
|
263
|
+
{
|
|
264
|
+
"matcher": "",
|
|
265
|
+
"hooks": [
|
|
266
|
+
{
|
|
267
|
+
"type": "command",
|
|
268
|
+
"command": "[ -f .claude-env ] && source .claude-env"
|
|
269
|
+
}
|
|
270
|
+
]
|
|
271
|
+
}
|
|
272
|
+
]
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Cleanup on Session End
|
|
278
|
+
|
|
279
|
+
```json
|
|
280
|
+
{
|
|
281
|
+
"hooks": {
|
|
282
|
+
"SessionEnd": [
|
|
283
|
+
{
|
|
284
|
+
"matcher": "",
|
|
285
|
+
"hooks": [
|
|
286
|
+
{
|
|
287
|
+
"type": "command",
|
|
288
|
+
"command": "rm -f /tmp/claude-session-* 2>/dev/null; exit 0"
|
|
289
|
+
}
|
|
290
|
+
]
|
|
291
|
+
}
|
|
292
|
+
]
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
## Multiple Hooks Example
|
|
298
|
+
|
|
299
|
+
Combine multiple hooks in one configuration:
|
|
300
|
+
|
|
301
|
+
```json
|
|
302
|
+
{
|
|
303
|
+
"hooks": {
|
|
304
|
+
"PreToolUse": [
|
|
305
|
+
{
|
|
306
|
+
"matcher": "Edit|Write",
|
|
307
|
+
"hooks": [
|
|
308
|
+
{
|
|
309
|
+
"type": "command",
|
|
310
|
+
"command": "python3 -c \"import json,sys; p=json.load(sys.stdin).get('tool_input',{}).get('file_path',''); sys.exit(2 if '.env' in p else 0)\""
|
|
311
|
+
}
|
|
312
|
+
]
|
|
313
|
+
}
|
|
314
|
+
],
|
|
315
|
+
"PostToolUse": [
|
|
316
|
+
{
|
|
317
|
+
"matcher": "Edit|Write",
|
|
318
|
+
"hooks": [
|
|
319
|
+
{
|
|
320
|
+
"type": "command",
|
|
321
|
+
"command": "jq -r '.tool_input.file_path' | { read f; [[ \"$f\" == *.ts ]] && npx prettier --write \"$f\" 2>/dev/null; exit 0; }"
|
|
322
|
+
}
|
|
323
|
+
]
|
|
324
|
+
}
|
|
325
|
+
],
|
|
326
|
+
"Notification": [
|
|
327
|
+
{
|
|
328
|
+
"matcher": "",
|
|
329
|
+
"hooks": [
|
|
330
|
+
{
|
|
331
|
+
"type": "command",
|
|
332
|
+
"command": "afplay /System/Library/Sounds/Glass.aiff"
|
|
333
|
+
}
|
|
334
|
+
]
|
|
335
|
+
}
|
|
336
|
+
]
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
```
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Hook Events Reference
|
|
2
|
+
|
|
3
|
+
## Event Overview
|
|
4
|
+
|
|
5
|
+
| Event | Trigger | Can Block | Typical Use |
|
|
6
|
+
|-------|---------|-----------|-------------|
|
|
7
|
+
| PreToolUse | Before tool execution | Yes (exit 2) | Validation, blocking |
|
|
8
|
+
| PostToolUse | After tool completion | No | Formatting, logging |
|
|
9
|
+
| PermissionRequest | Permission dialog shown | Yes | Auto-allow/deny |
|
|
10
|
+
| UserPromptSubmit | User submits prompt | No | Pre-processing |
|
|
11
|
+
| Notification | Claude sends notification | No | Custom alerts |
|
|
12
|
+
| Stop | Claude finishes responding | No | Post-processing |
|
|
13
|
+
| SubagentStop | Subagent task completes | No | Subagent cleanup |
|
|
14
|
+
| PreCompact | Before compact operation | No | Pre-compact actions |
|
|
15
|
+
| SessionStart | Session starts/resumes | No | Initialization |
|
|
16
|
+
| SessionEnd | Session ends | No | Cleanup |
|
|
17
|
+
|
|
18
|
+
## PreToolUse
|
|
19
|
+
|
|
20
|
+
Runs before tool calls. Can block execution.
|
|
21
|
+
|
|
22
|
+
**Input Schema:**
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"tool_name": "Bash",
|
|
26
|
+
"tool_input": {
|
|
27
|
+
"command": "ls -la",
|
|
28
|
+
"description": "List files"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Exit Codes:**
|
|
34
|
+
- `0` - Allow tool to proceed
|
|
35
|
+
- `2` - Block tool, stdout sent as feedback to Claude
|
|
36
|
+
|
|
37
|
+
**Common tool_input fields by tool:**
|
|
38
|
+
- `Bash`: `command`, `description`
|
|
39
|
+
- `Edit`: `file_path`, `old_string`, `new_string`
|
|
40
|
+
- `Write`: `file_path`, `content`
|
|
41
|
+
- `Read`: `file_path`
|
|
42
|
+
- `Glob`: `pattern`, `path`
|
|
43
|
+
- `Grep`: `pattern`, `path`
|
|
44
|
+
|
|
45
|
+
## PostToolUse
|
|
46
|
+
|
|
47
|
+
Runs after tool calls complete.
|
|
48
|
+
|
|
49
|
+
**Input Schema:**
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"tool_name": "Edit",
|
|
53
|
+
"tool_input": {
|
|
54
|
+
"file_path": "/path/to/file.ts"
|
|
55
|
+
},
|
|
56
|
+
"tool_response": "File edited successfully"
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Use Cases:**
|
|
61
|
+
- Auto-formatting edited files
|
|
62
|
+
- Logging tool results
|
|
63
|
+
- Triggering dependent actions
|
|
64
|
+
|
|
65
|
+
## PermissionRequest
|
|
66
|
+
|
|
67
|
+
Runs when permission dialog is shown.
|
|
68
|
+
|
|
69
|
+
**Input Schema:**
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"tool_name": "Bash",
|
|
73
|
+
"tool_input": {
|
|
74
|
+
"command": "npm install"
|
|
75
|
+
},
|
|
76
|
+
"permission_type": "execute"
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Exit Codes:**
|
|
81
|
+
- `0` - Let user decide
|
|
82
|
+
- `1` - Auto-deny
|
|
83
|
+
- `2` - Auto-approve
|
|
84
|
+
|
|
85
|
+
## Notification
|
|
86
|
+
|
|
87
|
+
Runs when Claude sends notifications.
|
|
88
|
+
|
|
89
|
+
**Input Schema:**
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"message": "Waiting for your input",
|
|
93
|
+
"type": "input_required"
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Use Cases:**
|
|
98
|
+
- Custom desktop notifications
|
|
99
|
+
- Slack/Discord alerts
|
|
100
|
+
- Sound notifications
|
|
101
|
+
|
|
102
|
+
## UserPromptSubmit
|
|
103
|
+
|
|
104
|
+
Runs when user submits a prompt, before Claude processes it.
|
|
105
|
+
|
|
106
|
+
**Input Schema:**
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"prompt": "Help me fix this bug",
|
|
110
|
+
"session_id": "abc123"
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Use Cases:**
|
|
115
|
+
- Prompt logging
|
|
116
|
+
- Pre-processing
|
|
117
|
+
- Context injection
|
|
118
|
+
|
|
119
|
+
## Stop
|
|
120
|
+
|
|
121
|
+
Runs when Claude finishes responding.
|
|
122
|
+
|
|
123
|
+
**Input Schema:**
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"stop_reason": "end_turn",
|
|
127
|
+
"session_id": "abc123"
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Use Cases:**
|
|
132
|
+
- Session logging
|
|
133
|
+
- Cleanup tasks
|
|
134
|
+
- Metrics collection
|
|
135
|
+
|
|
136
|
+
## SubagentStop
|
|
137
|
+
|
|
138
|
+
Runs when subagent (Task tool) tasks complete.
|
|
139
|
+
|
|
140
|
+
**Input Schema:**
|
|
141
|
+
```json
|
|
142
|
+
{
|
|
143
|
+
"subagent_type": "Explore",
|
|
144
|
+
"result": "Found 5 matching files"
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## PreCompact
|
|
149
|
+
|
|
150
|
+
Runs before Claude compacts conversation context.
|
|
151
|
+
|
|
152
|
+
**Input Schema:**
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"reason": "context_limit",
|
|
156
|
+
"current_tokens": 50000
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## SessionStart
|
|
161
|
+
|
|
162
|
+
Runs when Claude Code starts or resumes a session.
|
|
163
|
+
|
|
164
|
+
**Input Schema:**
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"session_id": "abc123",
|
|
168
|
+
"is_resume": false,
|
|
169
|
+
"project_dir": "/path/to/project"
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Use Cases:**
|
|
174
|
+
- Environment setup
|
|
175
|
+
- Loading project config
|
|
176
|
+
- Starting background services
|
|
177
|
+
|
|
178
|
+
## SessionEnd
|
|
179
|
+
|
|
180
|
+
Runs when Claude Code session ends.
|
|
181
|
+
|
|
182
|
+
**Input Schema:**
|
|
183
|
+
```json
|
|
184
|
+
{
|
|
185
|
+
"session_id": "abc123",
|
|
186
|
+
"end_reason": "user_exit"
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Use Cases:**
|
|
191
|
+
- Cleanup resources
|
|
192
|
+
- Save session state
|
|
193
|
+
- Stop background services
|