/mattpocock-skills:setup-pre-commitfrom mattpocock-skills
Sets up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests. Detects package manager, installs dependencies, and configures hooks for automated formatting and validation on commit.
Ships in mattpocock-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
检查 package-lock.json (npm)、pnpm-lock.yaml (pnpm)、yarn.lock (yarn)、bun.lockb (bun)。使用存在的那个。不清楚时默认 npm。
作为 devDependencies 安装:
husky lint-staged prettier
npx husky init
这会创建 .husky/ dir,并向 package.json 添加 prepare: "husky"。
.husky/pre-commit写入这个文件(Husky v9+ 不需要 shebang):
npx lint-staged
npm run typecheck
npm run test
Adapt:把 npm 替换为检测到的 package manager。如果 repo 的 package.json 没有 typecheck 或 test script,就省略对应行并告知用户。
.lintstagedrc{
"*": "prettier --ignore-unknown --write"
}
.prettierrc(如果缺失)只有没有 Prettier config 时才创建。使用这些 defaults:
{
"useTabs": false,
"tabWidth": 2,
"printWidth": 80,
"singleQuote": false,
"trailingComma": "es5",
"semi": true,
"arrowParens": "always"
}
.husky/pre-commit 存在且可执行.lintstagedrc 存在prepare script 是 "husky"npx lint-staged 验证可用Stage 所有 changed/created files,并用 message 提交:Add pre-commit hooks (husky + lint-staged + prettier)
这会经过新的 pre-commit hooks,是一个不错的 smoke test。
prettier --ignore-unknown 会跳过 Prettier 无法 parse 的 files(images 等)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
husky, lint-staged, prettier, pre-commit-hooks, git-hooks, code-formatting
38 skills in this plugin
/ask-matt询问当前情境适合哪个技能或流程;它是本仓库所有 skills 的路由器。/chief-of-staff在单个 session 中通过协调 subagents 来推进一个长期目标。/claude-handoff把当前对话交接给一个全新的 background agent,让它立即接手工作。/codebase-design用于设计深模块的共享词汇。适用于用户想设计或改进模块接口、寻找深化机会、决定 seam 放在哪里、让代码更容易测试或更适合 AI 导航,或其他技能需要深模块词汇时。/code-review从固定点(commit、branch、tag 或 merge-base)开始,按 Standards(代码是否符合本仓库记录的编码标准?)和 Spec(代码是否符合来源 issue/spec 的要求?)两个轴线审查变更。两个审查会在并行子代理中运行,并并排报告。适用于用户想审查 branch、PR、进行中的变更,或要求“review since X”时。/diagnosing-bugs面向棘手缺陷和性能回退的诊断循环。适用于用户说 “diagnose” / “debug this”,或报告某些东西 broken、throwing、failing、slow 时。npx claudepluginhub vinvcn/mattpocock-skills-zh-cn --plugin mattpocock-skillsOther plugins' skills for the same job