agentsclimarketplace

Git hooks

Skill narenaryan/agent-skills/skills/git/git-hooks

Byte-sized agent skills for giving advanced knowledge to AI agents

Install
npx -y skills add narenaryan/agent-skills --skill git-hooks

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use when writing, debugging, or configuring git hooks (pre-commit, commit-msg, pre-push, pre-receive, etc.) — covers firing order, arguments, exit-code effects, and core.hooksPath for team distribution

SKILL.md

2.5 KB, as published. Nobody here has run it

Git Hooks

Executables in .git/hooks/ (or core.hooksPath) named for the event. Non-zero exit aborts (except post-*). Any language; must be +x, no extension.

Distribution

.git/hooks/* is not cloned. Use a tracked dir:

git config core.hooksPath .githooks
git commit --no-verify          # bypass pre-commit + commit-msg
git push --no-verify            # bypass pre-push

Client-Side

Commit flow: pre-commitprepare-commit-msg → editor → commit-msgpost-commit.

HookArgsAbort?Use
pre-commityeslint, format, fast tests
prepare-commit-msgmsg-file, source, shayesinject ticket ID, templates
commit-msgmsg-fileyesvalidate message format
post-commitnonotifications
pre-rebaseupstream [branch]yesblock rebasing published commits
post-rewriteamend|rebase; stdin: old→new shanore-run artifact gen after amend
post-checkoutprev, new, branch-flagnoLFS smudge, regenerate artifacts
post-mergesquash-flagnorestore untracked state
pre-pushremote, url; stdin: local-ref local-sha remote-ref remote-shayesfull tests, block force-push to main
pre-auto-gcyesdefer gc when busy

Patch flow (git am): applypatch-msgpre-applypatchpost-applypatch.

Server-Side (on bare repo)

HookArgsScopeAbort?
pre-receivestdin old new ref per updated refonce per pushyes (rejects all)
updateref, old, newper refyes (that ref only)
post-receivestdin like pre-receiveonceno — CI triggers

update is the granular gatekeeper: protect branches, reject non-FF on main, require signed commits.

Debugging

GIT_TRACE=1 git commit
bash -x .git/hooks/pre-commit

Hooks reading stdin (pre-push, pre-receive) must consume it — forgetting silently deadlocks on large pushes.

Pitfalls

  • Use set -euo pipefail in shell hooks; otherwise silent pass on pipeline failure.
  • core.hooksPath replaces the default dir; copy any needed defaults in.
  • Client hooks are advisory — never rely on them for security. Enforce server-side or in CI.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.