setup-pre-commit
Skill3 starsChanged 54 days agoMITView on GitHub
在目前的 repo 中以 lint-staged(Prettier)、型別檢查與測試設定 Husky pre-commit hooks。當使用者想要新增 pre-commit hooks、設定 Husky、設定 lint-staged,或新增提交時的格式化/型別檢查/測試時使用。
150 other projects use a version of this, 130 of them edited.
Adopted by
Most recently taken up by
- quarkiverse/quarkus-reactive-messaging-nats-jetstreamedited, first seen Nov 30, 2026
- ctaxnagomi/agent-kd-skilltheir own version, first seen Nov 29, 2026
- karanmrn/karanagentskillsedited, first seen Nov 29, 2026
- karanmrn/kstackedited, first seen Nov 29, 2026
- conalyz/conalyz_cliedited, first seen Nov 29, 2026
- jatupornrmutsb/claude-skillsedited, first seen Nov 29, 2026
Used with
Projects with it also use edit-article, request-refactor-plan and 2 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
simo97Skilledit-article
The user will invoke this skill to help them edit an article.
Also in 41 projects that use this
simo97Skillrequest-refactor-plan
Use this skill when user wants to create a refactor plan.
Also in 40 projects that use this
FabienDehopreSkilldecision-mapping
Turn a loose idea into a sequenced map of investigation tickets, then drive them to resolution one at a time.
Also in 6 projects that use this
- +1 more from simo97
Other versions150 projects use a version of this.
Word for word · 0
None found.
Edited · 130
- mattpocock/skills★ 335k13% same
- vinvcn/mattpocock-skills-zh-CN★ 6.2k21% same
- devcxl/mattpocock-skills-zh★ 56523% same
- amazingloft999-droid/mattpocock-skills★ 42213% same
- InditexTech/weavejs★ 27713% same
- loulanyue/skills★ 23113% same
- tt-a1i/matt-skills-with-to-goal★ 19213% same
- aurorasoft2/Matt_Pocock_Skills★ 13313% same
- QiYueran-source/waymark★ 11213% same
- Tresnanda/kybern★ 10213% same
120 more not listed
Wrote their own version · 20
- jrjsmrtn/project-orchestration-skills★ 19same name
- josortmel/EcoRelay★ 15same name
- imMamdouhaboammar/matts-skills-into-chatgpt★ 8same name
- chrislacey89/skills★ 7same name
- amit-t/skills★ 4same name
- ctaxnagomi/agent-kd-skill★ 4same name
- kayaman/skills★ 3same name
- ForgeyClap/claude-forge★ 2same name
- ForgeyClap/Forge-Core★ 2same name
- pumpkit-io/sdlc★ 2same name
10 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository35 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- ask-mattSkill
- codebase-designSkill
- code-reviewSkill
- diagnosing-bugsSkill
- domain-modelingSkill
- grill-with-docsSkill
- implementSkill
- improve-codebase-architectureSkill
- prototypeSkill
- researchSkill
- resolving-merge-conflictsSkill
- setup-matt-pocock-skillsSkill
- tddSkill
- to-specSkill
- to-ticketsSkill
- triageSkill
- wayfinderSkill
- wizardSkill
- claude-handoffSkill
- loop-meSkill
- setup-ts-deep-modulesSkill
- writing-beatsSkill
- writing-fragmentsSkill
- writing-shapeSkill
- git-guardrails-claude-codeSkill
- migrate-to-shoehornSkill
- scaffold-exercisesSkill
- grillingSkill
- grill-meSkill
- handoffSkill
- teachSkill
- to-questionnaireSkill
- wait-whatSkill
- writing-for-agentsSkill
The file
Files
設定 Pre-Commit Hooks
這會設定什麼
- Husky pre-commit hook
- lint-staged 在所有已暫存的檔案上執行 Prettier
- Prettier 設定(如果缺少)
- pre-commit hook 中的 typecheck 與 test 腳本
步驟
1. 偵測套件管理員
檢查 package-lock.json(npm)、pnpm-lock.yaml(pnpm)、yarn.lock(yarn)、bun.lockb(bun)。使用存在的那個。如果不清楚,預設為 npm。
2. 安裝相依套件
安裝為 devDependencies:
husky lint-staged prettier3. 初始化 Husky
npx husky init這會建立 .husky/ 目錄,並將 prepare: "husky" 加到 package.json。
4. 建立 .husky/pre-commit
寫入這個檔案(Husky v9+ 不需要 shebang):
npx lint-staged
npm run typecheck
npm run test調整:將 npm 取代為偵測到的套件管理員。如果 repo 在 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 hooks — 一個很好的煙霧測試,確認一切都能運作。
備註
- Husky v9+ 不需要 hook 檔案中的 shebangs
prettier --ignore-unknown會跳過 Prettier 無法解析的檔案(圖片等)- pre-commit 先執行 lint-staged(快速、只針對已暫存),然後是完整的型別檢查與測試
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

