setup-pre-commit
Installation
SKILL.md
设置 Pre-Commit Hooks
这会设置什么
- Husky pre-commit hook
- lint-staged 对所有暂存文件运行 Prettier
- Prettier 配置(如缺失)
- pre-commit hook 中的 typecheck 和 test 脚本
步骤
1. 检测包管理器
检查 package-lock.json(npm)、pnpm-lock.yaml(pnpm)、yarn.lock(yarn)、bun.lockb(bun)。使用存在的那个。不确定时默认使用 npm。
2. 安装依赖
安装为 devDependencies: