npm.io
0.2.20 • Published 2d agoCLI

@c0nant/claude-hooks

Licence
MIT
Version
0.2.20
Deps
0
Size
20 kB
Vulns
0
Weekly
0
Stars
1

claude-hooks

Claude Code hooks companion to C0nanT/skills. Wires the caveman and git-guardrails hooks into settings.json automatically — no hand-editing.

Prerequisites

The git-guardrails hook is self-contained — it bundles its own script, no skills required.

The caveman hook reads a skill asset at runtime (~/.claude/skills/caveman/SKILL.md). If you want it, install C0nanT/skills first — without it, the caveman hook no-ops:

npx skills@latest add C0nanT/skills

Requires jq. On Ubuntu/WSL: sudo apt-get install -y jq

Install

npx @c0nant/claude-hooks install

Bundled hooks

Hook Event What it does
caveman SessionStart Injects the caveman ruleset as hidden context — agent starts in token-saving mode every session without typing /caveman
git-guardrails PreToolUse/Bash Blocks destructive git commands (push, reset --hard, clean -f, branch -D, checkout ., restore .) before execution

The caveman hook no-ops gracefully if its skill asset is absent; git-guardrails bundles its own script and needs nothing else.

Commands

npx @c0nant/claude-hooks install              # install all hooks
npx @c0nant/claude-hooks install git-guardrails  # one hook only
npx @c0nant/claude-hooks uninstall            # remove all
npx @c0nant/claude-hooks uninstall caveman    # remove one
npx @c0nant/claude-hooks list                 # show installed

Installs are idempotent — re-running syncs without duplicating. Uninstall is surgical — only touches what this tool added.

Project-scoped install

CLAUDE_SETTINGS=.claude/settings.json npx @c0nant/claude-hooks install

Development

Setup
git config core.hooksPath .githooks   # pre-push runs tests
bash test/run.sh                      # requires jq

No npm install — zero runtime dependencies beyond Node ≥18 and jq.

Day-to-day workflow
Where you push What happens
Branch or PR CI runs test/run.sh only — no version bump, no npm publish
main CI runs tests → bumps version → publishes to npm

Work on a branch, open a PR (or push directly if solo), merge to main when green.

Releasing

Fully automatic — CI decides the bump (patch/minor/major) from your commit messages since the last tag and publishes on every push to main:

push to main → tests → detect bump from commits → version bump → tag → npm publish

Never bump package.json manually. The bump type is driven entirely by commit message prefixes — see CONTRIBUTING.md for the convention (fix: → patch, feat: → minor, feat!:/BREAKING CHANGE → major). ./release.sh still exists as a manual escape hatch if you ever need to force a specific bump, but it's no longer part of the normal flow.

Requires NPM_TOKEN in GitHub Actions secrets.

Keywords