Skip to content
Back to skills

Git Hooks Patterns

ASecurity

Use for hooks/, InstallGitHooks, staged check orchestration, or sensitive pattern/allowlist behavior. Not for general CI workflow changes or dotfiles.sh/.ps1 bootstrap wrappers (use self-update).

  • 3 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added August 31, 2026
toolsrusttestinggit

Security analysis

A100/100

Scanned December 3, 2026

npx -y skills add sneivandt/dotfiles --skill git-hooks-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Git Hooks Patterns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Git Hooks Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/sneivandt-git-hooks-patterns/badge)](https://www.skillsdirectory.com/skills/sneivandt-git-hooks-patterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: git-hooks-patterns
description: >
  Use for hooks/, InstallGitHooks, staged check orchestration, or sensitive
  pattern/allowlist behavior. Not for general CI workflow changes or
  dotfiles.sh/.ps1 bootstrap wrappers (use self-update).
---

# Git Hooks Patterns

## Installation and ownership

- `InstallGitHooks` installs extensionless files from `hooks/` via Git's common
  dir or `core.hooksPath` (a linked worktree has a `.git` file, not a hooks
  directory). Keep directory enumeration in `run()`, not `should_run()`.
- By default the installed `pre-commit` entry point is a copy, while it resolves
  `hooks/check-*.sh` helpers from the checkout root at runtime (`pre-commit`
  runs `check-sensitive.sh`, `check-rust.sh`, and fast checks in
  `check-ci-guards.sh`; `DOTFILES_HOOKS_FULL=1` enables the heavier checks in
  `check-rust.sh` and `check-ci-guards.sh`). Entry-point edits need
  redeployment; helper-only edits take effect immediately.
- If `core.hooksPath` already points at the tracked `hooks/` sources, preserve
  them rather than copying over or removing them.

## Staged-content and sensitive-pattern rules

- All scripts under `hooks/` are POSIX `sh` (`#!/bin/sh`).
- Scan staged Git blobs, not working-tree files—a partially staged file's
  working-tree content may differ from what is being committed. Cover spaces in
  filenames, renames, deletions, and empty diffs.
- `hooks/sensitive-patterns.ini` and `hooks/sensitive-allowlist.ini` use
  extended regexes. Allowlist rules strip only the matched safe span so the
  remainder of the line is still scanned; test both that the false positive
  clears and that a real secret on the same line still trips detection.

## Verification

See [Staged hook checks](../../../docs/content/development/pre-push-verification.md#staged-hook-checks)
and [Wrapper and hook tests](../../../docs/content/development/testing.md#wrapper-and-hook-tests).
`test_git_hooks.py` runs commits in its own disposable temp repository without
touching the caller's checkout. Use `ci-cd-patterns` when changing CI parity scope.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in tools →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.