How to use conditional hooks in Claude Code
Claude Code now has support for conditional if field in hooks. It uses the permission rule syntax like Edit, Read, etc
For example, you can run the hook only for specific file pattern like formatting Javascript codes like these
Or running a specific commands only for git like this