git-hooks
Skill0 starsChanged 39 days agoMITView on GitHub
Use when hooks are unexpected, missing, or misconfigured; covers effective paths, visibility, lifecycle, bypasses, and checkout scope
- Commits and pushes
In this repository66 other files it gives its agents.
- AGENTS.mdAGENTS.md
- postgres-locking-joinsSkill
- ai-bug-patternsSkill
- compressed-ndjson-boundariesSkill
- http-resume-integritySkill
- linux-io-latency-triageSkill
- macos-disk-space-recoverySkill
- minimal-sufficient-evidenceSkill
- modularize-large-filesSkill
- patch-reproducer-validitySkill
- prompt-cache-boundariesSkill
- proton-drive-selective-backupSkill
- transactional-outbox-deliverySkill
- conventional-commitsSkill
- git-advanced-mergingSkill
- git-bisect-forensicsSkill
- git-data-recoverySkill
- git-rerereSkill
- git-reset-mechanicsSkill
- git-revisions-syntaxSkill
- git-rewriting-historySkill
- git-submodulesSkill
- git-worktreesSkill
- github-ssh-keysSkill
- npm-publish-ci-pitfallsSkill
- sapling-stacked-pr-workflowSkill
- go-concurrency-patternsSkill
- go-data-idiomsSkill
- go-error-handlingSkill
- go-interfaces-embeddingSkill
- go-pprof-profilingSkill
- marketing-funnel-diagnosisSkill
- marketing-geo-experimentsSkill
- marketing-incrementalitySkill
- marketing-positioning-testsSkill
- python-descriptors-mroSkill
- python-logging-cookbookSkill
- python-scaling-regression-testsSkill
- python-unicode-gotchasSkill
- rust-compile-time-invariantsSkill
- rust-deterministic-concurrency-testsSkill
- rust-error-identity-boundariesSkill
- rust-regex-search-contractsSkill
- rust-runtime-bug-classesSkill
- rust-tokio-actor-deliverySkill
- rust-tokio-cancellation-safetySkill
- sales-discovery-qualificationSkill
- sales-mutual-action-plansSkill
- sales-pipeline-forecast-calibrationSkill
- sales-value-negotiationSkill
- ai-triage-evaluationSkill
- container-image-patchingSkill
- dependency-artifact-integritySkill
- dnssec-sentinel-diagnosticsSkill
- iam-policy-change-replaySkill
- rbvm-applicabilitySkill
- rbvm-asset-evidenceSkill
- rbvm-guarded-remediationSkill
- rbvm-priority-decisionsSkill
- rbvm-risk-exceptionsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 37
Commit flow: pre-commit → prepare-commit-msg → editor → commit-msg → post-commit.
≈ “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
Git Hooks
Hooks run on named Git events from the effective path. Git ignores non-executable files; failed pre-hooks abort, post-hooks do not.
Locate the effective hooks
git rev-parse --git-path hooks
git rev-parse --git-common-dir
git config --show-origin --get core.hooksPath--git-path hooks resolves the path: $GIT_DIR/hooks normally, $GIT_COMMON_DIR/hooks in linked worktrees. Relative core.hooksPath follows hook cwd (non-bare clients: worktree root; bare/receive: $GIT_DIR).
Distribution
Clones omit source .git/hooks; templates can seed hooks and core.hooksPath can redirect to shared/global hooks. After reviewing and trusting the scripts, use a tracked directory:
git config core.hooksPath .githooks
git commit --no-verify # bypass pre-commit + commit-msg
git push --no-verify # bypass pre-pushVisibility and checkout scope
- A custom zsh chpwd function can list executable non-.sample hooks once per path; call it at shell startup too, and avoid alert fatigue.
- A .pre-commit-config.yaml declares checks, not an installed hook. Installer-marker checks miss custom wrappers.
- Sharing a working copy can bring active .git metadata. Linked worktrees share common-dir hooks; see Git worktrees.
Client-Side
Commit flow: pre-commit → prepare-commit-msg → editor → commit-msg → post-commit.
| Hook | Args | Abort? | Use |
pre-commit | — | yes | lint, format, fast tests |
prepare-commit-msg | msg-file, source, sha | yes | inject ticket ID, templates |
commit-msg | msg-file | yes | validate message format |
post-commit | — | no | notifications |
pre-rebase | upstream [branch] | yes | block rebasing published commits |
post-rewrite | amend|rebase; stdin: old→new sha | no | re-run artifact gen after amend |
post-checkout | prev, new, branch-flag | no | LFS smudge, regenerate artifacts |
post-merge | squash-flag | no | restore untracked state |
pre-push | remote, url; stdin: local-ref local-sha remote-ref remote-sha | yes | full tests, block force-push to main |
pre-auto-gc | — | yes | defer gc when busy |
Patch flow (git am): applypatch-msg → pre-applypatch → post-applypatch.
Server-Side (on bare repo)
| Hook | Args | Scope | Abort? |
pre-receive | stdin old new ref per updated ref | once per push | yes (rejects all) |
update | ref, old, new | per ref | yes (that ref only) |
post-receive | stdin like pre-receive | once | no — CI triggers |
update is the granular gatekeeper: protect branches, reject non-FF on main, require signed commits.
pre-push and pre-receive receive ref-update records on stdin; read them when validating refs.
Pitfalls
- For Bash hooks, use
set -euo pipefail; POSIX sh lackspipefail. core.hooksPathreplaces the default dir; copy any needed defaults in.- Client hooks are advisory; enforce security server-side or in CI.
- Prompt listings are visibility aids, not hook validation or enforcement.
See source and validation notes.
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.

