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

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 by pnpm install (the prepare script). Sets git config core.hooksPath .githooks. Skips under CI and without .git.
  • .githooks/pre-commit: POSIX sh. Runs node scripts/hooks/staged.js, then pnpm run validate:duplication, pnpm run typecheck and pnpm test --run.
  • scripts/hooks/staged.config.js: the rule table. Each rule has a match test on the staged path and commands as argument arrays. A fixer has a run form (--fix, --write) and a read-only check form. files: false runs 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

  1. Run pnpm install, or node scripts/hooks/install.js directly.
  2. Check git config core.hooksPath prints .githooks.
  3. Check .githooks/pre-commit is executable (git ls-files --stage .githooks/pre-commit shows 100755).

Add or change a check

  1. Edit scripts/hooks/staged.config.js. Use node with a script path, or the name of a package in node_modules whose bin runs with Node. Never build a shell string.
  2. Give every fixer a check form.
  3. Update tests/hooks/staged.test.ts, which pins the table.
  4. 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-verify skips the hook. CI runs every check again.

04 同仓库更多 Skills

fderuiter
fderuiter/QRCraftly-web

会话交接至后台智能体

claude-handoff

将当前会话交接给一个全新的后台智能体,由其立即接手继续工作。

软件开发工程师会话上下文交接
★ 5
fderuiter
fderuiter/QRCraftly-web

QRCraftly PR 合并管理

steward

如何将 QRCraftly 的拉取请求(PR)推进至合并。适用于创建 PR、处理其上的 CI 或评审事件、更新分支,或决定是否合并。

软件开发工程师代码仓库协作管理
★ 5
fderuiter
fderuiter/QRCraftly-web

QRCraftly 应用运行测试

run-qrcraftly

构建、运行并驱动 QRCraftly Web 应用(Vike + React on Vite)。适用于以下场景:启动开发服务器或生产预览、对页面截图、在生成器或二维码检查器中逐步点击操作、下载生成的二维码、确认 UI 变更在真实应用中生效、直接调用 src/packages 中的函数,或在本容器中运行单元测试与 Playwright 端到端(e2e)测试。

软件开发工程师二维码生成与定制
★ 5
fderuiter
fderuiter/QRCraftly-web

素材成文写作

writing-shape

写作,发挥:将原始素材逐段塑造成一篇文章。

内容创作者创意写作与内容编排
★ 5
fderuiter
fderuiter/QRCraftly-web

写作片段素材挖掘

writing-fragments

写作,探索阶段:挖掘原始素材片段,暂不组织结构。

内容创作者创意写作与内容编排
★ 5
fderuiter
fderuiter/QRCraftly-web

智能体文档编写

writing-for-agents

为智能体编写文档。适用于创建或编辑技能(skill),或修改 AGENTS.md 或 CLAUDE.md。

技术文档工程师技术文档编写
★ 5