Coming from husky
Move a repository from husky to hookset: each .husky/ script becomes the station script its hook calls, `prepare` runs lefthook instead, and hookset init writes the lefthook.yml. A concept map, the steps, what differs on purpose and what is not built.
husky installs the hook scripts a repository keeps in .husky/. hookset keeps one set of hooks
for every repository, as lefthook presets pinned by tag, and moves each repository's commands
into scripts with fixed names. The switch changes where the commands live, not what they do.
No husky suite is graded against hookset, and hookset does not claim to be a drop-in: it does
not read .husky/, and it runs hooks through lefthook.
Concept map
| husky | hookset |
|---|---|
npx husky init | npx hookset init |
"prepare": "husky" | "prepare": "lefthook install || true" |
.husky/pre-commit | the hook:staged script, which lefthook hands the staged paths |
.husky/commit-msg running commitlint --edit $1 | the commitlint station, in the commit-msg preset |
.husky/pre-push | the hook:verify script, plus the optional and observed pre-push stations |
| a step only this repository has | a local step in lefthook.yml, below remotes: (Repository steps) |
core.hooksPath set to .husky/_ | lefthook installs into .git/hooks; nothing moves core.hooksPath |
HUSKY=0 to skip the hooks | none for agents: guard-bash denies HUSKY=0 and LEFTHOOK=0 before a commit or push |
The steps
-
Install.
npm uninstall husky npm install -D hookset lefthook -
Move each script. Whatever
.husky/pre-commitran on staged files becomeshook:staged; whatever.husky/pre-pushran becomeshook:verify. A commitlint line in.husky/commit-msgneeds nothing: the preset runs commitlint. Declarehook:provedonetoo, for thecommit-msgstation onmain(Presets)."scripts": { - "prepare": "husky", + "prepare": "lefthook install || true", + "hook:provedone": "provedone gate --mode enforce", + "hook:staged": "prettier --check", + "hook:verify": "npm run typecheck && npm test && npm run build" } -
Write the config.
npx hookset initwriteslefthook.yml. -
Give git its hooks back. husky 9 points
core.hooksPathat.husky/_. Unset it so git runs the hooks lefthook installs, then install them:git config --unset core.hooksPath npx lefthook install -
Delete
.husky/, and runnpx hookset check. It names anything still missing, each with its fix.
What is different on purpose
- The hook is not the repository's file. A repository cannot edit the preset; it edits what
its
hook:*script runs, or adds a local step. That is what keeps the same station the same everywhere. - The version is a tag in
lefthook.yml. husky's hooks change when the repository's files change. hookset's presets change when the repository moves itsref(Pinning). - There is a check.
hookset checkin CI fails a repository whose hooks are missing or drifted. husky has no equivalent; a deleted.husky/pre-pushis silent. - Skipping is denied to agents. A person can still skip a hook from their own terminal. Claude Code cannot, once the hook pack is in.
What is not built
- Husky presets. The intent planned presets for husky as well as lefthook, and took lefthook first; the husky ones follow once a repository outside the family asks.
- Reading
.husky/.initdoes not convert the scripts for you; step 2 is by hand. - Hooks other than
commit-msg,pre-commitandpre-push. A repository that usespost-mergeorprepare-commit-msgkeeps them as local steps inlefthook.yml.
Why hookset
What hookset does that a hook script per repository does not: one pinned set of stations read in place by every repository, a check that fails on drift, and Claude Code hooks that keep an agent from skipping them; and what it leaves out on purpose, including running the hooks itself.
Check the hooks in CI
Run `hookset check` on every pull request, either through burgee's reusable hookset-check workflow, which needs no install or build, or as one step of a job that already ran `npm ci`.