SKILL

setup-pre-commit

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.

Target: Software development & testing. Automatically collected · unverified.

Excerpt from the author’s documentation

Extracted from a fixed version of SKILL.md in its original language. This is the author’s documentation; installation, compatibility and runtime results have not been verified by this site.

Read the original English text

Topics in the source

  • Setup Pre-Commit Hooks
  • What This Sets Up
  • Steps
  • 1. Detect package manager
  • 2. Install dependencies
  • 3. Initialize Husky
  • 4. Create .husky/pre-commit
  • 5. Create .lintstagedrc

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 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. Install as devDependencies: This creates .husky/ dir and adds prepare: "husky" to package.json. Write this file (no shebang needed for Husky v9+): 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. Only create if no Prettier config exists. Use these defaults: [ ] .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 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. 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,

This is an excerpt. Refer to the complete source and its current requirements.

Source repository
mattpocock/skills
Source file
skills/misc/setup-pre-commit/SKILL.md
Fixed revision
4ae2317ddb22b046e26455e4f9c9b3aaaf62212d
Read the complete original documentation ↗

Sources and evidence

This record was collected automatically. Its documentation, suitability and runtime behavior have not been manually verified.

Author: Matt Pocock Skills · original repository metadata. Documentation review: Not reviewed. Last source check: 2026-11-10T22:01:34.096Z.

Categories are inferred from names, descriptions and paths. They do not establish compatibility.

License and attribution

MIT. Third-party content and copyright remain with their authors. Refer to the original license and terms.

Original license ↗

Synchronization, copying and user-reported success do not mark a resource as runtime-tested.

Limitations and notes

  • Collecting metadata does not mean this site has installed, adapted, runtime-tested or security-reviewed the resource.