Token导航 LogoToken导航

Agent Skill · 运维和基础设施

git-hooks(git 钩子)

git-hooks 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

git-hooks 是运维和基础设施类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证为 MIT,第三方扫描已通过,按安装量在运维和基础设施类的 2,449 个 Skill 里排第 2,221。

总安装 240周安装 10GitHub Stars 61下载 80核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:git-hooks(git 钩子)
来源仓库:https://github.com/melodic-software/claude-code-plugins
仓库路径:skills/git-hooks
安装命令:
npx skills add https://github.com/melodic-software/claude-code-plugins --skill git-hooks
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/melodic-software/claude-code-plugins --skill git-hooks

这个 Skill 是做什么的

运维和基础设施类 Skill 处理部署、监控、日志和云资源,多数需要较高的执行权限。

用于处理 GitHub 仓库、Issue 和 Pull Request 协作信息。适合围绕代码变更、仓库状态和协作事项进行整理。建议结合原始 README 了解具体操作流程。安装前需确认权限范围、维护状态及是否会触发网络请求。git-hooks 属于运维和基础设施类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/git-hooks

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/melodic-software/claude-code-plugins --skill g…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

git-hooks 怎么安装?

在终端执行 npx skills add https://github.com/melodic-software/claude-code-plugins --skill git-hooks。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

git-hooks 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

git-hooks 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 npx skills add https://github.com/melodic-software/claude-code-plugins --skill git-hooks;npx skills add melodic-software/claude-code-plugins --skill "git-hooks" 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

git-hooks 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

git-hooks 用的人多吗?

公开数据是累计安装 240 次,近一周安装 10 次,下载 80 次,GitHub 61 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

git-hooks 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理运维和基础设施类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要厂商级技术支持和 SLA 的生产系统。

运维和基础设施类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
brainstorming

头脑风暴 · Codex、Claude

3,148,776173,131操作浏览器MIT通过
copywriting

文案写作 · Codex、Claude

1,996,72425,583需要联网MIT通过
openclaw-secure-linux-cloud

OpenClaw secure linux cloud 命令行 · Codex、Claude

1,853,08840接触敏感数据未明确未通过
xget

xget 命令行 · Codex、Claude

1,799,28040执行命令未明确未通过
requesting-code-review

代码审查请求 · Codex、Claude

1,590,144173,103权限未标注MIT通过
git-hooks

git 钩子 · 本页

24061执行命令MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Git Hooks

Overview

This skill provides comprehensive guidance on modern git hook implementations across multiple ecosystems, with primary focus on.NET/C# and strong support for JavaScript/TypeScript and Python. It covers framework selection, setup workflows, performance optimization, security integration, testing strategies, and team collaboration patterns.

Key capabilities:

  1. Adaptive framework recommendations based on ecosystem, scale, and requirements
  2. Complete lifecycle support from tool selection → setup → configuration → testing → maintenance
  3. Performance-first approach with parallel execution and incremental processing patterns
  4. Security by default with mandatory secret scanning integration
  5. CI/CD integration for defense-in-depth validation (local + remote)
  6. Real-world examples with copy-paste ready configurations

When to Use This Skill

Use this skill when you need to:

  • Set up git hooks for a new or existing project
  • Choose a git hook framework (Husky.Net vs lefthook vs Husky vs pre-commit)
  • Configure pre-commit hooks for code formatting, linting, security scanning
  • Configure commit-msg hooks for Conventional Commits validation
  • Configure pre-push hooks for running tests or build validation
  • Integrate ecosystem tools (dotnet format, ESLint/Prettier, Black/Ruff/mypy)
  • Enforce Conventional Commits with commitlint
  • Scan for secrets before commits (gitleaks, TruffleHog)
  • Optimize hook performance (slow hooks blocking developers)
  • Test git hooks (unit testing, integration testing)
  • Deploy hooks to a team (automatic installation, CI/CD enforcement)
  • Troubleshoot hook issues (activation problems, performance issues)
  • Handle monorepo hook patterns

Trigger scenarios:

  • "Set up git hooks for my.NET project"
  • "How do I enforce code formatting before commits?"
  • "Configure Conventional Commits validation"
  • "My pre-commit hook is too slow"
  • "Should I use Husky.Net or lefthook for C#?"
  • "Integrate secret scanning with git hooks"

