setup-pre-commit
Skill3 starsChanged 4 months agoMITView on GitHub
在目前的 repo 中以 lint-staged(Prettier)、型別檢查與測試設定 Husky pre-commit hooks。當使用者想要新增 pre-commit hooks、設定 Husky、設定 lint-staged,或新增提交時的格式化/型別檢查/測試時使用。
54 other projects use a version of this, 48 of them edited.
Adopted by
Most recently taken up by
- mattpocock/skillsedited, first seen Oct 8, 2026
- hmjBill/skillsedited, first seen Oct 5, 2026
- KroxiDev/engineering-skillsedited, first seen Oct 5, 2026
- jrjsmrtn/project-orchestration-skillstheir own version, first seen Sep 30, 2026
- nomdedev/agent-manager-templateedited, first seen Sep 30, 2026
- snowfluke/engineering-skillstheir own version, first seen Sep 30, 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.
kayamanSkilledit-article
Edit and improve articles by restructuring sections, improving clarity, and tightening prose. Use when user wants to edit, revise, or improve an article draft.
Also in 20 projects that use this
kayamanSkillrequest-refactor-plan
Guides creating a detailed refactor plan with tiny commits via user interview, then files it as a GitHub issue. Use when user wants to plan a refactor, create a refactoring RFC, or break a refactor into safe incremental steps.
Also in 20 projects that use this
Jonathan0823Skilldesign-an-interface
Generate multiple radically different interface designs for a module using parallel sub-agents. Use when user wants to design an API, explore interface options, compare module shapes, or mentions "design it twice".
Also in 19 projects that use this
kennethkeimSkillubiquitous-language
Extract a DDD-style ubiquitous language glossary from the current conversation, flagging ambiguities and proposing canonical terms. Saves to UBIQUITOUS_LANGUAGE.md. Use when user wants to define domain terms, build a glossary, harden terminology, create a ubiquitous language, or mentions "domain model" or "DDD".
Also in 19 projects that use this
Other versions54 projects use a version of this.
Word for word · 0
None found.
Edited · 48
- mattpocock/skills★ 335k13% same
- vinvcn/mattpocock-skills-zh-CN★ 4.6k18% same
- devcxl/mattpocock-skills-zh★ 42623% same
- amazingloft999-droid/mattpocock-skills★ 42213% same
- loulanyue/skills★ 23113% same
- tt-a1i/matt-skills-with-to-goal★ 18213% same
- aurorasoft2/Matt_Pocock_Skills★ 13313% same
- VisualxIntelligence/mattpocok-skills★ 5513% same
- leandrocfe/skills★ 3813% same
- VoDaiLocz/kilo-kit-mcp★ 2713% same
38 more not listed
Wrote their own version · 6
- jrjsmrtn/project-orchestration-skills★ 15same name
- chrislacey89/skills★ 3same name
- kayaman/skills★ 2same name
- snowfluke/engineering-skills★ 1same name
- xeroc/skills★ 1same name
- chieaid24/skills★ 0same name
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 repository36 other files it gives its agents.
- AGENTS.mdAGENTS.md
- 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.

