git-hooks
Skill0 starsChanged 3 months agoMITView on GitHub
Design and diagnose Git hooks that validate the intended snapshot, preserve user state, handle filenames safely, and share enforcement with CI.
In this repository12 other files it gives its agents.
- AGENTS.mdAGENTS.md
- bare-bonesSkill
- flow-ideateSkill
- flow-implementSkill
- flow-planSkill
- git-commitSkill
- githubSkill
- golangci-lintSkill
- goSkill
- pythonSkill
- rustSkill
- typescriptSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
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
- Distinctive: line 19
Keep pre-commit checks focused and fast.
- Distinctive: line 21
Treat third-party hook code as executable supply-chain input.
- Distinctive: line 22
Keep secrets out of arguments, logs, and generated files.
- Distinctive: line 23
Never bypass a hook unless the user explicitly authorizes that action after seeing the failure.
- Distinctive: line 25
Use one orchestrator with ordered executable checks when several checks are needed.
- Very specific: line 27
Read references/hook-types.md for hook parameters and abort behavior.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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
Inspect existing hooks, core.hooksPath, repository scripts, and CI before changing anything. Do not install hooks or change Git configuration without explicit authorization.
Safety Contract
- Client hooks are bypassable. Put required policy in CI or server-side enforcement too.
- A commit hook must validate staged blobs, not unstaged working-tree content. Preserve partial staging and do not modify the index or working tree.
- Handle arbitrary filenames as data. Prefer NUL-delimited Git output and quote every path.
- Include additions, modifications, deletions, and renames when repository-wide references can break.
- Propagate validator failures. Distinguish no relevant files from failed discovery.
- Keep pre-commit checks focused and fast. Put expensive integration work in pre-push or CI.
- Share validation scripts with CI rather than maintaining different rules in hook prose.
- Treat third-party hook code as executable supply-chain input. Pin and review it.
- Keep secrets out of arguments, logs, and generated files.
- Never bypass a hook unless the user explicitly authorizes that action after seeing the failure.
Use one orchestrator with ordered executable checks when several checks are needed. A disabled check must not remain executable in an auto-discovered directory.
Read references/hook-types.md for hook parameters and abort behavior. Read references/server-side-hooks.md only for server-hosted repositories and bounded receive-hook design.
The retained examples/modular-pre-commit/ example demonstrates staged-shell validation. Adapt it to the repository. Do not present it as enforcement for every project.
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.

