Claude Code fires 30 events per session
you can hang your own code on any of them
the 6 that changed how I work:
A hook is a shell command that runs at a fixed moment. It isn't a prompt
that's the whole point. The model can reason its way around an instruction. It can't reason its way around a hook
1. PreToolUse → before a tool runs, and it can block it
mine refuses any write to .env, and any rm it didn't explain first
2. PostToolUse → after a tool succeeds
mine runs the formatter on whatever file it just touched. I stopped asking for tidy code
3. UserPromptSubmit → after I hit enter, before the model sees it
mine attaches the branch and the last commit. every prompt. I never type it
4. Stop → the turn is finished
mine runs the tests. If they fail, the turn isn't finished
5. SessionStart → a session begins or resumes
mine prints the three things I changed yesterday and always forget
6. PreCompact → the moment before it compacts
mine saves the transcript. I've lost one. Not twice
they all live in .claude/settings.json. A matcher decides which tools they fire on
the other 24 are real (SubagentStop, FileChanged, PermissionDenied, WorktreeCreate). I've never needed one
start with PostToolUse. it's the one you feel today
Bookmark this. This is the one.
GPT-6 Astra is insanely powerful.
But most people will barely use 10% of it.
The difference is knowing how to prompt it properly.
I put together the complete GPT-6 Astra Prompting Masterclass so you can get dramatically better results from day one