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 1mo 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.
- 1mo 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 (498 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.
Other skills, from other repositories
setup-pre-commit
A setup for Husky pre-commit checks in a JavaScript or TypeScript repository. A pre-commit hook runs automatically before a Git commit and can format staged files, check types, and run tests.
chinese-commit-conventions
A Chinese-language guide to Conventional Commits, a format for writing consistent Git commit messages, plus related changelog, commit-checking, and commit-helper configuration.
implement-spec
A coding workflow that implements a written specification through a set of linked tickets. It creates a branch and draft pull request, assigns independent work to separate agents, combines their changes, and prepares the result for review.
git-guardrails-claude-code
A Claude Code setup that blocks selected destructive Git commands before they run. Git is a tool for tracking code changes; the blocked commands include pushing, deleting branches, discarding changes, and hard resets.
dsh-git-commit
A Git commit guide for writing standardised commit messages and performing basic checks before committing code. Git commits are saved checkpoints in a project’s history.
commit
Create a git commit with clear, conventional commit messages. You MUST read this when the user wants to commit staged changes, write a commit message, or finalize code changes with proper conventional commit format since it describes how to follow the user's specific requirements.