Claude Code Kit
Recipes

Enable Opt-In Hooks

Turn on auto-format, auto-lint, skill-compliance, and skill-extract-reminder — hooks the kit ships disabled by default.

Four of the kit's twelve hooks ship disabled by default because they can be slow or conflict with project configs:

HookWhat it doesWhy it's opt-in
auto-formatRuns the project formatter after every editSlow on large files; can fight with editor formatters
auto-lintRuns the linter after every editSlow; many projects already do this in the editor
skill-complianceChecks edited files against active skill checklistsAdds latency proportional to skill count
skill-extract-reminderReminds Claude to extract discoveries as skillsCan be noisy mid-task

The other eight (protect-files, branch-protect, block-dangerous-commands, conventional-commit, secret-scan, unicode-scan, loop-detect, task-complete-notify) are deterministic and fast, so they're enabled by default.

Verify what's currently active

cat .claude/settings.json | jq '.hooks'

The eight always-on hooks should be listed under PreToolUse and PostToolUse. Any of the four opt-in hooks present means it's already enabled.

Enable an opt-in hook

Add to .claude/settings.json under the appropriate lifecycle. The four opt-in hooks plug into different phases:

auto-format and auto-lint — PostToolUse

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write|NotebookEdit",
        "hooks": [
          { "type": "command", "command": ".claude/hooks/auto-format.sh" },
          { "type": "command", "command": ".claude/hooks/auto-lint.sh" }
        ]
      }
    ]
  }
}

If you already have a PostToolUse block matching Edit|Write|NotebookEdit (the default kit ships one for secret-scan / unicode-scan / loop-detect), append to its hooks array — don't add a second PostToolUse block with the same matcher.

skill-compliance — PostToolUse

{ "type": "command", "command": ".claude/hooks/skill-compliance.sh" }

Same lifecycle as auto-format. Runs after edits to verify the file complies with any active skill's checklist.

skill-extract-reminder — UserPromptSubmit

{
  "hooks": {
    "UserPromptSubmit": [
      {
        "hooks": [
          {
            "type": "command",
            "command": ".claude/hooks/skill-extract-reminder.sh"
          }
        ]
      }
    ]
  }
}

This one's different — it triggers on user prompts, not tool calls.

Use the --profile strict shortcut

If you're installing the kit fresh and want all four enabled:

npx @tansuasici/claude-code-kit init --profile strict

This enables all opt-in hooks at install time. Equivalent to manually editing .claude/settings.json, just faster.

Configure formatter / linter commands

auto-format.sh and auto-lint.sh look at your project to decide what to run:

Detectedauto-formatauto-lint
package.json with format scriptnpm run format
package.json with lint scriptnpm run lint
prettier in depsnpx prettier --write
eslint in depsnpx eslint --fix
pyproject.toml with [tool.ruff]ruff formatruff check --fix
Cargo.tomlcargo fmtcargo clippy --fix
go.modgofmt -w

If detection fails, the hook exits 0 (no error, no formatting). You can add a project-specific override in .claude/hooks/project/.

Verify

After enabling, edit any source file in a Claude Code session. You should see:

  • auto-format: file is reformatted on save
  • auto-lint: lint output appended to Claude's view
  • skill-compliance: warnings if the edit violates an active skill's rules
  • skill-extract-reminder: occasional reminders to run /skill-extractor

Disable / revert

Remove the hook entry from .claude/settings.json. No state to clean up — hooks are stateless shell scripts.

When to NOT enable these

  • Large files (10k+ lines): auto-format and auto-lint will add 5-30s to every edit. Disable for those projects.
  • Pair-programming with AI in the editor: your editor's formatter will fight auto-format. Pick one.
  • CI-only formatting policy: if your team enforces format/lint only at PR time, the kit's hooks duplicate work.