Testing 15,151 installs

Setup Pre-Commit Hooks

by mattpocock/skills

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…

Skill content

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: