Agent skill

Git Hooks Automation

by sickn33 in sickn33/agentic-awesome-skills

Master Git hooks setup with Husky, lint-staged, pre-commit framework, and commitlint.

MITAuto-check passedDevelopment

Install Git Hooks Automation

skills CLI
$ npx skills add sickn33/agentic-awesome-skills --skill git-hooks-automation -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install sickn33/agentic-awesome-skills git-hooks-automation --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/sickn33/agentic-awesome-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/git-hooks-automation .claude/skills/git-hooks-automation && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
git-hooks-automation
GitHub stars
47k
Used in
2 other repos
Token cost
~3k tokens
SKILL.md length
585 words
Files
1
Skills in repo
1,493
Repo updated
First seen
Licence
MIT

At a glance

Master Git hooks setup with Husky, lint-staged, pre-commit framework, and commitlint.

  • Tasks that involve Linting and formatting
  • SKILL.md covers When to Use This Skill, Git Hooks Fundamentals, Husky + lint-staged (Node.js… and pre-commit Framework (Python /…, plus 7 more sections
  • Calls git, npm and npx; reaches github.com
  • Tasks that involve Commit messages

What it does

Git Hooks Automation is an agent skill from sickn33/agentic-awesome-skills. 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.

Its SKILL.md is about 3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Linting and formatting, Commit messages and Code quality. It works with Git. The repository describes itself as: AAS Core is the local, agent-first control plane for complete catalog discovery, agent-owned selection, stack validation, and planning, backed by 2,400+ agentic skills. Includes… The licence is MIT.

When your agent uses it

  • Tasks that involve Linting and formatting
  • Tasks that involve Commit messages
  • Tasks that involve Code quality

Example prompts

  • “/git-hooks-automation”

Requirements

  • Python 3
  • Node.js

What it can do on your machine

Read from SKILL.md and the folder at commit 680176d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • git
    • npm
    • npx
    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Git Hooks Automation loads about 3k tokens when it runs. Until then it costs about 53 tokens; SKILL.md has 585 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~53
When it runs · the whole SKILL.md, loaded when a task matches
~3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from sickn33/agentic-awesome-skills at commit 680176d, republished under its MIT licence (© sickn33). 585 words, ~2,962 tokens.

Download SKILL.mdSave it as .claude/skills/git-hooks-automation/SKILL.md (or your agent's skills folder).
name
git-hooks-automation
description
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.
risk
safe
source
community
date_added
2026-03-07

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
HookFires WhenCommon Use
pre-commitBefore commit is createdLint, format, type-check staged files
prepare-commit-msgAfter default msg, before editorAuto-populate commit templates
commit-msgAfter user writes commit messageEnforce commit message format
post-commitAfter commit is createdNotifications, logging
pre-pushBefore push to remoteRun tests, check branch policies
pre-rebaseBefore rebase startsPrevent rebase on protected branches
post-mergeAfter merge completesInstall deps, run migrations
post-checkoutAfter checkout/switchInstall deps, rebuild assets
Native Git Hooks (No Framework)
bash
# Create a pre-commit hook manually
cat > .git/hooks/pre-commit << 'EOF'
#!/bin/sh
set -e

# Run linter on staged files only
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(js|ts|jsx|tsx)$' || true)

if [ -n "$STAGED_FILES" ]; then
  echo "🔍 Linting staged files..."
  echo "$STAGED_FILES" | xargs npx eslint --fix
  echo "$STAGED_FILES" | xargs git add  # Re-stage after fixes
fi
EOF
chmod +x .git/hooks/pre-commit

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+)
bash
# Install
npm install --save-dev husky lint-staged

# Initialize Husky (creates .husky/ directory)
npx husky init

# The init command creates a pre-commit hook — edit it:
echo "npx lint-staged" > .husky/pre-commit
Configure lint-staged in package.json
json
{
  "lint-staged": {
    "*.{js,jsx,ts,tsx}": [
      "eslint --fix --max-warnings=0",
      "prettier --write"
    ],
    "*.{css,scss}": [
      "prettier --write",
      "stylelint --fix"
    ],
    "*.{json,md,yml,yaml}": [
      "prettier --write"
    ]
  }
}
Add Commit Message Linting
bash
# Install commitlint
npm install --save-dev @commitlint/cli @commitlint/config-conventional

# Create commitlint config
cat > commitlint.config.js << 'EOF'
module.exports = {
  extends: ['@commitlint/config-conventional'],
  rules: {
    'type-enum': [2, 'always', [
      'feat', 'fix', 'docs', 'style', 'refactor',
      'perf', 'test', 'build', 'ci', 'chore', 'revert'
    ]],
    'subject-max-length': [2, 'always', 72],
    'body-max-line-length': [2, 'always', 100]
  }
};
EOF

# Add commit-msg hook
echo "npx --no -- commitlint --edit \$1" > .husky/commit-msg
Add Pre-Push Hook
bash
# Run tests before pushing
echo "npm test" > .husky/pre-push
Complete Husky Directory Structure
project/
├── .husky/
│   ├── pre-commit        # npx lint-staged
│   ├── commit-msg        # npx --no -- commitlint --edit $1
│   └── pre-push          # npm test
├── commitlint.config.js
├── package.json          # lint-staged config here
└── ...

pre-commit Framework (Python / Polyglot)

Language-agnostic framework that works with any project. Hooks are defined in YAML and run in isolated environments.

Setup
bash
# Install (Python required)
pip install pre-commit

# Create config
cat > .pre-commit-config.yaml << 'EOF'
repos:
  # Built-in checks
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.6.0
    hooks:
      - id: trailing-whitespace
      - id: end-of-file-fixer
      - id: check-yaml
      - id: check-json
      - id: check-added-large-files
        args: ['--maxkb=500']
      - id: check-merge-conflict
      - id: detect-private-key

  # Python formatting
  - repo: https://github.com/psf/black
    rev: 24.4.2
    hooks:
      - id: black

  # Python linting
  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.4.4
    hooks:
      - id: ruff
        args: ['--fix']
      - id: ruff-format

  # Shell script linting
  - repo: https://github.com/shellcheck-py/shellcheck-py
    rev: v0.10.0.1
    hooks:
      - id: shellcheck

  # Commit message format
  - repo: https://github.com/compilerla/conventional-pre-commit
    rev: v3.2.0
    hooks:
      - id: conventional-pre-commit
        stages: [commit-msg]
EOF

# Install hooks into .git/hooks/
pre-commit install
pre-commit install --hook-type commit-msg

# Run against all files (first time)
pre-commit run --all-files
Key Commands
bash
pre-commit install              # Install hooks
pre-commit run --all-files      # Run on everything (CI or first setup)
pre-commit autoupdate           # Update hook versions
pre-commit run <hook-id>        # Run a specific hook
pre-commit clean                # Clear cached environments

Custom Hook Scripts (Any Language)

For projects not using Node or Python, write hooks directly in shell.

Portable Pre-Commit Hook
bash
#!/bin/sh
# .githooks/pre-commit — Team-shared hooks directory
set -e

echo "=== Pre-Commit Checks ==="

# 1. Prevent commits to main/master
BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null || echo "detached")
if [ "$BRANCH" = "main" ] || [ "$BRANCH" = "master" ]; then
  echo "❌ Direct commits to $BRANCH are not allowed. Use a feature branch."
  exit 1
fi

# 2. Check for debugging artifacts
if git diff --cached --diff-filter=ACM | grep -nE '(console\.log|debugger|binding\.pry|import pdb)' > /dev/null 2>&1; then
  echo "⚠️  Debug statements found in staged files:"
  git diff --cached --diff-filter=ACM | grep -nE '(console\.log|debugger|binding\.pry|import pdb)'
  echo "Remove them or use git commit --no-verify to bypass."
  exit 1
fi

# 3. Check for large files (>1MB)
LARGE_FILES=$(git diff --cached --name-only --diff-filter=ACM | while read f; do
  size=$(wc -c < "$f" 2>/dev/null || echo 0)
  if [ "$size" -gt 1048576 ]; then echo "$f ($((size/1024))KB)"; fi
done)
if [ -n "$LARGE_FILES" ]; then
  echo "❌ Large files detected:"
  echo "$LARGE_FILES"
  exit 1
fi

# 4. Check for secrets patterns
if git diff --cached --diff-filter=ACM | grep -nEi '(AKIA[0-9A-Z]{16}|sk-[a-zA-Z0-9]{48}|ghp_[a-zA-Z0-9]{36}|password\s*=\s*["\x27][^"\x27]+["\x27])' > /dev/null 2>&1; then
  echo "🚨 Potential secrets detected in staged changes! Review before committing."
  exit 1
fi

echo "✅ All pre-commit checks passed"
Share Custom Hooks via core.hooksPath
bash
# In your repo, set a shared hooks directory
git config core.hooksPath .githooks

# Add to project setup docs or Makefile
# Makefile
setup:
	git config core.hooksPath .githooks
	chmod +x .githooks/*

CI Integration

Hooks are a first line of defense, but CI is the source of truth.

Run pre-commit in CI (GitHub Actions)
yaml
# .github/workflows/lint.yml
name: Lint
on: [push, pull_request]
jobs:
  pre-commit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.12'
      - uses: pre-commit/action@v3.0.1
Run lint-staged in CI (Validation Only)
yaml
# Validate that lint-staged would pass (catch bypassed hooks)
name: Lint Check
on: [pull_request]
jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npm ci
      - run: npx eslint . --max-warnings=0
      - run: npx prettier --check .
Show full SKILL.md (234 more words)Show less

Common Pitfalls & Fixes

Hooks Not Running
SymptomCauseFix
Hooks silently skippedNot installed in .git/hooks/Run npx husky init or pre-commit install
"Permission denied"Hook file not executablechmod +x .husky/pre-commit
Hooks run but wrong onesStale hooks from old setupDelete .git/hooks/ contents, reinstall
Works locally, fails in CIDifferent Node/Python versionsPin versions in CI config
Performance Issues
json
// ❌ Slow: runs on ALL files every commit
{
  "scripts": {
    "precommit": "eslint src/ && prettier --write src/"
  }
}

// ✅ Fast: lint-staged runs ONLY on staged files
{
  "lint-staged": {
    "*.{js,ts}": ["eslint --fix", "prettier --write"]
  }
}
Bypassing Hooks (When Needed)
bash
# Skip all hooks for a single commit
git commit --no-verify -m "wip: quick save"

# Skip pre-push only
git push --no-verify

# Skip specific pre-commit hooks
SKIP=eslint git commit -m "fix: update config"

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
bash
# 1. Remove old Husky
npm uninstall husky
rm -rf .husky

# 2. Remove old config from package.json
# Delete "husky": { "hooks": { ... } } section

# 3. Install fresh
npm install --save-dev husky
npx husky init

# 4. Recreate hooks
echo "npx lint-staged" > .husky/pre-commit
echo "npx --no -- commitlint --edit \$1" > .husky/commit-msg

# 5. Clean up — old Husky used package.json config,
#    new Husky uses .husky/ directory with plain scripts
Adopting Hooks on an Existing Project
bash
# Step 1: Start with formatting only (low friction)
# lint-staged config:
{ "*.{js,ts}": ["prettier --write"] }

# Step 2: Add linting after team adjusts (1-2 weeks later)
{ "*.{js,ts}": ["eslint --fix", "prettier --write"] }

# Step 3: Add commit message linting
# Step 4: Add pre-push test runner

# Gradual adoption prevents team resistance

Key Principles

  • Staged files only — Never lint the entire codebase on every commit
  • Auto-fix when possible — --fix flags 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.hooksPath so hooks are version-controlled
  • CI as backup — Hooks are convenience; CI is the enforcer
  • Gradual adoption — Start with formatting, add linting, then testing
  • @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

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

© sickn33, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/git-hooks-automation of sickn33/agentic-awesome-skills.

Open the folder on GitHubat commit 680176d

Used in 2 other repositories

We found 11 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in sickn33/agentic-awesome-skills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Git Hooks Automation next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Git Hooks Automation compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Git Hooks Automation this skillsickn33/agentic-awesome-skills47k2 repos~3kAutomated safety check: PassMIT
Saleor Commit Workflowsaleor/saleor23k—~575Automated safety check: PassBSD-3-Clause
Lint Commit PRTresjs/tres3.8k—~1.1kAutomated safety check: PassMIT
PR Pushicebear0828/codex-proxy1.8k—~2.2kAutomated safety check: NotesCustom licence
PR Pushicebear0828/codex-proxy1.8k—~2.3kAutomated safety check: NotesCustom licence
Commitantiwork/gumroad9.8k—~503Automated safety check: PassMIT

Similar skills

  • Commits changes in the Saleor codebase and works through pre-commit hook failures from ruff, mypy, the GraphQL schema check and the migrations check.

    23k GitHub stars~575 tokensUpdated today
    DevelopmentAuto-check passed
  • Lint Commit PR

    Tresjs/tres

    Lint local changes, auto-fix, conventional commit, and optionally create PR

    3.8k GitHub stars~1.1k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • PR Push

    icebear0828/codex-proxy

    Package the current working changes into a standards-compliant codex-proxy pull request: branch hygiene, commit message linting, CHANGELOG prompt, conventional commit, push, and gh pr create against…

    1.8k GitHub stars~2.2k tokensUpdated today
    DevelopmentAuto-check: notes
  • PR Push

    icebear0828/codex-proxy

    Package the current working changes into a standards-compliant codex-proxy pull request: branch hygiene, commit message linting, CHANGELOG prompt, conventional commit, push, and gh pr create against…

    1.8k GitHub stars~2.3k tokensUpdated today
    DevelopmentAuto-check: notes
  • Commit

    antiwork/gumroad

    Stage and commit changes with a clear, concise commit message.

    9.8k GitHub stars~503 tokensUpdated today
    DevelopmentAuto-check passed
  • WebRTC Include Cleaner

    webrtc-sdk/webrtc

    Runs the WebRTC include-cleaner tool to add missing and remove unused C++ include directives before uploading a CL or after refactoring.

    446 GitHub starsUsed in 1 repo~545 tokens
    DevelopmentAuto-check passed

More from sickn33/agentic-awesome-skills

All 1,493 skills in this repo
  • Liuguang Banlan UI

    sickn33/agentic-awesome-skills

    Implements an interface in one of two named color modes, iridescent white or colorful black, from a parameterized starter that reports measured color intensity.

    47k GitHub starsUsed in 1 repo~2.5k tokens
    Auto-check passed
  • User Thoughts Memory

    sickn33/agentic-awesome-skills

    Saves a user's project decisions, rules and preferences into a project-local mdbase so later sessions and other agents can recover the intent.

    47k GitHub starsUsed in 1 repo~2.5k tokens
    Auto-check passed
  • Using LWC Memory and Graphs

    sickn33/agentic-awesome-skills

    Keeps project decisions, research and verified results available across coding-agent sessions through LWC memory, a document Wiki graph and a CodeGraph code index.

    47k GitHub starsUsed in 1 repo~2k tokens
    Auto-check passed
  • Find Complementary Founders

    sickn33/agentic-awesome-skills

    Guides an agent through assessing its own owner for cofounder fit, publishing an approved profile, and ranking complementary profiles other agents published for their owners.

    47k GitHub starsUsed in 1 repo~4.8k tokens
    Auto-check passed
  • Whatsapp Cloud API

    sickn33/agentic-awesome-skills

    Integracao com WhatsApp Business Cloud API (Meta). An agent skill from sickn33/agentic-awesome-skills.

    47k GitHub starsUsed in 2 repos~4.5k tokens
    Auto-check passed
  • Cline Pilot

    sickn33/agentic-awesome-skills

    Acts as a proxy for the Cline CLI, dispatching coding tasks one at a time, monitoring runs by hard evidence, relaying decisions to you and learning per-project preferences.

    47k GitHub starsUsed in 1 repo~4.6k tokens
    Auto-check passed

Works with

Categories

Questions about Git Hooks Automation

What does Git Hooks Automation do?

Master Git hooks setup with Husky, lint-staged, pre-commit framework, and commitlint. Git Hooks Automation is an agent skill from sickn33/agentic-awesome-skills. Master Git hooks setup with Husky, lint-staged, pre-commit framework, and commitlint.

When should I use Git Hooks Automation?

Git Hooks Automation fits situations like: tasks that involve Linting and formatting; tasks that involve Commit messages; tasks that involve Code quality.

How do I install Git Hooks Automation in Claude Code?

Run `npx skills add sickn33/agentic-awesome-skills --skill git-hooks-automation -a claude-code`. Or copy the skill folder (skills/git-hooks-automation in sickn33/agentic-awesome-skills) into .claude/skills/git-hooks-automation in your project. Claude Code loads it when a task matches its description.

How do I install Git Hooks Automation in Codex?

Run `npx skills add sickn33/agentic-awesome-skills --skill git-hooks-automation -a codex`. Or copy the skill folder (skills/git-hooks-automation in sickn33/agentic-awesome-skills) into .agents/skills/git-hooks-automation in your project. Codex loads it when a task matches its description.

Can I use Git Hooks Automation in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add sickn33/agentic-awesome-skills --skill git-hooks-automation -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/git-hooks-automation, .gemini/skills/git-hooks-automation, .github/skills/git-hooks-automation and .opencode/skills/git-hooks-automation in your project.

What does Git Hooks Automation need to run?

Going by SKILL.md and its folder, Git Hooks Automation needs the command-line tools its instructions call (git, npm, npx and pip). Our summary lists: Python 3; Node.js.

Does Git Hooks Automation access the network?

SKILL.md names 1 domain. In commands or code: github.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Git Hooks Automation safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Git Hooks Automation use?

Git Hooks Automation is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Git Hooks Automation use?

About 3k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Git Hooks Automation?

Skills that share tags, products or a category with Git Hooks Automation: Saleor Commit Workflow (saleor/saleor, 23k stars), Lint Commit PR (Tresjs/tres, 3.8k stars), PR Push (icebear0828/codex-proxy, 1.8k stars) and PR Push (icebear0828/codex-proxy, 1.8k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Git Hooks Automation?

sickn33 (a GitHub user) maintains it in sickn33/agentic-awesome-skills, which has 47,379 GitHub stars. The repository holds 1,493 skills in this directory. The repository was last updated on October 9, 2026.

Source: sickn33/agentic-awesome-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.