关于 lefthook
按任务整理 Lefthook 文档的参考技能,便于查找相关说明。内容涵盖 Lefthook v2.2.2 的安装、配置、命令、集成、示例和 AI Agent hook 设置。
主要功能
- 01按任务映射文档类别
- 02安装方式与设置指南
- 03Hook、命令和脚本配置
- 04CLI 用法与环境变量
- 05集成和本地覆盖示例
适用场景
- 01选择 Lefthook 安装方式
- 02配置 Git hooks 和命令
- 03查询环境变量控制选项
- 04设置 AI Agent hook 配置
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ fandhe-ai/ agent-reference-skills --skill lefthook安装后在 Claude Code 中输入/lefthook确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
references/configuration/ai.mdcommand-settings.mdglobal-settings.mdhook-settings.mdREADME.mdremotes.mdscript-settings.mdsource-dir.mdreferences/examples/commitlint.mdfilters.mdlefthook-local.mdprotect-branch.mdREADME.mdremotes.mdskip.mdstage-fixed.mdwrap-commands.mdreferences/installation/alpine.mdarch.mddeb.mddevbox.mdgo.mdhomebrew.mdmanual.mdmise.mdnode.mdoverview.mdphp.mdpython.mdREADME.md详细介绍
Lefthook 参考
涵盖 Lefthook(lefthook.dev)全部文档的技能。 根据用户的任务读取适当的 README.md,并从中找到相关文件。
适用于 Lefthook v2.2.2(截至 2026-10,原始内容为 GitHub 标签 v2.2.2 中的 docs/)。
目录结构
skills/lefthook/
SKILL.md
references/
installation/
README.md
overview.md
node.md
ruby.md
go.md
python.md
php.md
swift.md
homebrew.md
winget.md
scoop.md
deb.md
rpm.md
alpine.md
arch.md
snap.md
devbox.md
mise.md
manual.md
configuration/
README.md
ai.md
global-settings.md
hook-settings.md
command-settings.md
script-settings.md
source-dir.md
remotes.md
usage/
README.md
commands.md
environment-variables.md
examples/
README.md
commitlint.md
filters.md
lefthook-local.md
protect-branch.md
remotes.md
skip.md
stage-fixed.md
wrap-commands.md
samples/
README.md
basic-setup.md
parallel-execution.md
auto-fix-and-stage.md
commitlint-integration.md
local-override.md
conditional-skip.md
monorepo-setup.md
shared-config-via-remotes.md
scripts/
README.md
cli.md
install.md
run-with-env.md
探索步骤
根据任务查找对应类别,再通过该类别的 README.md 找到目标页面:
- 在下方映射表中查找与任务对应的类别
- 参阅该类别的
references/{category}/README.md,找到目标页面 - Read 相应的
.md页面以查看详情
任务 → 类别映射
| 任务 | 类别 | 参考 README |
|---|---|---|
| 安装和设置 Lefthook | installation | references/installation/README.md |
| 通过 npm / yarn / pnpm / pip / gem / composer 安装 | installation | references/installation/README.md |
| 通过 Homebrew / Scoop / Winget / APK / AUR 安装 | installation | references/installation/README.md |
| 手动安装二进制文件、支持 mise / devbox | installation | references/installation/README.md |
| lefthook.yml 全局配置 | configuration | references/configuration/README.md |
| Hook 配置(parallel, piped, follow, skip) | configuration | references/configuration/README.md |
| Command 配置(run, glob, files, stage_fixed) | configuration | references/configuration/README.md |
| Script 配置、更改 source_dir | configuration | references/configuration/README.md |
| 通过 remotes 共享配置 | configuration | references/configuration/README.md |
| AI Agent hooks(ai: 生成 claude / codex / cursor / copilot 的 hooks 配置文件) | configuration | references/configuration/README.md |
| 编辑器补全、JSON schema(lefthook.dev/schema.json) | configuration | references/configuration/README.md |
| lefthook install / run / add / validate / dump | usage | references/usage/README.md |
| 通过环境变量(LEFTHOOK、LEFTHOOK_VERBOSE 等)控制 | usage | references/usage/README.md |
| commitlint / Commitizen 集成 | examples | references/examples/README.md |
| 文件筛选(glob / staged_files / tags) | examples | references/examples/README.md |
| 通过 lefthook-local.yml 进行本地覆盖 | examples | references/examples/README.md |
| 条件跳过、分支限制 | examples | references/examples/README.md |
| 当前分支为 main / master 时通过 pre-push 阻止 push(不判断 push 目标 ref) | examples | references/examples/README.md |
| 了解典型用法 | samples | samples/README.md |
| 了解安装、CLI 命令 | scripts | scripts/README.md |
评论
支持 Markdown