Examples & Best Practices
Examples
Blocking dangerous shell commands
{
"hooks": {
"BeforeTool": [
{
"matcher": "run_shell_command",
"sequential": true,
"hooks": [
{
"type": "command",
"command": "node ./hooks/block-dangerous.js",
"name": "block-dangerous",
"description": "Block dangerous shell commands"
}
]
}
]
}
}Restricting file writes to a directory
Logging all tool calls
Adding context to every prompt
Auto-running linter after file changes
Security and trust
Best practices
1
2
3
4
5
6
7
8
Was this helpful?
