git-hooks-setup

git-hooks-setup is a skill for Claude Code, Codex from aj-geddes/useful-ai-prompts. It costs 35 tokens per session (638 once invoked), scanned A, original, MIT.

A guide to configuring Git hooks, scripts that run automatically at points such as before a commit or push. It covers Husky, checks for code quality, and custom validation scripts.

In plain words
What is it for?
Use it to set up pre-commit and pre-push tests, commit-message validation, formatting and linting checks, secret detection, and post-merge setup tasks.
Why use it?
It helps catch formatting, linting, test, commit-message, or secret-related problems before changes reach a shared repository. The checks run as part of the normal Git workflow.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Use it to set up pre-commit and pre-push tests, commit-message validation, formatting and linting checks, secret detection, and post-merge setup tasks.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/aj-geddes/useful-ai-prompts/git-hooks-setup
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add aj-geddes/useful-ai-prompts --skill git-hooks-setup
Clone the repo
git clone --depth 1 https://github.com/aj-geddes/useful-ai-prompts

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for git-hooks-setup

README.md
[![agentmods](https://agentmods.dev/badge/skills/aj-geddes/useful-ai-prompts/git-hooks-setup/github.svg)](https://agentmods.dev/skills/aj-geddes/useful-ai-prompts/git-hooks-setup)
Your own site
<a href="https://agentmods.dev/skills/aj-geddes/useful-ai-prompts/git-hooks-setup"><img src="https://agentmods.dev/badge/skills/aj-geddes/useful-ai-prompts/git-hooks-setup/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for git-hooks-setup

Your own site · 80×15
<a href="https://agentmods.dev/skills/aj-geddes/useful-ai-prompts/git-hooks-setup"><img src="https://agentmods.dev/badge/skills/aj-geddes/useful-ai-prompts/git-hooks-setup.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 638 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 18 Mar 2026
  • Snyk warn 5 Mar 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00035 $0.00638
Opus 5 $0.00017 $0.00319
Sonnet 5 $0.00007 $0.00128
Haiku 4.5 $0.00003 $0.00064

Measured 9d ago against content hash 7b50de1946f5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

git-hooks-setup scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/scaffold-tests.sh, templates/test-template.js), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/git-hooks-setup/SKILL.md · 94 lines

How it starts

The opening of the file, as written. The whole thing — 94 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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

Read the full file on GitHub · 94 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 94 lines · 35 tokens per session scan A 7b50de1946f5

Subscribe to this mod's changes

git-hooks-setup is a skill published in the GitHub repository aj-geddes/useful-ai-prompts (338 stars, last pushed 6mo ago), licensed MIT. It adds 35 tokens to every session and 638 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.