git-hooks-setup by aj-geddes/useful-ai-prompts
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill git-hooks-setup配置 Git hooks 以强制执行代码质量标准、运行自动化检查,并防止有问题的提交被推送到共享仓库。
最小工作示例:
#!/bin/bash
# setup-husky.sh
# Install Husky
npm install husky --save-dev
# Initialize Husky
npx husky install
# Create pre-commit hook
npx husky add .husky/pre-commit "npm run lint"
# Create commit-msg hook
npx husky add .husky/commit-msg 'npx --no -- commitlint --edit "$1"'
# Create pre-push hook
npx husky add .husky/pre-push "npm run test"
# Create post-merge hook
npx husky add .husky/post-merge "npm install"
references/ 目录下的详细实现:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 指南 | 内容 |
|---|
| Husky 安装与配置 | Husky 安装与配置 |
| Pre-commit Hook (Node.js) | Pre-commit Hook (Node.js) |
| 提交信息验证 | 提交信息验证 |
| Commitlint 配置 | Commitlint 配置,Pre-push Hook (综合) |
| Pre-commit Framework (Python) | Pre-commit Framework (Python) |
| 敏感信息检测 Hook | 敏感信息检测 Hook,package.json 中的 Husky |
--no-verify 跳过 hooks--no-verify 跳过检查每周安装量
114
仓库
GitHub 星标数
116
首次出现
2026年1月21日
安全审计
安装于
opencode96
gemini-cli93
codex92
cursor88
claude-code88
github-copilot80
Configure Git hooks to enforce code quality standards, run automated checks, and prevent problematic commits from being pushed to shared repositories.
Minimal working example:
#!/bin/bash
# setup-husky.sh
# Install Husky
npm install husky --save-dev
# Initialize Husky
npx husky install
# Create pre-commit hook
npx husky add .husky/pre-commit "npm run lint"
# Create commit-msg hook
npx husky add .husky/commit-msg 'npx --no -- commitlint --edit "$1"'
# Create pre-push hook
npx husky add .husky/pre-push "npm run test"
# Create post-merge hook
npx husky add .husky/post-merge "npm install"
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Husky Installation and Configuration | Husky Installation and Configuration |
| Pre-commit Hook (Node.js) | Pre-commit Hook (Node.js) |
| Commit Message Validation | Commit Message Validation |
| Commitlint Configuration | Commitlint Configuration, Pre-push Hook (Comprehensive) |
| Pre-commit Framework (Python) | Pre-commit Framework (Python) |
| Secret Detection Hook | Secret Detection Hook, Husky in package.json |
--no-verify (rarely)--no-verifyWeekly Installs
114
Repository
GitHub Stars
116
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
opencode96
gemini-cli93
codex92
cursor88
claude-code88
github-copilot80
通过 LiteLLM 代理让 Claude Code 对接 GitHub Copilot 运行 | 高级变通方案指南
36,300 周安装