Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
aj-geddes avatar

Git Hooks Setup

  • 367 installs
  • 305 repo stars
  • Updated March 4, 2026
  • aj-geddes/useful-ai-prompts

git-hooks-setup is an agent skill that configures Husky, pre-commit, and commitlint Git hooks to enforce linting, formatting, secret scanning, and tests before developers commit or push code.

About

Prompt skill from aj-geddes/useful-ai-prompts for git hooks setup: walks through installing and configuring pre-commit tooling, linking formatters and test runners, and standardizing commit hygiene across a repo.

  • Husky or native hook setup
  • Lint and test on commit
  • Commit message conventions
  • Hook performance tuning
  • Team onboarding for hooks

Git Hooks Setup by the numbers

  • 367 all-time installs (skills.sh)
  • +9 installs in the week ending Jun 23, 2026 (Skillselion tracking)
  • Ranked #126 of 733 Git & Pull Requests skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill git-hooks-setup

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs367
repo stars305
Last updatedMarch 4, 2026
Repositoryaj-geddes/useful-ai-prompts

How do you set up Git pre-commit and pre-push hooks?

Configure pre-commit, pre-push, and commit-msg hooks to enforce linting, tests, formatting, and conventional commits before code merges.

Who is it for?

Developers standardizing lint, conventional commits, and pre-push tests across JavaScript or Python repositories using Husky or pre-commit.

Skip if: Teams that rely solely on server-side CI with no local hook enforcement or repositories that cannot run npm or pre-commit tooling.

When should I use this skill?

A developer needs pre-commit linting, commit message validation, secret scanning, or pre-push test hooks before merging to main.

What you get

.husky hook scripts, commitlint configuration, pre-commit lint and test gates, and documented team hook requirements in README.

  • .husky hook scripts
  • commitlint config
  • secret-scan hook

By the numbers

  • Bundles 6 reference guides for Husky, pre-commit, and commitlint
  • Quick Start configures 4 Husky hooks: pre-commit, commit-msg, pre-push, post-merge

Files

SKILL.mdMarkdownGitHub ↗

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:

GuideContents
Husky Installation and ConfigurationHusky Installation and Configuration
Pre-commit Hook (Node.js)Pre-commit Hook (Node.js)
Commit Message ValidationCommit Message Validation
Commitlint ConfigurationCommitlint Configuration, Pre-push Hook (Comprehensive)
Pre-commit Framework (Python)Pre-commit Framework (Python)
Secret Detection HookSecret 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

Related skills

How it compares

Use git-hooks-setup when you want opinionated Husky and commitlint recipes instead of writing raw .git/hooks scripts from scratch.

FAQ

Which hook tools does git-hooks-setup cover?

git-hooks-setup documents Husky for Node projects, the Python pre-commit framework, commitlint for conventional commits, and a secret-detection hook pattern. git-hooks-setup includes six reference guides with full installation and configuration steps.

What hooks does the git-hooks-setup Quick Start create?

git-hooks-setup Quick Start adds Husky pre-commit running npm run lint, commit-msg invoking commitlint, pre-push running npm run test, and post-merge running npm install to refresh dependencies after pulls.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.