File contents Git Hooks Setup
Table of Contents
Overview
Configure Git hooks to enforce code quality standards, run automated checks, and prevent problematic commits from being pushed to shared repositories.
When to Use
Pre-commit code quality checks
Commit message validation
Preventing secrets in commits
Running tests before push
Code formatting enforcement
Linting configuration
Team-wide standards enforcement
Quick Start
Minimal working example:
#!/bin/bash
# setup-husky.sh
# Install Husky
npm install husky --save-dev
# Initialize Husky
npx husky install
# Create pre-commit hook
npx husky add .husky/pre-commit "npm run lint"
# Create commit-msg hook
npx husky add .husky/commit-msg 'npx --no -- commitlint --edit "$1"'
# Create pre-push hook
npx husky add .husky/pre-push "npm run test"
# Create post-merge hook
npx husky add .husky/post-merge "npm install"
Reference Guides
Detailed implementations in the references/ directory:
Guide
Contents
Husky Installation and Configuration
Husky Installation and Configuration
Pre-commit Hook (Node.js)
Pre-commit Hook (Node.js)
Commit Message Validation
Commit Message Validation
Commitlint Configuration
Commitlint Configuration, Pre-push Hook (Comprehensive)
Pre-commit Framework (Python)
Pre-commit Framework (Python)
Secret Detection Hook
Secret Detection Hook, Husky in package.json
Best Practices
✅ DO
Enforce pre-commit linting and formatting
Validate commit message format
Scan for secrets before commit
Run tests on pre-push
Skip hooks only with --no-verify (rarely)
Document hook requirements in README
Use consistent hook configuration
Make hooks fast (< 5 seconds)
Provide helpful error messages
Allow developers to bypass with clear warnings
❌ DON'T
Skip checks with --no-verify
Store secrets in committed files
Use inconsistent implementations
Ignore hook errors
Run full test suite on pre-commit
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1 --- 2 name: aj-geddes-useful-ai-prompts-git-hooks-setup 3 description: Git Hooks Setup 4 --- 5 6 # Git Hooks Setup 7 8 ## Table of Contents 9 10 - [Overview](#overview) 11 - [When to Use](#when-to-use) 12 - [Quick Start](#quick-start) 13 - [Reference Guides](#reference-guides) 14 - [Best Practices](#best-practices) 15 16 ## Overview 17 18 Configure Git hooks to enforce code quality standards, run automated checks, and prevent problematic commits from being pushed to shared repositories. 19 20 ## When to Use 21 22 - Pre-commit code quality checks 23 - Commit message validation 24 - Preventing secrets in commits 25 - Running tests before push 26 - Code formatting enforcement 27 - Linting configuration 28 - Team-wide standards enforcement 29 30 ## Quick Start 31 32 Minimal working example: 33 34 ```bash 35 #!/bin/bash 36 # setup-husky.sh 37 38 # Install Husky 39 npm install husky --save-dev 40 41 # Initialize Husky 42 npx husky install 43 44 # Create pre-commit hook 45 npx husky add .husky/pre-commit "npm run lint" 46 47 # Create commit-msg hook 48 npx husky add .husky/commit-msg 'npx --no -- commitlint --edit "$1"' 49 50 # Create pre-push hook 51 npx husky add .husky/pre-push "npm run test" 52 53 # Create post-merge hook 54 npx husky add .husky/post-merge "npm install" 55 ``` 56 57 ## Reference Guides 58 59 Detailed implementations in the `references/` directory: 60 61 | Guide | Contents | 62 |---|---| 63 | [Husky Installation and Configuration](references/husky-installation-and-configuration.md) | Husky Installation and Configuration | 64 | [Pre-commit Hook (Node.js)](references/pre-commit-hook-nodejs.md) | Pre-commit Hook (Node.js) | 65 | [Commit Message Validation](references/commit-message-validation.md) | Commit Message Validation | 66 | [Commitlint Configuration](references/commitlint-configuration.md) | Commitlint Configuration, Pre-push Hook (Comprehensive) | 67 | [Pre-commit Framework (Python)](references/pre-commit-framework-python.md) | Pre-commit Framework (Python) | 68 | [Secret Detection Hook](references/secret-detection-hook.md) | Secret Detection Hook, Husky in package.json | 69 70 ## Best Practices 71 72 ### ✅ DO 73 74 - Enforce pre-commit linting and formatting 75 - Validate commit message format 76 - Scan for secrets before commit 77 - Run tests on pre-push 78 - Skip hooks only with `--no-verify` (rarely) 79 - Document hook requirements in README 80 - Use consistent hook configuration 81 - Make hooks fast (< 5 seconds) 82 - Provide helpful error messages 83 - Allow developers to bypass with clear warnings 84 85 ### ❌ DON'T 86 87 - Skip checks with `--no-verify` 88 - Store secrets in committed files 89 - Use inconsistent implementations 90 - Ignore hook errors 91 - Run full test suite on pre-commit 92 93 --- 94 > Converted and distributed by [TomeVault](https://tomevault.io/claim/aj-geddes) — claim your Tome and manage your conversions. 95 <!-- tomevault:4.0:skill_md:2026-04-11 -->
tomevault-io/skills-registry/tree/main/aj-geddes--useful-ai-prompts--git-hooks-setup commit 2f6b833de4
Frequently asked questions How do I install the Aj Geddes Useful AI Prompts Git Hooks Setup skill? Run npx skillmds@latest add tomevault-io/aj-geddes-useful-ai-prompts-git-hooks-setup in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
What does the Aj Geddes Useful AI Prompts Git Hooks Setup skill do? Git Hooks Setup It is listed under Coding & Dev Tools on SkillMD.
Is Aj Geddes Useful AI Prompts Git Hooks Setup safe to use? This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
Which AI agents work with Aj Geddes Useful AI Prompts Git Hooks Setup? This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Is Aj Geddes Useful AI Prompts Git Hooks Setup free to use? Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Who published Aj Geddes Useful AI Prompts Git Hooks Setup? tomevault-io (@tomevault-io) published this skill. Their other Agent Skills are listed on their SkillMD profile.