install-precommit
Skill16 starsChanged 10 months agoMITView on GitHub
Install the pre-commit review hook that forces you to understand changes before committing. Use when you want to enable commit reviews or when setting up a new project.
- Reads credentials
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 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.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 26
Verify this is a git repository (.git directory exists)
- Distinctive: line 27
Check if a pre-commit hook already exists
- Very specific: line 30
If .claude/hooks/pre-commit-review.sh doesn't exist, create it with the standard implementation.
- Very specific: line 33
Create .git/hooks/ directory if needed
- Distinctive: line 46
Do NOT embed a copy here: - always use the canonical version from the hooks directory.
- Very specific: line 48
If .claude/hooks/pre-commit-review.sh doesn't exist in the user's project, they may need to copy it from a template or create it based on …
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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
You are helping the user install the pre-commit review hook.
What This Hook Does
The pre-commit review hook runs before every git commit and:
- Shows files being committed with their status (added/modified/deleted)
- Shows lines added and removed
- Detects potentially sensitive files (.env, secrets, keys)
- Detects debug statements (console.log, print, debugger, etc.)
- Shows new dependencies being added
- Shows TODOs being introduced
- Requires user confirmation (y/n/d for diff) before proceeding
This prevents "vibe coding" - blindly committing AI-generated code without understanding it.
Installation Steps
- Check prerequisites:
- Verify this is a git repository (
.gitdirectory exists) - Check if a pre-commit hook already exists
- Verify this is a git repository (
- Create the hook script:
If
.claude/hooks/pre-commit-review.shdoesn't exist, create it with the standard implementation. - Install as git hook:
- Create
.git/hooks/directory if needed - Copy or symlink the script to
.git/hooks/pre-commit - Make it executable
- Create
- Verify installation:
- Confirm the hook is in place
- Show the user how to test it
- Explain how to bypass if needed
Hook Script Source
The pre-commit hook script is located at .claude/hooks/pre-commit-review.sh.
Do NOT embed a copy here - always use the canonical version from the hooks directory. This ensures updates to the hook are applied everywhere.
If .claude/hooks/pre-commit-review.sh doesn't exist in the user's project, they may need to copy it from a template or create it based on their needs.
After Installation
Tell the user:
- The hook is now active for all future commits
- To skip the review (not recommended):
SKIP_PRE_COMMIT_REVIEW=1 git commit -m "message" - To uninstall:
rm .git/hooks/pre-commit
Output Format
[OK] Pre-commit review hook installed
Location: .git/hooks/pre-commit
Source: .claude/hooks/pre-commit-review.sh
The hook will run before every commit, showing:
- Files being committed
- Lines added/removed
- Potential issues (sensitive files, debug statements)
- Requires your confirmation before proceeding
To test: stage some files and run `git commit`
To skip: SKIP_PRE_COMMIT_REVIEW=1 git commit -m "message"
To remove: rm .git/hooks/pre-commitIn this repository12 other files it gives its agents.
- docs/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- changelog-writerSkill
- code-reviewSkill
- explain-codeSkill
- generate-testsSkill
- refactor-codeSkill
- refresh-claudeSkill
- release-checklistSkill
- review-mrSkill
- risk-registerSkill
- wiggumSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

