⌨️UserPromptSubmit Hook
Also known as UserPromptSubmit
The event when you send a prompt, before Claude reads it.
Think of it like
It is like a clerk who reads your form. Then it goes to the office.
Example
Jack's hook adds the current git branch to each prompt, so Claude always knows which branch it is on.
Why it matters
It is the one place to add facts to every prompt without typing them.
Definition
Example code
bash
#!/bin/bash
# add the current git branch to every prompt
echo "Current branch: $(git branch --show-current)"Common mistake
Key takeaways
- 1Before Claude reads. Each prompt.
- 2Add or block. Context or stop.
- 3Stdout reaches Claude. Plain text.