Quick Start Decision Tree

Which framework should I use?

Answer these questions:

  1. What's your primary ecosystem?

- .NET/C# only → Consider Husky.Net (native integration) or lefthook (performance) - JavaScript/TypeScript only → Use Husky + lint-staged + commitlint - Python only → Use pre-commit framework - Multiple languages (polyglot) → Use lefthook or pre-commit

  1. What's your team size/scale?

- Solo developer or small team → Any framework works; choose based on ecosystem - Medium team (5-20) → Prioritize ease of installation and CI/CD integration - Large team/enterprise (20+) → Prioritize performance (lefthook), standardization

  1. What's your performance requirement?

- Speed is critical → Use lefthook (parallel execution, Go-based) - Speed is moderate concern → Any framework with incremental processing - Speed is not a concern → Choose based on ecosystem familiarity

Quick recommendations

EcosystemSolo/Small TeamMedium TeamLarge Team/Enterprise
.NET/C#Husky.NetHusky.Net or lefthooklefthook
JavaScript/TypeScriptHusky + lint-stagedHusky + lint-stagedHusky + lint-staged or lefthook
Pythonpre-commitpre-commitpre-commit or lefthook
Polyglotlefthook or pre-commitlefthooklefthook

Framework Comparison at a Glance

FeatureHusky.NetlefthookHusky (JS)pre-commit
PerformanceModerateExcellent (parallel)Good (with lint-staged)Good
Ecosystem.NET/C#AnyJavaScript/TSAny (Python primary)
Config FormatJSON (task-runner.json)YAMLShell scripts + package.jsonYAML
Parallel Execution❌ No✅ Yes❌ NoPartial
Learning CurveLow (.NET devs)ModerateLow (JS devs)Low (Python devs)
Monorepo SupportModerateExcellentExcellentGood

📖 For detailed comparison: See references/framework-comparison.md for comprehensive feature analysis, pros/cons, and selection criteria.

Core Capabilities

1..NET/C# Workflows

Quick Start: Install Husky.Net (dotnet tool install Husky) or lefthook (scoop install lefthook), configure task-runner.json or lefthook.yml, and verify.

Key patterns:

  • Use ${staged} or {staged_files} for incremental processing
  • Integrate dotnet format (pre-commit) and dotnet test (pre-push)
  • Attach Husky.Net to.csproj for automatic team installation

📖 For complete setup: See references/setup-workflows.md

Examples:


2. JavaScript/TypeScript Workflows

Quick Start: Install dependencies (npm install --save-dev husky lint-staged @commitlint/cli), initialize Husky (npx husky init), configure lint-staged in package.json, and add hooks.

Key patterns:

  • Use lint-staged for incremental processing (15x speedup)
  • Integrate ESLint, Prettier, and commitlint
  • Automatic installation via prepare script

📖 For complete setup: See references/setup-workflows.md

Examples:


3. Python Workflows

Quick Start: Install pre-commit (pip install pre-commit), create .pre-commit-config.yaml with Black/Ruff/mypy hooks, and run pre-commit install.

Key patterns:

  • Use Ruff for 10-100x faster linting than Flake8/pylint
  • Extensive plugin ecosystem (hundreds of pre-built hooks)
  • Automatic environment management

📖 For complete setup: See references/setup-workflows.md

Examples:


4. Polyglot Workflows

For repositories with multiple languages, use lefthook (recommended for performance) or pre-commit.

📖 For complete setup: See references/setup-workflows.md

Examples:


5. Conventional Commits & Semantic Versioning

Tools: commitlint (validation), commitizen (interactive prompts), semantic-release (automated versioning)

Quick Start: Install commitlint, configure rules, add commit-msg hook

📖 For complete setup: See references/conventional-commits.md

Examples:


6. Security & Secret Scanning

Tools: gitleaks (secret detection), TruffleHog (800+ secret types with API validation)

Quick Start: Install gitleaks/TruffleHog, add to pre-commit hooks, configure allowlist for false positives

Best Practice: Scan locally (pre-commit) AND in CI/CD (pull requests)

📖 For complete setup: See references/secret-scanning.md


7. Performance Optimization

