setup-pre-commit
Installation
SKILL.md
设置 Pre-Commit Hooks
设置内容 (What This Sets Up)
- Husky pre-commit hook
- lint-staged 对所有暂存文件运行 Prettier
lint-staged running Prettier on all staged files
- Prettier 配置(如果缺失)
Prettier config (if missing)
- pre-commit hook 中的 typecheck 和 test 脚本
typecheck and test scripts in the pre-commit hook
步骤 (Steps)
1. 检测包管理器
检查 package-lock.json(npm)、pnpm-lock.yaml(pnpm)、yarn.lock(yarn)、bun.lockb(bun)。使用存在的那个。如果不确定,默认使用 npm。
Check for
package-lock.json(npm),pnpm-lock.yaml(pnpm),yarn.lock(yarn),bun.lockb(bun). Use whichever is present. Default to npm if unclear.