1
Install the Package
Add ClaudeEssentials to your project:
2
Create a Hook Processor
Create a console app that reads JSON from stdin and writes the response to stdout:
Program.cs
3
Configure Claude Code
Add your hook to Claude Code’s
settings.json:settings.json
For production, publish your app as a native executable for faster startup:
4
Test It Out
Start a Claude Code session. Your hook will now intercept tool calls and apply your custom logic.
You’re ready to customize Claude’s behavior with strongly-typed C# code!
Common Patterns
Auto-approve safe tools
Auto-approve safe tools
Block dangerous commands
Block dangerous commands
Add context after tool execution
Add context after tool execution