Key strategies:

  1. Incremental processing - Only process staged files (15x speedup)
  2. Parallel execution - Run hooks in parallel with lefthook (90% speedup)
  3. Fast tools - Use Ruff (10-100x faster than Flake8/pylint)
  4. Caching - ESLint --cache, dotnet --no-build

📖 For detailed strategies: See references/performance-optimization.md


8. Testing & Validation

Levels:

  • Unit testing - Test individual hook scripts
  • Integration testing - Test complete workflow
  • CI/CD validation - Run same checks locally and remotely (defense in depth)

📖 For examples and patterns: See references/testing-strategies.md


9. Troubleshooting

Common issues:

  • Hooks not running - Run framework install command, check core.hooksPath
  • Hooks too slow - Use incremental processing, parallel execution, faster tools
  • Windows path issues - Use quotes and forward slashes

Migration strategies: Gradual rollout (formatting → linting → commit validation → testing/security)

📖 For complete troubleshooting: See references/troubleshooting.md


Configuration Examples

Complete examples are available in the examples/ directory:


Migration & Adoption

Gradual Rollout Strategy

Phase 1: Start with formatting (low risk)
  • Add dotnet format / Prettier / Black
  • Warning mode (don't block commits)
  • Team feedback and adjustment
Phase 2: Add linting
  • Add ESLint / Ruff / StyleCop
  • Error mode (block commits)
  • Fix existing violations
Phase 3: Add commit message validation
  • Add commitlint
  • Educate team on Conventional Commits
  • Provide commitizen for assistance
Phase 4: Add testing and security
  • Add dotnet test in pre-push
  • Add gitleaks in pre-commit
  • CI/CD enforcement

Test Scenarios

Scenario 1: Framework Selection for.NET Project

User Query: "I need to set up git hooks for my C# project with 15 developers"

Expected Behavior:

  • Skill activates on keywords: "git hooks", "C#", ".NET"
  • Provides Quick Start Decision Tree guiding to framework selection
  • Considers team size (medium team)
  • Recommends Husky.Net (native integration) or lefthook (performance)
  • Links to framework comparison and setup workflows

Scenario 2: Performance Optimization Request

User Query: "My pre-commit hook is taking 35 seconds and blocking developers from committing"

Expected Behavior:

  • Skill activates on keywords: "pre-commit hook", "slow", "performance"
  • Recognizes performance problem
  • Provides immediate optimization strategies
  • Links to performance-optimization.md for deep-dive

Scenario 3: Framework Comparison Request

User Query: "Should I use Husky.Net or lefthook for our.NET team?"

Expected Behavior:

  • Skill activates on framework names: "Husky.Net", "lefthook"
  • Provides framework comparison matrix
  • Asks relevant follow-up questions (team size, performance requirements)
  • Guides decision based on context

Scenario 4: Conventional Commits Implementation

User Query: "How do I enforce Conventional Commits in my JavaScript project?"

Expected Behavior:

  • Skill activates on keywords: "Conventional Commits", "JavaScript", "enforce"
  • Recognizes commit validation need
  • Provides setup steps for commitlint
  • Links to conventional-commits.md for complete guide

Scenario 5: Secret Scanning Integration

User Query: "I want to prevent developers from accidentally committing secrets to our repository"

Expected Behavior:

  • Skill activates on keywords: "secrets", "prevent", "commit"
  • Recognizes security requirement
  • Recommends gitleaks or TruffleHog
  • Links to secret-scanning.md
  • Mentions both local (pre-commit) and CI/CD enforcement

References

Official Documentation (access via MCP servers):

Detailed references:

Version History

  • v1.0.0 (2025-12-26): Initial release

Last Updated

Date: 2025-11-28 Model: claude-opus-4-5-20251101

Research Sources: Microsoft Learn MCP, Context7 MCP (Husky.Net, lefthook, Husky, pre-commit repositories), Perplexity MCP (2024-2025 best practices), Firecrawl MCP (official documentation sites), Ref MCP (commitlint, semantic-release).

平台分布

trae

30.02%
按下载量换算24

Antigravity

19.82%
按下载量换算16

windsurf

18.17%
按下载量换算15

Claude Code

12.37%
按下载量换算10

Codex

6.87%
按下载量换算5

Gemini CLI

3.2%
按下载量换算3

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/melodic-software/claude-code-plugins --skill git-hooks;npx skills add melodic-software/claude-code-plugins --skill "git-hooks" 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills