lefthook
Skill2 starsChanged 7 months agoMITView on GitHub
Write, debug, and explain Lefthook configuration for Git hooks. Use this skill when the user mentions `lefthook`, `lefthook.yml`, `lefthook install`, `pre-commit`, `pre-push`, staged-file or push-file filtering, `jobs`, `commands`, `scripts`, local overrides, or troubleshooting hook execution and recursive hook behavior.
In this repository26 other files it gives its agents.
- other/AGENTS.mdAGENTS.md
- beamng-modsSkill
- bootstrap-vueSkill
- charmbraceletSkill
- depsdotdevSkill
- find-domainSkill
- github-cliSkill
- go-cobraSkill
- goreleaserSkill
- go-viperSkill
- kasettoSkill
- laravel-actionsSkill
- miseSkill
- pelican-panel-pluginsSkill
- php-monorepo-builderSkill
- php-saloonSkill
- prd-todo-slicerSkill
- prd-to-kandev-tasksSkill
- qodo-mergeSkill
- release-pleaseSkill
- rewrite-in-goSkill
- shieldsioSkill
- skill-researcherSkill
- skill-scoutSkill
- taskfileSkill
- website-visual-testingSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 2 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Use this skill to configure fast, maintainable Git hooks with Lefthook.
- Very specific: line 16
Prefer jobs for new configs.
- Very specific: line 17
Keep hooks fast and file-scoped with {staged_files}, {push_files}, glob, file_types, and root.
- Very specific: line 18
Run lefthook validate for syntax checks and lefthook dump when debugging merged config.
- Very specific: line 38
Add lefthook-local.yml, extends, or remotes only when you need local overrides or shared policy.
- Distinctive: line 42
Prefer deterministic, non-interactive hooks unless the workflow explicitly requires prompts.
- Very specific: line 43
Use stage_fixed: true only for pre-commit fixers that modify staged files.
- Very specific: line 45
Use LEFTHOOK=0 for tools that would otherwise recurse back into Git hooks.
- Very specific: line 46
Use lefthook run <hook> to debug a hook directly before testing the full Git flow.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Lefthook
Use this skill to configure fast, maintainable Git hooks with Lefthook.
Start Here
- Match install instructions to the project ecosystem: npm, Go, Ruby, Python, Homebrew, or standalone binary.
- Prefer
jobsfor new configs;commandsandscriptsare still valid and common. - Keep hooks fast and file-scoped with
{staged_files},{push_files},glob,file_types, androot. - Run
lefthook validatefor syntax checks andlefthook dumpwhen debugging merged config. - Remember:
lefthook installis usually one-time setup; config changes are read on each hook execution.
Fast Routing
| Need | Read |
| Install and official docs map | references/official-docs.md |
| CLI, config model, templates, merge order | references/api-surface.md |
| Common real-world patterns | references/common-use-cases.md |
| Why a hook is skipped or behaving oddly | references/troubleshooting-workarounds.md |
| Ready-to-copy configs | examples/basic-lefthook.yml, examples/monorepo-jobs.yml, examples/commit-message.yml, examples/lefthook-local.yml |
| Bad patterns and fixes | examples/anti-patterns.md |
Recommended Workflow
- Inspect existing package scripts, linters, test commands, and current Git hook tooling.
- Choose the smallest useful hook surface: usually
pre-commit,commit-msg, andpre-push. - Pick
jobs,commands, orscriptsbased on whether you need grouping, named merges, or external executables. - Scope work to changed files unless the check truly needs the whole repository.
- Add
lefthook-local.yml,extends, orremotesonly when you need local overrides or shared policy.
Core Rules
- Prefer deterministic, non-interactive hooks unless the workflow explicitly requires prompts.
- Use
stage_fixed: trueonly forpre-commitfixers that modify staged files. - Remember that
globis evaluated from the Git repo root, even whenrootchanges the working directory. - Use
LEFTHOOK=0for tools that would otherwise recurse back into Git hooks. - Use
lefthook run <hook>to debug a hook directly before testing the full Git flow.
External Docs
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

