Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add devcxl/mattpocock-skills-zh --skill setup-pre-commitgit clone --depth 1 https://github.com/devcxl/mattpocock-skills-zhWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/devcxl/mattpocock-skills-zh/setup-pre-commit)<a href="https://agentmods.dev/skills/devcxl/mattpocock-skills-zh/setup-pre-commit"><img src="https://agentmods.dev/badge/skills/devcxl/mattpocock-skills-zh/setup-pre-commit/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/devcxl/mattpocock-skills-zh/setup-pre-commit"><img src="https://agentmods.dev/badge/skills/devcxl/mattpocock-skills-zh/setup-pre-commit.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector warn
SkillSpector: 3 findings, up to medium
These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →
- medium MCP Rug Pull · line 32 npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.Fix: Pin the version: npx @scope/[email protected]
- medium MCP Rug Pull · line 42 npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.Fix: Pin the version: npx @scope/[email protected]
- medium MCP Rug Pull · line 79 npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.Fix: Pin the version: npx @scope/[email protected]
What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00070 | $0.00744 |
| Opus 5.5 | $0.00028 | $0.00298 |
| Sonnet 5.5 | $0.00014 | $0.00149 |
| Haiku 4.5 | $0.00007 | $0.00074 |
Grade A, and why
setup-pre-commit scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
设置 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。
2. 安装依赖
安装为 devDependencies:
husky lint-staged prettier
3. 初始化 Husky
npx husky init
这会创建 .husky/ 目录并在 package.json 中添加 prepare: "husky"。
4. 创建 .husky/pre-commit
写入以下内容(Husky v9+ 不需要 shebang):
npx lint-staged
npm run typecheck
npm run test
适配:将 npm 替换为检测到的包管理器。如果仓库的 package.json 中没有 typecheck 或 test 脚本,则省略对应行并告知用户。
5. 创建 .lintstagedrc
{
"*": "prettier --ignore-unknown --write"
}
6. 创建 .prettierrc(如果缺失)
仅当不存在 Prettier 配置时才创建。使用以下默认值:
{
"useTabs": false,
"tabWidth": 2,
"printWidth": 80,
"singleQuote": false,
"trailingComma": "es5",
"semi": true,
"arrowParens": "always"
}
7. 验证
-
.husky/pre-commit存在且可执行 -
.lintstagedrc存在 - package.json 中的
prepare脚本为"husky" -
prettier配置存在 - 运行
npx lint-staged验证其是否正常工作
8. 提交
暂存所有更改/创建的文件,并使用消息提交:Add pre-commit hooks (husky + lint-staged + prettier)
这将触发新的 pre-commit 钩子执行:是一个很好的冒烟测试,验证一切正常。
注意事项
- Husky v9+ 不需要在钩子文件中加 shebang
prettier --ignore-unknown会跳过 Prettier 无法解析的文件(如图片等)- pre-commit 钩子先运行 lint-staged(快速,仅处理暂存文件),然后运行完整的 typecheck 和 test
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3mo ago First seen · 92 lines · 70 tokens per session scan A 019d16766d33
setup-pre-commit is a skill published in the GitHub repository devcxl/mattpocock-skills-zh (573 stars, last pushed yesterday), licensed MIT. It adds 70 tokens to every session and 744 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
setup-pre-commit compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| setup-pre-commitdevcxl/mattpocock-skills-zh | Skill | 573 | yesterday | MIT | A | 70 | Claude Code, Codex |
| setup-pre-commitvinvcn/mattpocock-skills-zh-CN | Skill | 6.3k | 2d ago | MIT | A | 65 | Claude Code, Codex |
| chinese-commit-conventionsjnMetaCode/superpowers-zh | Skill | 8.7k | 3d ago | MIT | A | 65 | Claude Code |
| implement-specvinvcn/mattpocock-skills-zh-CN | Skill | 6.3k | 2d ago | MIT | A | 19 | Claude Code, Codex |
| git-guardrails-claude-codevinvcn/mattpocock-skills-zh-CN | Skill | 6.3k | 2d ago | MIT | B | 68 | Claude Code, Codex |
| commitjim60105/copilot-prompt | Skill | 22 | 5d ago | GFDL-1.3 | A | 51 | Claude Code, Codex |
| dsh-git-commithackerFish/awesome-dsh-skills | Skill | 6 | 3mo ago | MIT | A | 30 | Claude Code, Codex |