Individual skill

setup-pre-commit

在当前仓库中设置 Husky pre-commit 钩子,集成 lint-staged(Prettier)、类型检查和测试。当用户想要添加 pre-commit 钩子、设置 Husky、配置 lint-staged、或添加提交时的格式化/类型检查/测试时使用。

skills/misc/setup-pre-commit/SKILL.md

Read pinned source

Source commit 30fc5dbf9380144598f3593e6c1e22c713a52c2a

What was checked

Matches the observed repository HEAD
Yes
Scanner rules are current
Yes
Repository scan complete
No
Skill scan complete
No
Observed behavior
Network or broad shell
Last checked
Nov 10, 2026

These are observations at the recorded commit, not a guarantee of safety. Review the source before running it.

Install this skill

Choose an agent in your Stack or copy a command below. Commands fetch the pinned commit and copy only this skill directory. Existing destinations are refused. Copying a command does not install anything.

An install command is unavailable: current rules, complete repository and skill scans, an eligible behavior level and a permitted license are required.

Repository context

Repository stars (not skill ratings)
536
Repository last updated
Nov 3, 2026
License
MIT

Observed agent integration: No specific integration evidence. Standard SKILL.md installation does not imply verified compatibility.

Files and excerpt

File metadata and permitted, redacted excerpts come from the recorded scan. Source links are pinned to that commit.

Browse files
Read excerpt

# 设置 Pre-Commit 钩子

## 将要设置的内容

- **Husky** pre-commit 钩子
- **lint-staged** 对所有暂存文件运行 Prettier
- **Prettier** 配置(如果缺失)
- **typecheck** 和 **test** 脚本在 pre-commit 钩子中运行

## 步骤

### 1. 检测包管理器

检查 `package-lock.json`(npm)、`pnpm-lock.yaml`(pnpm)、`yarn.lock`(yarn)、`bun.lockb`(bun)。使用已存在的那个。如果不确定,默认使用 npm。
Back to top