git-hooks-setup

git-hooks-setup is a skill for Claude Code, Codex from wu529778790/shenzjd-skills. It costs 42 tokens per session (1,941 once invoked), scanned A, original, MIT.

A setup guide for Git hooks, which are scripts that run automatically during actions such as committing or pushing code.

In plain words
What is it for?
Configuring pre-commit, commit-message, and pre-push checks with Husky or Git’s built-in hook system.
Why use it?
It helps catch formatting, linting, test, commit-message, or secret-related problems before code is committed or sent to a shared repository.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Configuring pre-commit, commit-message, and pre-push checks with Husky or Git’s built-in hook system.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/wu529778790/shenzjd-skills/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 wu529778790/shenzjd-skills --skill git-hooks-setup
Clone the repo
git clone --depth 1 https://github.com/wu529778790/shenzjd-skills

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/wu529778790/shenzjd-skills/git-hooks-setup/github.svg)](https://agentmods.dev/skills/wu529778790/shenzjd-skills/git-hooks-setup)
Your own site
<a href="https://agentmods.dev/skills/wu529778790/shenzjd-skills/git-hooks-setup"><img src="https://agentmods.dev/badge/skills/wu529778790/shenzjd-skills/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/wu529778790/shenzjd-skills/git-hooks-setup"><img src="https://agentmods.dev/badge/skills/wu529778790/shenzjd-skills/git-hooks-setup.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,941 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 13 Aug 2026
  • Snyk fail 13 Aug 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.00042 $0.01941
Opus 5 $0.00021 $0.00971
Sonnet 5 $0.00008 $0.00388
Haiku 4.5 $0.00004 $0.00194

Measured 11d ago against content hash 62468233e18f, 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 11d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (templates/commitlint.config.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.

git-hooks-setup/SKILL.md · 185 lines

How it starts

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

Git Hooks Setup

一键配置 Git Hooks,标准化团队开发流程。

Overview

自动生成 pre-commit / commit-msg / pre-push hook 配置,包含代码格式化、commit message 校验、敏感信息检查。支持 husky 和原生 git hooks 两种方案。

When to Use

  • User wants to set up git hooks
  • User mentions pre-commit or commit message conventions
  • User wants to automate lint/format checks
  • User inputs /git-hooks-setup
  • User wants to enforce pre-push checks (tests, lint)
  • User wants to prevent pushing broken code
  • User wants to standardize team commit message format
  • User wants to add secret scanning before commit
  • User wants to auto-format code on every commit

When NOT to Use:

  • User only wants to view current git hooks configuration
  • User wants CI-based checks (no local hooks needed)
  • User's project already has a complete hooks setup
  • User wants to run hooks on specific files only (use lint-staged directly)
  • User wants to hook into Git events other than pre-commit/commit-msg/push

Core Pattern

Step 1: 检测项目环境

# 检测包管理器(按 lock 文件判断)
if [ -f "package-lock.json" ]; then PACKAGE_MANAGER="npm"
elif [ -f "yarn.lock" ]; then PACKAGE_MANAGER="yarn"
elif [ -f "pnpm-lock.yaml" ]; then PACKAGE_MANAGER="pnpm"

# 检测已有 hooks 配置
test -d ".husky" && echo "husky 已配置"
test -f ".git/hooks/pre-commit" && echo "原生 hooks 已配置"

# 从 package.json 检测已安装的 lint 工具(eslint/prettier/lint 相关)

Step 2: 选择方案

方案 适用场景 优点
husky Node.js 项目 团队协作友好,配置即代码
原生 git hooks 非 Node.js 项目 无依赖

Step 3: 生成配置

方案 A: Husky

# 根据 $PACKAGE_MANAGER 选择: pnpm dlx / yarn dlx / npx
husky init    # 初始化 husky

生成 .husky/pre-commit(执行 lint-staged)和 .husky/commit-msg(执行 commitlint),注意 commitlint 需加 --no 前缀避免交互式安装。

生成 lint-staged 配置(写入 package.json):

{
  "lint-staged": {
    "*.{ts,tsx,js,jsx}": ["eslint --fix", "prettier --write"],
    "*.{json,md,yml}": ["prettier --write"]
  }
}

生成 .husky/pre-push(可选,push 前跑测试):

# 根据包管理器选择命令
if [ "$PACKAGE_MANAGER" = "pnpm" ]; then
  pnpm test
elif [ "$PACKAGE_MANAGER" = "yarn" ]; then
  yarn test
else
  npm test
fi

Read the full file on GitHub · 185 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 11d ago First seen · 185 lines · 42 tokens per session scan A 62468233e18f

Subscribe to this mod's changes

git-hooks-setup is a skill published in the GitHub repository wu529778790/shenzjd-skills (0 stars, last pushed 4d ago), licensed MIT. It adds 42 tokens to every session and 1,941 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-08-31.