sickn33/antigravity-awesome-skills/git-hooks-automation
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Master Git hooks setup with Husky, lint-staged, pre-commit framework, and commitlint. Automate code quality gates, formatting, linting, and commit message enforcement before code reaches CI.
Install
npx vskill@latest install sickn33/antigravity-awesome-skills/git-hooks-automationSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
Git Hooks Automation
Automate code quality enforcement at the Git level. Set up hooks that lint, format, test, and validate before commits and pushes ever reach your CI pipeline — catching issues in seconds instead of minutes.
When to Use This Skill
- User asks to "set up git hooks" or "add pre-commit hooks"
- Configuring Husky, lint-staged, or the pre-commit framework
- Enforcing commit message conventions (Conventional Commits, commitlint)
- Automating linting, formatting, or type-checking before commits
- Setting up pre-push hooks for test runners
- Migrating from Husky v4 to v9+ or adopting hooks from scratch
- User mentions "pre-commit", "commit-msg", "pre-push", "lint-staged", or "githooks"
Git Hooks Fundamentals
Git hooks are scripts that run automatically at specific points in the Git workflow. They live in .git/hooks/ and are not version-controlled by default — which is why tools like Husky exist.
Hook Types & When They Fire
| Hook | Fires When | Common Use | |
|---|---|---|---|
pre-commit | Before commit is created | Lint, format, type-check staged files | |
prepare-commit-msg | After default msg, before editor | Auto-populate commit templates | |
commit-msg | After user writes commit message | Enforce commit message format | |
post-commit | After commit is created | Notifications, logging | |
pre-push | Before push to remote | Run tests, check branch policies | |
pre-rebase | Before rebase starts | Prevent rebase on protected branches | |
post-merge | After merge completes | Install deps, run migrations | |
post-checkout | After checkout/switch | Install deps, rebuild assets |
Native Git Hooks (No Framework)
Problem: .git/hooks/ is local-only and not shared with the team. Use a framework instead.
Husky + lint-staged (Node.js Projects)
The modern standard for JavaScript/TypeScript projects. Husky manages Git hooks; lint-staged runs commands only on staged files for speed.
Quick Setup (Husky v9+)
Configure lint-staged in package.json
Add Commit Message Linting
Add Pre-Push Hook
Complete Husky Directory Structure
pre-commit Framework (Python / Polyglot)
Language-agnostic framework that works with any project. Hooks are defined in YAML and run in isolated environments.
Setup
Key Commands
Hooks run local code; inspect third-party hooks and pinned revisions before installing. Local hooks are bypassable and are not merge authorization. The portable custom example below is intentionally simplified: line-based paths break unusual filenames, working-tree file sizes differ from staged blob sizes, and diff-context scans can match removed/context lines or expose secrets. Use NUL-safe staged blob inspection and report filenames/rules without printing matched secret values.
Custom Hook Scripts (Any Language)
For projects not using Node or Python, write hooks directly in shell.
Portable Pre-Commit Hook
Share Custom Hooks via core.hooksPath
CI Integration
Hooks are a first line of defense, but CI is the source of truth.
Run pre-commit in CI (GitHub Actions)
Run lint-staged in CI (Validation Only)
Common Pitfalls & Fixes
Hooks Not Running
| Symptom | Cause | Fix | |
|---|---|---|---|
| Hooks silently skipped | Not installed in .git/hooks/ | Run npx husky init or pre-commit install | |
| "Permission denied" | Hook file not executable | chmod +x .husky/pre-commit | |
| Hooks run but wrong ones | Stale hooks from old setup | Inspect git config core.hooksPath and preserve unrelated hooks before targeted repair | |
| Works locally, fails in CI | Different Node/Python versions | Pin versions in CI config |
Performance Issues
Bypassing Hooks (When Needed)
Warning: Bypassing hooks should be rare. If your team frequently bypasses, the hooks are too slow or too strict — fix them.
Migration Guide
Husky v4 → v9 Migration
Adopting Hooks on an Existing Project
Key Principles
- Staged files only — Never lint the entire codebase on every commit
- Auto-fix when possible —
--fixflags reduce developer friction - Fast hooks — Pre-commit should complete in < 5 seconds
- Fail loud — Clear error messages with actionable fixes
- Team-shared — Use Husky or
core.hooksPathso hooks are version-controlled - CI as backup — Hooks are convenience; CI is the enforcer
- Gradual adoption — Start with formatting, add linting, then testing
Related Skills
@codebase-audit-pre-push- Deep audit before GitHub push@verification-before-completion- Verification before claiming work is done@bash-pro- Advanced shell scripting for custom hooks@github-actions-templates- CI/CD workflow templates
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/git-hooks-automation/SKILL.md
Popularity
- Repository stars
- 23,857
- Repository forks
- 4,101
- Repository npm downloads, 7 days
- 11,772
- 7-day trend score
- 72
Stars and forks are for the whole GitHub repository, not this skill alone. Downloads are for the repository's npm package. Refreshed 17 Mar 2026, 7 months ago.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/sickn33/antigravity-awesome-skills/git-hooks-automation)