setup-pre-commit
Skill0 starsChanged 6 months agoMITView on GitHub
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/ typechecking/testing.
150 other projects use a version of this, 135 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 migrate-to-shoehorn, writing-beats and 6 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.
simo97Skillmigrate-to-shoehorn
Migrate test files from `as` type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace `as` in tests, or needs partial test data.
Also in 88 projects that use this
LesaniSkillwriting-beats
Shape an article as a journey of beats, choose-your-own-adventure style. The user picks a starting beat from the raw material, you write only that beat, then offer options for where to pivot next, beat by beat, until the article reaches a natural end. Use when the user has raw material and wants to assemble it as a narrative rather than an argument.
Also in 78 projects that use this
LesaniSkillwriting-shape
Take a markdown file of raw material and shape it into an article through a conversational session — drafting candidate openings, growing the piece paragraph by paragraph, arguing about format (lists, tables, callouts, quotes) at each step. Use when the user has a pile of notes, fragments, or a rough draft and wants help turning it into something publishable.
Also in 78 projects that use this
liufeng1976Skillsetup-ts-deep-modules
Wire dependency-cruiser into a TypeScript repo so each package is a deep module — implementation hidden in subfolders, reachable only through its entry-point files. User-invoked.
Also in 52 projects that use this
RoentekSkillloop-me
Grill me about specs for the workflows I want to build, within this workspace.
Also in 64 projects that use this
richard12511Skillclaude-handoff
Hand the current conversation off to a fresh background agent that picks up the work immediately.
Also in 50 projects that use this
- +1 more from Lesani
Other versions150 projects use a version of this.
Word for word · 0
None found.
Edited · 135
- mattpocock/skills★ 335k43% same
- vinvcn/mattpocock-skills-zh-CN★ 6.2k14% same
- devcxl/mattpocock-skills-zh★ 56515% same
- amazingloft999-droid/mattpocock-skills★ 42243% same
- InditexTech/weavejs★ 27743% same
- loulanyue/skills★ 23143% same
- tt-a1i/matt-skills-with-to-goal★ 19243% same
- aurorasoft2/Matt_Pocock_Skills★ 13343% same
- QiYueran-source/waymark★ 11243% same
- Tresnanda/kybern★ 10243% same
125 more not listed
Wrote their own version · 15
- jrjsmrtn/project-orchestration-skills★ 19same name
- josortmel/EcoRelay★ 15same name
- imMamdouhaboammar/matts-skills-into-chatgpt★ 8same name
- chrislacey89/skills★ 7same name
- Boom-Vitt/skills-thai★ 5same name
- ctaxnagomi/agent-kd-skill★ 4same name
- KroxiDev/engineering-skills★ 4same name
- Binbin-miao/workbuddy-expert-team★ 1same name
- christofferbergj/agent-skills★ 1same name
- kanjiandahai/skills-collection★ 1same name
5 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 repository59 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- cavemanSkill
- context-engineeringSkill
- deprecation-migrationSkill
- design-an-interfaceSkill
- domain-modelSkill
- edit-articleSkill
- git-guardrails-claude-codeSkill
- github-triageSkill
- grill-meSkill
- autoplanSkill
- benchmarkSkill
- browseSkill
- canarySkill
- carefulSkill
- codexSkill
- context-restoreSkill
- context-saveSkill
- csoSkill
- design-consultationSkill
- design-htmlSkill
- design-reviewSkill
- design-shotgunSkill
- devex-reviewSkill
- document-releaseSkill
- freezeSkill
- guardSkill
- healthSkill
- investigateSkill
- land-and-deploySkill
- learnSkill
- make-pdfSkill
- office-hoursSkill
- plan-ceo-reviewSkill
- plan-design-reviewSkill
- plan-devex-reviewSkill
- plan-eng-reviewSkill
- qa-onlySkill
- qaSkill
- retroSkill
- reviewSkill
- setup-deploySkill
- shipSkill
- unfreezeSkill
- improve-codebase-architectureSkill
- incremental-implementationSkill
- performance-optimizationSkill
- pr-triageSkill
- qaSkill
- request-refactor-planSkill
- security-hardeningSkill
- spec-driven-developmentSkill
- tddSkill
- to-issuesSkill
- to-prdSkill
- triage-issueSkill
- ubiquitous-languageSkill
- write-a-skillSkill
- zoom-outSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 136 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
NOT: when project already has working Husky setup — audit/fix instead of reinstalling
- Very specific: line 27
Check for package-lock.json (npm), pnpm-lock.yaml (pnpm), yarn.lock (yarn), bun.lockb (bun).
- Distinctive: line 108
DO NOT: add a shebang to Husky v9+ hook files — causes errors on some systems
“Common” is measured: kept by at least 6 in 10 of the 136 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Setup Pre-Commit Hooks
Installs a complete pre-commit pipeline — Husky hooks running lint-staged (Prettier), type checking, and tests. Formatting debates die when the machine enforces consistency, and catching type errors at commit time is cheaper than catching them in CI 10 minutes later.
When to Use
- User wants to add pre-commit hooks to a JavaScript/TypeScript project
- User asks about Husky, lint-staged, or commit-time formatting
- New project needs a standard quality gate
- NOT for Python projects — use pre-commit framework instead
- NOT when project already has working Husky setup — audit/fix instead of reinstalling
- NOT for CI-only checks that shouldn't block local commits
Process
1. Detect package manager
Check for package-lock.json (npm), pnpm-lock.yaml (pnpm), yarn.lock (yarn), bun.lockb (bun). Default to npm if unclear.
2. Install dependencies
husky lint-staged prettier3. Initialize Husky
npx husky initCreates .husky/ dir and adds prepare: "husky" to package.json.
4. Create .husky/pre-commit
npx lint-staged
npm run typecheck
npm run testAdapt: Replace npm with detected package manager. If repo has no typecheck or test script, omit those lines and tell the user.
5. Create .lintstagedrc
{
"*": "prettier --ignore-unknown --write"
}6. Create .prettierrc (if missing)
{
"useTabs": false,
"tabWidth": 2,
"printWidth": 80,
"singleQuote": false,
"trailingComma": "es5",
"semi": true,
"arrowParens": "always"
}7. Verify and commit
Stage all files and commit — the commit itself is the smoke test.
Common Rationalizations
| Shortcut | Why It Fails |
| "I'll skip the test commit, it probably works" | The commit IS the test. If Husky fails on the setup commit, you catch config issues immediately. |
| "I'll add typecheck/test hooks later" | Later never comes. Include or explicitly tell user they're missing. |
"I'll use --no-verify to skip the hook this once" | Once becomes always. Better to fix the hook than skip it. |
| "Just format everything, not just staged files" | Formatting unstaged files creates noise in diffs. lint-staged scopes to staged files only. |
Red Flags
- Project has no
package.json(not a JS/TS project — wrong skill) - Existing
.husky/directory with custom hooks (could overwrite team config) - Monorepo with multiple packages (need per-package lint-staged config)
- CI already runs these checks and team prefers fast local commits
Verification Checklist
.husky/pre-commitexists and is executable.lintstagedrcexists with valid JSONpackage.jsoncontains"prepare": "husky"- Prettier config exists
npx lint-stagedexits 0- A test commit triggers the pre-commit hook
- If typecheck/test lines omitted, user was told why
Anti-patterns
- DO NOT install globally — Husky must be a devDependency so it works for all contributors
- DO NOT add a shebang to Husky v9+ hook files — causes errors on some systems
- DO NOT format all files in pre-commit (
prettier .) — use lint-staged for staged-only - DO NOT silently skip missing scripts — always inform the user
- DO NOT overwrite existing Husky hooks without checking what's there
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.

