Skip to content

How to run checks automatically with cckit hooks

Do this with Claude CodeCopy a prompt that links the cckit docs so Claude learns the CLI, then follows these steps.

What you’ll set up: a hook is a script Claude Code runs automatically when something happens — a session starts, a command is about to run, a session ends. cckit scaffolds a few at init so the right check fires at the right moment without you remembering to run it. You never call a hook; Claude Code fires it on an event.

  1. Scaffold the hooks. cckit init installs the always-on set into .claude/hooks/.

    Terminal window
    cckit init

    You get three by default: a session-start repo-hygiene report (stale branches, worktrees, stashes), a quiet version check, and a base-branch commit guard that blocks a commit made straight to the base branch — so work always goes through a branch and a PR.

  2. Confirm they’re healthy. cckit doctor checks the hooks are wired and refreshes any stale ones.

    Terminal window
    cckit doctor
  3. Turn on feature hooks as you need them. Enabling the pre-push gate at init adds a hook that runs your project’s tests/lint before a git push, so a red branch never reaches the remote. Memory adds four more (see persistent memory).

Hooks are plain scripts under .claude/hooks/, registered in .claude/settings.local.json — yours to read and edit. Every one is a safe no-op when its tool isn’t installed, so nothing breaks if a dependency is missing (which is what makes unattended runs safe). Events map to moments: SessionStart for reports, PreToolUse (Bash) for guards before a command runs, Stop/SessionEnd for wrap-up.

A hook didn’t fire. Run cckit doctor — it re-registers stale hooks. Confirm the entry exists in .claude/settings.local.json.

A hook I don’t need is running. They’re plain scripts you own — edit or remove it from .claude/hooks/ and its registration. Each is a safe no-op if you’d rather neutralize than delete.

The pre-push gate blocks a valid push. It runs your project’s check; a failing test or lint is the gate doing its job. Fix the finding, or adjust the check the gate runs.

Independent, educational project — not affiliated with or endorsed by Anthropic. Claude and Claude Code are trademarks of Anthropic PBC. Disclaimer & trademarks

From Mexico with love by josegtz