setup-pre-commit
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo.
Skill by mattpocock
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/mattpocock-setup-pre-commit
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: testing, version-control
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/setup-pre-commit
What's inside
- Skill name
setup-pre-commit- Description
- 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.
- License
- MIT
- Instructions
- 88 lines in SKILL.md · view on GitHub
Files (2)
- SKILL.md
- openai.yaml · agents/
SKILL.md (first lines)
# Setup Pre-Commit Hooks
## What This Sets Up
- **Husky** pre-commit hook
- **lint-staged** running Prettier on all staged files
- **Prettier** config (if missing)
- **typecheck** and **test** scripts in the pre-commit hook
## Steps
### 1. Detect package manager
Check for `package-lock.json` (npm), `pnpm-lock.yaml` (pnpm), `yarn.lock` (yarn), `bun.lockb` (bun). Use whichever is present. Default to npm if unclear.
### 2. Install dependencies
Install as devDependencies:
```
husky lint-staged prettier
```
### 3. Initialize Husky
```bash
npx husky init
```
This creates `.husky/` dir and adds `prepare: "husky"` to package.json.
### 4. Create `.husky/pre-commit`
Write this file (no shebang needed for Husky v9+):
```
npx lint-staged
npm run typecheck
npm run test
```
**Adapt**: Replace `npm` with detected package manager. If repo has no `typecheck` or `test` script in package.json, omit those lines and tell the user.
### 5. Create `.lintstagedrc`
```json
{
"*": "prettier --ignore-unknown --write"
}
```
### 6. Create `.prettierrc` (if missing)
Only create if no Prettier config exists. Use these defaults:
```json
{
"useTabs": false,
"tabWidth": 2,
"printWidth": 80,
"singleQuote": false,
"trailingComma": "es5",
"semi": true,
"arrowParens": "always"
}
```
### 7. Verify
- [ ] `.husky/pre-commit` exists and is executable
- [ ] `.lintstagedrc` exists
- [ ] `prepare` script in package.json is `"husky"`
- [ ] `prettier` config exists
- [ ] Run `npx lint-staged` to verify it works
### 8. Commit
Stage all changed/created files and commit with message: `Add pre-commit hooks (husky + lint-staged + prettier)`
This will run through the new pre-commit hooks: a good smoke test that everything works.
## Notes
- Husky v9+ doesn't need shebangs in hook files
- `prettier --ignore-unknown` skips files Prettier can't parse (images, etc.)
- The pre-commit runs lint-staged first (fast, staged-only), then full typecheck and testsFrom mattpocock/skills, MIT.
More from mattpocock/skills
- 0.885score
scaffold-exercises
mattpocock
Create exercise directory structures with sections, problems, solutions, and explainers that pass linting.
SkillAFreshness: A★ 302.4KClaude Code +9 - 0.882score
setup-ts-deep-modules
mattpocock
Wire dependency-cruiser into a TypeScript repo so each package is a deep module, with implementation hidden in subfolders and reachable only through its…
SkillAFreshness: A★ 302.4KClaude Code +9 - 0.878score
chief-of-staff
mattpocock
Pursue a long-running goal in a single session by co-ordinating subagents.
SkillAFreshness: A★ 302.4KClaude Code +9 - 0.878score
writing-beats
mattpocock
Writing, exploit; assemble raw material into a journey of beats, grounding each term before a beat leans on it.
SkillAFreshness: A★ 302.4KClaude Code +9 - 0.878score
writing-shape
mattpocock
Writing, exploit: shape raw material into an article, paragraph by paragraph.
SkillAFreshness: A★ 302.4KClaude Code +9 - 0.875score
writing-fragments
mattpocock
Writing, explore: mine raw fragments, no structure yet.
SkillAFreshness: A★ 302.4KClaude Code +9 - 0.750score
diagnosing-bugs
mattpocock
Diagnosis loop for hard bugs and performance regressions.
SkillAFreshness: A★ 302.4KClaude Code +9 - 0.750score
git-guardrails-claude-code
mattpocock
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute.
SkillAFreshness: A★ 302.4KClaude Code +9 - 0.745score
domain-modeling
mattpocock
Build and sharpen a project's domain model.
SkillAFreshness: A★ 302.4KClaude Code +9 - 0.745score
codebase-design
mattpocock
Shared vocabulary for designing deep modules.
SkillAFreshness: A★ 302.4KClaude Code +9 - 0.745score
code-review
mattpocock
Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding…
SkillAFreshness: A★ 302.4KClaude Code +9 - 0.745score
prototype
mattpocock
Build a throwaway prototype to answer a design question.
SkillAFreshness: A★ 302.4KClaude Code +9
Compare and alternatives
Featured in
Signals
- Stars
- 302,383
- Forks
- 25,428
- Open issues
- 184
- Last commit (this folder)
- Aug 19, 2026 (2 months ago)
- Last release
- Oct 4, 2026 (23 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/mattpocock/skills
- Website
- aihero.dev/skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
- 0.369score
setup-pre-commit
leandrocfe
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo.
SkillBFreshness: B★ 40Claude Code +9 - 0.364score
setup-pre-commit
tt-a1i
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo.
SkillBFreshness: B★ 187Claude Code +9 - 0.362score
setup-pre-commit
vasyapym
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo.
SkillBFreshness: B★ 20Claude Code +9 - 0.321score
setup-pre-commit
uwvwko-zzz
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo.
SkillCFreshness: C★ 10Claude Code +9 - 0.319score
setup-pre-commit
harshit2490
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo.
SkillCFreshness: C★ 6Claude Code +9 - 0.315score
setup-pre-commit
rodolfochicone
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo.
SkillBFreshness: BClaude Code +9 - 0.315score
setup-pre-commit
deepaktiwari09
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo.
SkillBFreshness: BClaude Code +9 - 0.315score
setup-pre-commit
digitaleflex
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo.
SkillBFreshness: BClaude Code +9 - 0.315score
setup-pre-commit
jamesdebatty
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo.
SkillBFreshness: BClaude Code +9 - 0.312score
setup-pre-commit
TheMoMatthias
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo.
SkillBFreshness: BClaude Code +9 - 0.309score
setup-pre-commit
mkurman
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo.
SkillAFreshness: A★ 325Claude Code +9 - 0.298score
setup-pre-commit
steph-frtech
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo.
SkillCFreshness: C★ 1Claude Code +9
More from mattpocock
- 0.885score
scaffold-exercises
mattpocock
Create exercise directory structures with sections, problems, solutions, and explainers that pass linting.
SkillAFreshness: A★ 302.4KClaude Code +9 - 0.882score
setup-ts-deep-modules
mattpocock
Wire dependency-cruiser into a TypeScript repo so each package is a deep module, with implementation hidden in subfolders and reachable only through its…
SkillAFreshness: A★ 302.4KClaude Code +9 - 0.878score
chief-of-staff
mattpocock
Pursue a long-running goal in a single session by co-ordinating subagents.
SkillAFreshness: A★ 302.4KClaude Code +9 - 0.878score
writing-shape
mattpocock
Writing, exploit: shape raw material into an article, paragraph by paragraph.
SkillAFreshness: A★ 302.4KClaude Code +9 - 0.878score
writing-beats
mattpocock
Writing, exploit; assemble raw material into a journey of beats, grounding each term before a beat leans on it.
SkillAFreshness: A★ 302.4KClaude Code +9 - 0.875score
writing-fragments
mattpocock
Writing, explore: mine raw fragments, no structure yet.
SkillAFreshness: A★ 302.4KClaude Code +9
Cite this page
setup-pre-commit skill. Agent Mart. https://agentmart.dev/skills/mattpocock-setup-pre-commit (last updated 2026-10-24)