$ recombobulate _
home / tips / automate-repetitive-tasks-with-hooks
automate-repetitive-tasks-with-hooks

Hooks are shell commands that execute automatically in response to Claude Code events. Configure them in your settings.json:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit",
        "hooks": [
          {
            "type": "command",
            "command": "vendor/bin/pint --dirty"
          }
        ]
      }
    ]
  }
}

This example automatically runs Pint after every file edit — so your code is always formatted without you having to remember.

Available hook events:

  • PreToolUse — runs before a tool executes
  • PostToolUse — runs after a tool completes
  • Stop — runs when Claude finishes its turn and returns control to you

The matcher field is a regex matched against the tool name (Write, Edit, Bash, etc.). Use ".*" to match all tools, or pipe-separate specific ones.

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit",
        "hooks": [
          {
            "type": "command",
            "command": "vendor/bin/pint --dirty"
          }
        ]
      }
    ],
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "echo 'Running a shell command...'"
          }
        ]
      }
    ]
  }
}

Hooks run synchronously — a PostToolUse hook fires before Claude moves to the next step, making it perfect for linting, formatting, or running a quick type-check after every change.

Use /update-config to set these up interactively, or just ask Claude to write the hook configuration for your specific needs.

Hooks turn repetitive quality steps into automatic ones — set them once and forget them.

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Switch to the Stable Update Channel with autoUpdatesChannel

The autoUpdatesChannel setting pins Claude Code to a stable release track that skips versions with major regressions.

bagwaa @bagwaa · 1 hour ago
0
Set Claude's Response Language with the language Setting

The language setting makes Claude respond in your preferred language by default, across every session and project.

bagwaa @bagwaa · 1 hour ago
0
Customize or Remove Claude's Git Attribution with the attribution Setting

The attribution setting lets you customize or completely remove Claude's Co-Authored-By trailer from git commits and pull requests.

bagwaa @bagwaa · 1 hour ago