AGENT SKILL
pre-commit 钩子配置与维护
setup-pre-commit
安装、运行或修改本仓库自身的 pre-commit 钩子(.githooks/pre-commit 及暂存文件运行脚本 scripts/hooks/staged.js)。当钩子未运行、需要添加或更改提交时检查,或需要解释 pre-commit 失败原因时使用。
适用职业软件开发工程师
使用场景开发环境与工具链管理
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 5
- Forks
- 0
01 前言 Front Matter
- name
- setup-pre-commit
- license
- MIT
- description
- Install, run or change this repo's own pre-commit hook (.githooks/pre-commit and the staged-file runner scripts/hooks/staged.js). Use when the hook is not running, when a commit-time check needs adding or changing, or when a pre-commit failure needs explaining.
02 资源文件 1
- 参考文档agents/openai.yaml99 B
03 SKILL.md 正文
Pre-Commit Hook
QRCraftly runs its own pre-commit hook, with no hook packages (ADR 0044).
Parts
scripts/hooks/install.js: run bypnpm install(thepreparescript). Setsgit config core.hooksPath .githooks. Skips underCIand without.git..githooks/pre-commit: POSIXsh. Runsnode scripts/hooks/staged.js, thenpnpm run validate:duplication,pnpm run typecheckandpnpm test --run.scripts/hooks/staged.config.js: the rule table. Each rule has amatchtest on the staged path and commands as argument arrays. A fixer has arunform (--fix,--write) and a read-onlycheckform.files: falseruns a whole-set check once.scripts/hooks/staged.js: runs the rules on the staged files. Partly staged files are checked, never rewritten. Fully staged files a fixer changed are staged again.
Steps
The hook does not run
- Run
pnpm install, ornode scripts/hooks/install.jsdirectly. - Check
git config core.hooksPathprints.githooks. - Check
.githooks/pre-commitis executable (git ls-files --stage .githooks/pre-commitshows100755).
Add or change a check
- Edit
scripts/hooks/staged.config.js. Usenodewith a script path, or the name of a package innode_moduleswhosebinruns with Node. Never build a shell string. - Give every fixer a
checkform. - Update
tests/hooks/staged.test.ts, which pins the table. - Run
pnpm exec vitest --run tests/hooks.
A commit failed
- The summary names the command and the files. Fix them, stage them and commit again.
- "has unstaged changes, so it was checked, not fixed": stage the whole file, or the fix with
git add -p, or fix it by hand. git commit --no-verifyskips the hook. CI runs every check again.
04 同仓库更多 Skills
会话交接至后台智能体
claude-handoff
将当前会话交接给一个全新的后台智能体,由其立即接手继续工作。
★ 5
QRCraftly PR 合并管理
steward
如何将 QRCraftly 的拉取请求(PR)推进至合并。适用于创建 PR、处理其上的 CI 或评审事件、更新分支,或决定是否合并。
★ 5
QRCraftly 应用运行测试
run-qrcraftly
构建、运行并驱动 QRCraftly Web 应用(Vike + React on Vite)。适用于以下场景:启动开发服务器或生产预览、对页面截图、在生成器或二维码检查器中逐步点击操作、下载生成的二维码、确认 UI 变更在真实应用中生效、直接调用 src/packages 中的函数,或在本容器中运行单元测试与 Playwright 端到端(e2e)测试。
★ 5
素材成文写作
writing-shape
写作,发挥:将原始素材逐段塑造成一篇文章。
★ 5
写作片段素材挖掘
writing-fragments
写作,探索阶段:挖掘原始素材片段,暂不组织结构。
★ 5
智能体文档编写
writing-for-agents
为智能体编写文档。适用于创建或编辑技能(skill),或修改 AGENTS.md 或 CLAUDE.md。
★ 5