git-hooks-setup

aj-geddes/useful-ai-prompts · updated Apr 8, 2026

$npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill git-hooks-setup
0 commentsdiscussion
summary

Configure Git hooks to enforce code quality standards, run automated checks, and prevent problematic commits from being pushed to shared repositories.

skill.md

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

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.529 reviews
  • Shikha Mishra· Dec 28, 2024

    git-hooks-setup has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Yuki Abebe· Dec 12, 2024

    I recommend git-hooks-setup for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Yash Thakker· Nov 19, 2024

    Solid pick for teams standardizing on skills: git-hooks-setup is focused, and the summary matches what you get after install.

  • Hassan Lopez· Nov 11, 2024

    git-hooks-setup is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Hassan Flores· Nov 3, 2024

    Keeps context tight: git-hooks-setup is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Dev Agarwal· Oct 22, 2024

    Registry listing for git-hooks-setup matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Dhruvi Jain· Oct 10, 2024

    We added git-hooks-setup from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Noor Mensah· Oct 2, 2024

    git-hooks-setup fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Oshnikdeep· Sep 17, 2024

    git-hooks-setup fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Sophia Ghosh· Sep 17, 2024

    I recommend git-hooks-setup for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

showing 1-10 of 29

1 / 3