git-hooks-setup
Configure pre-commit, commit-msg, and pre-push hooks to standardize your team's development workflow. Supports both husky and native git hooks, with built-in linting, code formatting, commit message validation, and secret detection to catch issues before they reach your repository.
git-hooks-setup automates pre-commit, commit-msg, and pre-push hooks to enforce code quality and commit standards.
AI-generated summary based on this skill's SKILL.md
Install
wu529778790/shenzjd-skills/git-hooks-setup · repository language: Shell
git clone https://github.com/wu529778790/shenzjd-skills
cp -r shenzjd-skills/git-hooks-setup ~/.claude/skills/git-hooks-setupnpx skillfed install wu529778790/shenzjd-skills/git-hooks-setupFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I set up git hooks for my project?
git-hooks-setup enables you to configure pre-commit, commit-msg, and pre-push hooks that run automatically during your git workflow. You can use husky for a managed approach or native git hooks for a lightweight alternative. The skill guides you through initializing hooks, linking them to your repository, and connecting them to linting, formatting, and validation tools so code quality checks run before commits reach your repository.
How can git-hooks-setup help prevent pushing broken code?
git-hooks-setup prevents broken code from reaching your repository by running automated checks at multiple stages. Pre-commit hooks catch linting and formatting issues, commit-msg hooks validate your commit messages against team conventions, and pre-push hooks run tests before code is pushed. Together, these layers ensure only code meeting your team's standards advances through your workflow.
What's the best way to configure pre-commit linting and formatting with husky?
git-hooks-setup integrates husky with lint-staged to run linting and formatting on staged files before each commit. The setup process installs husky, creates pre-commit hooks, and configures lint-staged to apply your linters and formatters only to changed files. This approach keeps your workflow fast while ensuring consistent code style across your team's projects.
How does git-hooks-setup enforce team commit message conventions?
git-hooks-setup uses commitlint to validate commit messages against your team's standards. The commit-msg hook intercepts commits and checks them against a configuration file defining your message format rules. If a commit doesn't match your conventions, it's rejected before entering the repository, ensuring consistent, readable commit history across your team.
Can git-hooks-setup detect secrets before they're committed?
Yes. git-hooks-setup integrates secret scanning into your pre-commit hooks to detect API keys, credentials, and other sensitive data before they reach your repository. When a secret is found, the commit is blocked, protecting your codebase from accidental exposure and helping your team maintain security standards.
Does git-hooks-setup work without husky?
Yes. git-hooks-setup supports native git hooks configuration as a lightweight alternative to husky. You can manually set up pre-commit, commit-msg, and pre-push hooks in your .git/hooks directory and connect them to your linting, formatting, and validation tools. This approach works well for teams preferring minimal dependencies while still standardizing development workflows.
SKILL.md
rendered from the published skill — quoted content, verbatim
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: 检测项目环境
```bash
检测包管理器(按
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 3 files
git-hooks-setup/README.md
git-hooks-setup/SKILL.md
git-hooks-setup/templates/commitlint.config.js